Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Ben Muller
Published © CC BY-NC-SA

Pac-Man LED Pixel Panel Costume

Portable LED panels let you dress us like your favorite 8-bit video game characters.

IntermediateFull instructions provided55,151

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Not *needed* but super helpful

Story

Read more

Custom parts and enclosures

Ghost Laser Cutter File

Files to laser cut the ghost costume from 1/8" cardboard. It is set up for a 32" x 18" laser cutter bed size.

Ghost Base PDF

Pacman-MsPacman-Laser

Laser cutter DWG file for Ms. Pacman and Pacman

Schematics

Wiring Diagram

How to plugin the LEDs, Ardunio, and portable power

Code

LED Ghost Animation Code

Arduino
This code runs the animation for the Ghosts
//ANIMATED PACMAN GHOST LED

#include "FastLED.h"

#define NUM_LEDS 170

#define DATA_PIN 3

CRGB leds[NUM_LEDS];

void setup() {
  delay(2000);
  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
  FastLED.setBrightness(40); //Number 0-255
  FastLED.clear();
}

//looking left
int eyes_pixels_l[] = {17, 20, 21, 24, 37, 38, 39, 40, 41, 47, 48, 49, 94, 102, 103, 106, 119, 120, 121, 122, 123, 129, 130, 131};
int pupils_pixels_l[] = {15, 16, 22, 23, 92, 93, 104, 105};

//looking right
int eyes_pixels_r[] = {38, 39, 40, 46, 47, 48, 49, 50, 63, 66, 67, 75, 120, 121, 122, 128, 129, 130, 131, 132, 145, 148, 149, 152};
int pupils_pixels_r[] = {64, 65, 76, 77, 146, 147, 153, 154};

//remove pixels around feet
int void_pixels_1[] = {8, 29, 30, 31, 83, 84, 85, 86, 138, 139, 140, 161};
int void_pixels_2[] = {7, 31, 55, 56, 57, 112, 113, 114, 138, 162};

int sad_ghost[] = {11, 26, 35, 48, 49, 53, 60, 64, 65, 80, 89, 104, 105, 109, 116, 120, 121, 134, 143, 158};

int eyes_seconds = 2;
int reg_ghost_seconds = 10;

int feet_delay = 120; //delay in ms b/w feet v1 v2
int eye_loop = (eyes_seconds*1000)/feet_delay; // how many times to look left and right before switching 
int reg_ghost_loop = reg_ghost_seconds/eyes_seconds; 
int sad_ghost_loop = 50;
int sad_ghost_blink_loop = 10;



