This year I wanted to do something interesting for Halloween using an Arduino and a bunch of LED lights. Initially, there wasn't really a theme behind it all, but then I came up with the idea of basing my costume on Disney's Electrical Parade. Ya, that's the ticket! So, I did a lot of research on the net and ordered a bunch of parts and managed to hack this project together a couple of hours at a time over the course of 3 weeks.
Step 1: Prepare 64 ping pong balls
Ping pong balls? Well, I've seen a number of people use ping pong balls as diffusers for LEDs. A little LED lighting up wouldn't have the visual impact of a glowing ping pong ball so this was the way to go.
I ordered a gross of cheap ping pong balls off the net. If I were to do it again, I'd probably order balls which were actually suitable for playing. These were definately "craft" quality balls at best. I'm guessing that better balls would have acted as better diffusers. These worked pretty well nevertheless.
First I found a screw with a nice sharp point. I then poked a little hole in the ball just to get the final hole started. Then I took a 3/16 drill bit and manually twisted it into the tiny hole to make it just large enough to put the tip of the LED into the ball while the base of the LED kept the whole LED from going into the ball.
Ok, just do this 64 times. (The grid of LEDs will be 8 by 8)
Step 2: Prepare the LEDs
A number of people have tried using ping pong balls as diffusers for LEDs and one issue is that the LED has a lens on the top that focuses the light into a bright spot above the lens. Some have suggested putting tissue in the ball or sanding the lens to diffuse the light more and more evenly light up the ball. Well, rather than gently sanding down the lens, I decided to just snip off the top portion of the LEDs while trying to avoid damaging the internals. Actually, it worked quite well.
Again, I needed 64 of these.
Step 3: Glue an LED into each ball
Since the lip at the base of the LED was larger than the hole in the ball, I just inserted the LED into the ball and then used a low temp glue gun to glue it into place. I was generous with the glue.
Step 4: Prepare the base for the LED matrix
In Illustrator, I made a template to mark out all of the holes that I'll need to drill to mount each ball. The balls I ordered were 38mm in diameter. Apparently, in 2000 it was decided that the "official" size of a ping pong ball would increase from 38mm to 40mm. It doesn't matter whick size you choose, as long as you know what you've got. In my template, I added an extra 2mm between each ball just to allow some room for error when mounting the balls.
I needed a firm base which would be large enough for the matrix so I went a local Target to see what I could find. I ended up getting a black plastic drain board. As you can see from the image, the size worked pretty well.
Since I only had 8.5" x 11" paper I prined 4 copies of the PDF template and taped them together and then taped them on the board. At first, I used a sharp nail to poke a small indentation in the board to guide my drilling, but that was kind of a bad plan. The plastic actually shattered a bit in a few spots. Oh well, nothing a little hot glue couldn't fix. Next time I'd probably just drill the holes through the template and skip the nail. For the holes in the board, I used a 5/32 bit which was wide enough for the leads of the LEDs to fit through without bending. I applied more hot glue to the base of each LED and then pushed it into place. For good measure, I squirted more hot glue into the holes on the underside of the board. I really didn't want any of the balls to pop off.
Step 5: Wire up the LEDs
The LED driver circuit that I went with was was a design from ModernDevice. In that design the LEDs all connect to a common 5 volt lead. After some consulting with my friend Steve (who knows WAY more than I do about electronics) we figured out that I could save myself a lot of soldering by grouping the positive leads of the LEDs. My wiring job was a mess, but you can sort of see that I soldered short jumper wires along the positive leads of each row of LEDs. To each negative lead, I soldered a wire about a foot long. At the end of each row, I soldered another foot long wire to the end of the group of positive leads. I used hot glue to prevent short circuits where the leads from the LEDs looked like they might touch. I also glued the leads to the board to minimize movement. Yes, I'm not very good at soldering. I also made the wires a foot long in anticipation of having to move things around in order to "fix" something later.
Step 6: Solder the LEDs to the driver board
To drive the LEDs I used a design by Paul Badger of ModernDevice. He gives some really good information about his design on his website, but since I had a difficult time finding the chips that he uses, I just ordered a kit that included the necessary components from his site. Many designs that I've seen use multiplexing to light up 64 LEDs. Basically, the circuit lights up half of the LEDs then quickly switches to light up the other half. This happens so quickly that you won't notice it flickering, but it does reduce the overall brightness. Paul's design doesn't need to switch between banks of lights. Each one can receive constant power. This results in brighter lights.
So, at this point, I soldered the leads from the LEDs into the underside of the circuit board where Paul intended the LEDs to be soldered in directly. After the wires were soldered into place, I snipped the excess wire that was sticking out of the silkscreened side of the board.
Step 7: Solder the LED driver components
At this point, I soldered the components included with the kit onto the silkscreened side of the board. Pretty easy even for me. The kit that I received included DIP sockets which really helped me.
Step 8: Make a jumper to connect to the arduino
The circuit from Modern Device is intended to be driven by something like an Arduino microcontroller. Even though the Arduino is ultimately controlling 64 LEDs, you only need 4 wires for data and 2 for power coming from the Arduino. I fashioned a makeshift cable together to connect the 2 units.
Step 9: Strap it all together
At this point, I used the cable I made to connect the 2 boards together and then used hot glue and zip ties to attach everything to the back of the drain board. For now, the board from Modern Device is receiving 5 volts of power from the Arduino, but I bought an external D cell battery pack just in case. I ended up not using the external battery pack.
Now, to really complete the display portion of the costume, I needed to write some code for the Arduino to accept commands via USB from the laptop and then drive the LED driver board accordingly. My plan was not to store any image patterns in the Arduino, but rather accept images from the laptop and then light up the LEDs based on that. The sample code that Paul provides on his site made for both a great way to test to make sure that everyting was wired properly and as a base for my own code. Lucky for me, when I ran his sample code on my setup, it worked the first time.
Step 10: Assemble the audio hardware
Since I wanted to have the music from Disney's Electrical Parade playing along with the blinking LEDs, I needed a little amplifier and some speakers. I picked up cheap amplified stereo speakers and proceeded to remove the speakers that it came with and added longer leads. I had some old car speakers lying around so I soldered those on. I plan to hang the speakers around my neck under near a black fleace jacket so I used zip ties to attach the speakers to an adjustable strap I found. The foam was hot glued on the back of the speakers for my comfort. These speakers sound WAY better than the tinny ones that came with the amp.
Step 11: Wireless keypad
The last piece of the costume (other than the laptop) was a wireless numeric keypad that I found at Frys. I needed a way to control the laptop without having to open it to access the keyboard. A wired keypad would have been okay, but I'm much happier with this find.
Step 12: Time to program the show
At this point, I've got the LED panel attached to the laptop via USB. The wireless keypad is also connected via USB and the audio is just connected to the headphone jack of the laptop. Now it's time to start writing some software to make it all do something interesting.
Java is my language of choice so I wrote a framework and a simulator for my light show. In order to play audio, I used the Java Media Framework and in order to access the serial port to talk to the Arduino, I used the RXTX library. I wanted to keep things simple, so I'm only writing data to the USB port and not trying to read any responses.
In order to sync the animations with the music, I just wrote a little code to start playing the song and then each time I pressed a key, it would mark a timestamp. Not the most precise method, but it worked well enough. I then used the timestamps to know when to switch to the next desired animation.
Once the code was written, I added some code to receive key events from the wireless keypad and the technical side of the costume was pretty much complete.
I ran a battery drain test and even using the laptop's USB port to power the Arduino and LEDs, it was able to run for just over 3 hours. I ended up moving all of the files to a RAM disk in hopes of being able to power down the hard drive and run the system longer. We'll see.
Here's a video of the rig in action:http://www.youtube.com/watch?v=k8Z7iU0p19c
Step 13: Make it wearable
After all of the programming was complete and I was pretty happy with the result, I used hot glue, zip ties and luggage straps to make the LED panel as well as the speakers "wearable". Also, the ping pong ball diffusers worked a little TOO well. They were lighting up their neighboring balls so I didn't think the images on the LED matrix looked very clear. I made tubes from 5 1/2 by 1 1/2 inch strips of black construction paper and put them around each ping pong ball.
Now that everything was complete, I put the speakers around my neck, then wore a black fleece jacket over them. I then put the LED panel around my neck and wore a black backpack to hold the laptop.
Here's the final result:http://www.youtube.com/watch?v=WllPKh8SKxs