void loop() {

    for(int i = 0; i < reg_ghost_loop; i++){

        for(int i = 0; i < eye_loop; i++){

            //fill body
            fill_solid(leds, NUM_LEDS, CRGB::Red);
        
            //set eyes 
            for (int i = 0; i < 24; i++){
                leds[eyes_pixels_l[i]] = CRGB::White;
            }
            
            //set pupil
            for (int i = 0; i < 8; i++){
                leds[pupils_pixels_l[i]] = CRGB::DarkBlue;
            }
            //remove around feet (v1)
            for (int i = 0; i < 12; i++){
                leds[void_pixels_1[i]] = CRGB::Black;
            }
            FastLED.show();
        
            delay(feet_delay);

            //fill body
            fill_solid(leds, NUM_LEDS, CRGB::Red);

            //set eyes
            for (int i = 0; i < 24; i++){
                leds[eyes_pixels_l[i]] = CRGB::White;
            }
            //set pupils
            for (int i = 0; i < 8; i++){
                leds[pupils_pixels_l[i]] = CRGB::DarkBlue;
            }
            //remove around feet (v2)
            for (int i = 0; i < 10; i++){
                leds[void_pixels_2[i]] = CRGB::Black;
            }
        
            FastLED.show();
        
            delay(feet_delay);

        }

        for(int i = 0; i < eye_loop; i++){
            
            //fill body
            fill_solid(leds, NUM_LEDS, CRGB::Red);
        
            //set eyes
            for (int i = 0; i < 24; i++){
                leds[eyes_pixels_r[i]] = CRGB::White;
            }
            //set pupils
            for (int i = 0; i < 8; i++){
                leds[pupils_pixels_r[i]] = CRGB::DarkBlue;
            }
            //remove around feet (v1)
            for (int i = 0; i < 12; i++){
                leds[void_pixels_1[i]] = CRGB::Black;
            }
            FastLED.show();
        
            delay(feet_delay);
    
            //fill body
            fill_solid(leds, NUM_LEDS, CRGB::Red);
        
            //set eyes
            for (int i = 0; i < 24; i++){
                leds[eyes_pixels_r[i]] = CRGB::White;
            }
            //set pupils 
            for (int i = 0; i < 8; i++){
                leds[pupils_pixels_r[i]] = CRGB::DarkBlue;
            }
            //remove around feet (v2)
            for (int i = 0; i < 10; i++){
                leds[void_pixels_2[i]] = CRGB::Black;
            }
            FastLED.show();
        
            delay(feet_delay);
        }
    }

    //sad ghost regular
    for(int i = 0; i < sad_ghost_loop; i++){

        //fill all red
        fill_solid(leds, NUM_LEDS, CRGB::Blue);

        //set eyes
        for (int i = 0; i < 20; i++){
            leds[sad_ghost[i]] = CRGB::Yellow;
        }

        //remove around feet (v1)
        for (int i = 0; i < 12; i++){
            leds[void_pixels_1[i]] = CRGB::Black;
        }
        
        FastLED.show();

        delay(feet_delay);
       
        //fill body
        fill_solid(leds, NUM_LEDS, CRGB::Blue);

        //set eyes 
        for (int i = 0; i < 20; i++){
            leds[sad_ghost[i]] = CRGB::Yellow;
        }
        //remove around feet (v2)
        for (int i = 0; i < 10; i++){
            leds[void_pixels_2[i]] = CRGB::Black;
        }
        
        FastLED.show();
        
        delay(feet_delay);

    }

    //sad ghost blinking
    for(int i = 0; i < sad_ghost_blink_loop; i++){
        //fill body
        fill_solid(leds, NUM_LEDS, CRGB::Yellow);

        //set eyes
        for (int i = 0; i < 20; i++){
            leds[sad_ghost[i]] = CRGB::Red;
        }

        //remove around feet (v1)
        for (int i = 0; i < 12; i++){
            leds[void_pixels_1[i]] = CRGB::Black;
        }
        
        FastLED.show();

        delay(feet_delay);

        //fill body
        fill_solid(leds, NUM_LEDS, CRGB::Blue);

        //set eyes
        for (int i = 0; i < 20; i++){
            leds[sad_ghost[i]] = CRGB::Yellow;
        }
        //remove around feet (v2)
        for (int i = 0; i < 10; i++){
            leds[void_pixels_2[i]] = CRGB::Black;
        }
        
        FastLED.show();
        
        delay(feet_delay);

    }

}

MsPacman

Arduino
//ANIMATED MS PACMAN LED
#include "FastLED.h"

#define NUM_LEDS 151

#define DATA_PIN 3

CRGB leds[NUM_LEDS];

void setup() {
  delay(2000);
  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
  FastLED.setBrightness(40); //Number 0-255
  FastLED.clear();
}

int void_pixels_opened[] = {6,7,22,23,24,25,26,27,28,29,30,43,44,45,46,47,48,49,50,
                            51,52,53,54,55,56,57,58,68,69,70,71,72,73,74,75,76,77,
                            78,79,80,81,82,83,84,85,86,98,99,100,101,102,103,104,
                            105,106,107,108,109,127,128,129,130,131,132};

int void_pixels_mid[] = {5,150,45,46,47,48,49,50,51,52,53,54,55,56,57,58,68,69,70,71,72,
                        73,74,75,76,77,78,79,80,81,82,83,84,85,100,101,102,103,104};

int void_pixels_closed[] = {5,150};

int red_opened[] = {92,93,115,116,117,118,119,121,137,138,140,141,142,143,144,145,5,8,133,150};
int red_mid[] = {92,93,115,116,117,118,119,121,137,138,140,141,142,143,144,145,27,26,105,106};
int red_closed[] = {92,93,115,116,117,118,119,121,137,138,140,141,142,143,144,145,50,76,77,78};

int blue_opened[] = {120,139,96};
int blue_mid[] = {120,139,97};
int blue_closed[] = {120,139};

int black_opened[] = {40,95,111,112,124};
int black_mid[] = {40,96,110,111};
int black_closed[] = {40,95,96,97,98};

int frame_rate_ms = 100;

void loop() {

//----MOUTH OPENED----//

//fill body
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
//remove mouth
for (int i = 0; i < 64; i++){
    leds[void_pixels_opened[i]] = CRGB::Black;
}
//set red
for (int i = 0; i < 20; i++){
    leds[red_opened[i]] = CRGB::Red;
}
//set blue
for (int i = 0; i < 3; i++){
    leds[blue_opened[i]] = CRGB::Blue;
}
//set black
for (int i = 0; i < 5; i++){
    leds[black_opened[i]] = CRGB::Purple;
}
FastLED.show();

delay(frame_rate_ms);

//----MOUTH MID----//

//fill body
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
//remove mouth
for (int i = 0; i < 39; i++){
    leds[void_pixels_mid[i]] = CRGB::Black;
}
//set red
for (int i = 0; i < 20; i++){
    leds[red_mid[i]] = CRGB::Red;
}
//set blue
for (int i = 0; i < 3; i++){
    leds[blue_mid[i]] = CRGB::Blue;
}
//set black
for (int i = 0; i < 4; i++){
    leds[black_mid[i]] = CRGB::Purple;
}
FastLED.show();

delay(frame_rate_ms);


//----MOUTH CLOSED----//

//fill body
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
    //mouth
for (int i = 0; i < 2; i++){
    leds[void_pixels_closed[i]] = CRGB::Black;
}
//set red
for (int i = 0; i < 20; i++){
    leds[red_closed[i]] = CRGB::Red;
}
//set blue
for (int i = 0; i < 2; i++){
    leds[blue_closed[i]] = CRGB::Blue;
}
//set black
for (int i = 0; i < 5; i++){
    leds[black_closed[i]] = CRGB::Purple;
}
FastLED.show();

delay(frame_rate_ms);

//----MOUTH MID----//

//fill body
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
//remove mouth
for (int i = 0; i < 39; i++){
    leds[void_pixels_mid[i]] = CRGB::Black;
}
//set red
for (int i = 0; i < 20; i++){
    leds[red_mid[i]] = CRGB::Red;
}
//set blue
for (int i = 0; i < 3; i++){
    leds[blue_mid[i]] = CRGB::Blue;
}
//set black
for (int i = 0; i < 4; i++){
    leds[black_mid[i]] = CRGB::Purple;
}
FastLED.show();

delay(frame_rate_ms);


}

Pacman

Arduino
//ANIMATED PACMAN LED

#include "FastLED.h"

#define NUM_LEDS 137

#define DATA_PIN 3

CRGB leds[NUM_LEDS];

void setup() {
  delay(2000);
  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
  FastLED.setBrightness(40); //Number 0-255
  FastLED.clear();
}

int void_pixels_opened[] = {19,20,21,22,23,24,25,26,27,28,29,42,43,44,45,46,47,48,49,50,51,52,53,54,55,
                            56,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,94,95,96,97,98,99,100,
                            101,102,103,104,105,121,122,123,124,125,126};

int void_pixels_mid[] = {46,47,48,49,50,51,52,53,54,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,98,99,100};


int frame_rate_ms = 100;

void loop() {

//----MOUTH OPENED----//

//fill body
fill_solid(leds, NUM_LEDS, CRGB::Yellow);

//remove mouth
for (int i = 0; i < 61; i++){
    leds[void_pixels_opened[i]] = CRGB::Black;
}

FastLED.show();

delay(frame_rate_ms);

//----MOUTH MID----//

//fill body
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
    
//remove mouth
for (int i = 0; i < 27; i++){
    leds[void_pixels_mid[i]] = CRGB::Black;
}

FastLED.show();

delay(frame_rate_ms);

//----MOUTH CLOSED----//

//fill body
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
    
FastLED.show();

delay(frame_rate_ms);

//----MOUTH MID----//

//fill body
fill_solid(leds, NUM_LEDS, CRGB::Yellow);
    
//remove mouth
for (int i = 0; i < 27; i++){
    leds[void_pixels_mid[i]] = CRGB::Black;
}

FastLED.show();

delay(frame_rate_ms);

}

Credits

Ben Muller

Ben Muller

0 projects • 36 followers

Comments