25x8 LED Hat, for Parties and Other Useful Things
33166 Views, 234 Favorites, 0 Comments
25x8 LED Hat, for Parties and Other Useful Things
Before I built this hat I built a smaller 5x8 hat with some LEDs left over from an LED cube. The goal of this hat was to greatly increase the pixel density and be able to display things like words or simple pictures. So one crazy day my friend and I ordered the parts and set out to make two of these hats.
For the experienced solderer the construction of the hat shouldn't take more than a weekend; as for my friend, the novice, it will take about a week if they put in a good amount of time daily.
For the experienced solderer the construction of the hat shouldn't take more than a weekend; as for my friend, the novice, it will take about a week if they put in a good amount of time daily.
Design and Parts
Design:
The hat contains 200 LEDs total, 4 shift registers, 4 buttons, 4 AAA batteries, and one Arduino mini pro.
Along with lots of wire. Making the wire longer than it needs to be is a MUST, if the wire is short and you will have to go back to fix something it make resoldering almost impossible. So make every wire long enough to extend outside of the hat, at least to the rim to make soldering possible after installing all the parts.
The height is 8 because one shift register, connected to PNP transistors, will control the 8 cathode layers of the hat. Another great number is 10 because decade counters will output 10 rows for you. For best density of LEDs 16 tall, or two shift registers, would be fantastic but require a lot more effort and resources.
When choosing the number of LEDs across it is a lot easier to make things a multiple of 8 so that they can all be handled in the same way. There is one row on my hat that must be turned on and off by the Arduino directly and it is a bother to deal with.
I assume a basic background in soldering before attempting this build. If you have never soldered before this project will be hard and painfully long.
Parts:
+Mircocontroller: Arduino Pro Mini, anything could be used but I have grown to like the Pro Mini because of it's size and ease of use. Plus you can find it for cheap on ebay.
+Programmer: You'll need and FTDI cable or breakout board or similar USB programmer to program the Aruino Pro. If you choose An Arduino Uno then you will not need a programmer. If you have an Arduino it can be used as a programmer if need be but buying an FTDI cable will be much easier and faster.
+LEDs: Ebay... Search and find your choice of color and size. I used 3mm blue that are not diffused. I would recommend buying the diffused because they do a much better job not blinding you when looking directly at the hat. Though I am cheep and not diffused still look good.
+Power: I bought a 4 battery AAA holder from radio shack. I love that a switch is built in and its only $3. A 9V would work but wont last as long and need to be attached to a regulator to be used. AA provide more amp hours so if that's what you want and you don't mind the weight then pick them. You really only need 3V to run the hat so as little as 2 AA or AAA would work just fine.
+Shift Registers: I had a large batch of custom 74HC595 breakout boards made from SeeedStudio and they work great for SMD components. There is no need to do that as long as your are handy with a soldering iron DIP and some proto board would work great.
+Transistors: PN2222 are great for LED projects, buy a batch off ebay and have fun.
+Resistors: I used 402 ohm resistors because they were cheap on Newark. Anything between 200ohm and 500ohm will work. The higher the Ohms the longer the battery will last. Also you'll need some 10K ohm resisters for the buttons.
+Capacitor: Its always good to thrown in a capacitor, especially near your microconroller and important integrated circuits. I used 10pF, you can get a mixed pack at radio shack and use any of those. Capacitors help smooth out the quick variations in current that mircrocontrollers but on the system.
+Buttons: Buy them, salvage some, it doesn't matter where you get them standard dip push buttons are all you need.
+Wire: A clean and simple project is a happy one. Ribbon cable will look much nicer and be less cluttered than using individual wire.
The hat contains 200 LEDs total, 4 shift registers, 4 buttons, 4 AAA batteries, and one Arduino mini pro.
Along with lots of wire. Making the wire longer than it needs to be is a MUST, if the wire is short and you will have to go back to fix something it make resoldering almost impossible. So make every wire long enough to extend outside of the hat, at least to the rim to make soldering possible after installing all the parts.
The height is 8 because one shift register, connected to PNP transistors, will control the 8 cathode layers of the hat. Another great number is 10 because decade counters will output 10 rows for you. For best density of LEDs 16 tall, or two shift registers, would be fantastic but require a lot more effort and resources.
When choosing the number of LEDs across it is a lot easier to make things a multiple of 8 so that they can all be handled in the same way. There is one row on my hat that must be turned on and off by the Arduino directly and it is a bother to deal with.
I assume a basic background in soldering before attempting this build. If you have never soldered before this project will be hard and painfully long.
Parts:
+Mircocontroller: Arduino Pro Mini, anything could be used but I have grown to like the Pro Mini because of it's size and ease of use. Plus you can find it for cheap on ebay.
+Programmer: You'll need and FTDI cable or breakout board or similar USB programmer to program the Aruino Pro. If you choose An Arduino Uno then you will not need a programmer. If you have an Arduino it can be used as a programmer if need be but buying an FTDI cable will be much easier and faster.
+LEDs: Ebay... Search and find your choice of color and size. I used 3mm blue that are not diffused. I would recommend buying the diffused because they do a much better job not blinding you when looking directly at the hat. Though I am cheep and not diffused still look good.
+Power: I bought a 4 battery AAA holder from radio shack. I love that a switch is built in and its only $3. A 9V would work but wont last as long and need to be attached to a regulator to be used. AA provide more amp hours so if that's what you want and you don't mind the weight then pick them. You really only need 3V to run the hat so as little as 2 AA or AAA would work just fine.
+Shift Registers: I had a large batch of custom 74HC595 breakout boards made from SeeedStudio and they work great for SMD components. There is no need to do that as long as your are handy with a soldering iron DIP and some proto board would work great.
+Transistors: PN2222 are great for LED projects, buy a batch off ebay and have fun.
+Resistors: I used 402 ohm resistors because they were cheap on Newark. Anything between 200ohm and 500ohm will work. The higher the Ohms the longer the battery will last. Also you'll need some 10K ohm resisters for the buttons.
+Capacitor: Its always good to thrown in a capacitor, especially near your microconroller and important integrated circuits. I used 10pF, you can get a mixed pack at radio shack and use any of those. Capacitors help smooth out the quick variations in current that mircrocontrollers but on the system.
+Buttons: Buy them, salvage some, it doesn't matter where you get them standard dip push buttons are all you need.
+Wire: A clean and simple project is a happy one. Ribbon cable will look much nicer and be less cluttered than using individual wire.
Construction, of the Hat
Its long, its hard, and should be done right the first time.
Start by marking the holes that will be put in the hat. Use some type of grid and ruler to evenly space out the dots.
Use a thumb tack to poke two hole in that are the same distance apart as the base of the LED's pins.
Once those 400 holes are poked then you can move onto the soldering. Start at the bottom, closest to the top of the hat(working with the hat upside down up is closest to you and down is further away), and bend the cathode left and the anode up. Hold the LED while you do this for a sold bend. Once it's good, poke the next LED above that one and again bend the cathode left and anode up. MAKE SURE you are putting the LEDs in the correct way each time. The long and the short side should always be put in the same way. Now you can make your first solder; cut the pin if it is too long before soldering the bottom LED to the top so as not to overlap them.
Now repeat this until your at the top of the hat.... One Column done!
Next column will be to the right of that one so when you bend the cathode of the new LED it is on the cathode of the previous column. Depending where you are on the circle make a bend on the cathode pin so it doesn't touch the anode. Now you can solder the cathode to the cathode before it. Move up from here and solder the anode then cathode of each LED...........
Turn on the TV rinse rather and repeat... Until your all done!
Start by marking the holes that will be put in the hat. Use some type of grid and ruler to evenly space out the dots.
Use a thumb tack to poke two hole in that are the same distance apart as the base of the LED's pins.
Once those 400 holes are poked then you can move onto the soldering. Start at the bottom, closest to the top of the hat(working with the hat upside down up is closest to you and down is further away), and bend the cathode left and the anode up. Hold the LED while you do this for a sold bend. Once it's good, poke the next LED above that one and again bend the cathode left and anode up. MAKE SURE you are putting the LEDs in the correct way each time. The long and the short side should always be put in the same way. Now you can make your first solder; cut the pin if it is too long before soldering the bottom LED to the top so as not to overlap them.
Now repeat this until your at the top of the hat.... One Column done!
Next column will be to the right of that one so when you bend the cathode of the new LED it is on the cathode of the previous column. Depending where you are on the circle make a bend on the cathode pin so it doesn't touch the anode. Now you can solder the cathode to the cathode before it. Move up from here and solder the anode then cathode of each LED...........
Turn on the TV rinse rather and repeat... Until your all done!
The Electronics
The Atmega328 has convenient SPI pins that allow for very fast communication with the shift registers.
Here are those pins:
Arduino pin 13 ----> Clock Pin
Arduino pin 11 ----> Serial Data Pin
Arduino pin 10 ----> Latch Pin (RCLK)
For inputs the buttons are located on A0-A3.
And an extra LED pin is located on Arduino pin 8, because 25 is not a multiple of 8.
As for the shift registers the outputs are connected to resistors which then connect to the LED columns.
One shift register is connected to PNP transistors through resistors and then connected to the LED rows.
Unfortunately I lost the files for the board that I used for the surface mount shift registers, but it is simple enough to extract form the data sheet.
The shift registers are daisy chained so that the Qh' output of one is the Data input of the next. The last one has the PNP transistors.
Here are those pins:
Arduino pin 13 ----> Clock Pin
Arduino pin 11 ----> Serial Data Pin
Arduino pin 10 ----> Latch Pin (RCLK)
For inputs the buttons are located on A0-A3.
And an extra LED pin is located on Arduino pin 8, because 25 is not a multiple of 8.
As for the shift registers the outputs are connected to resistors which then connect to the LED columns.
One shift register is connected to PNP transistors through resistors and then connected to the LED rows.
Unfortunately I lost the files for the board that I used for the surface mount shift registers, but it is simple enough to extract form the data sheet.
The shift registers are daisy chained so that the Qh' output of one is the Data input of the next. The last one has the PNP transistors.
Debugging
Its important to check all of the electronics before trying to program them. Hook up a resistor to 5V and connect one layer to ground at a time. Then see if everything lights up the way it should. Testing the wiring of the shift registers is also important. Test turning things on and off from the register and transistors instead of just testing the pins.
Once that's all done try turning the hat on and off with the program. I'll explain it more in the next step.
Once that's all done try turning the hat on and off with the program. I'll explain it more in the next step.
Programing
Before we start, in this project i did not use the standard Arduino IDE. Instead, I used MariaMole. I like MariaMole because it handles work spaces and easily allows for additional files to be added to the program, like header files. The code is in C++ with two header files and the SPI library, it is completely possible to use in Arduino but i recommend trying MariaMole.
The Code:
The entire code is separated out into individual functions that handle different animations. There are things ranging from PacMan and Space Invaders to continuously scrolling through "HaHa". Then those animations are controlled through functions in the main C++ file based off the user button presses. This is the basic idea of how the code works, keep reading for a deeper inside starting at SPI level.
So to output to the shift registers I used the built in function of the Atmeg328 chip to communicate over serial lines.
SPI.transfer(byte); will shift out the byte the same way shiftOut(byte) would but SPI does it much much faster.
The data is read from a long set of hexadecimal data. If you don't know basic bit-wise operations than it wont make much sense, but in essence dataToDisplay() is reading the the bytes and putting them into something that can be shifted out to the registers.
long hexadecimal numbers are inputted into the first column of the display and then are shifted LED clockwise by shiftClockwise(). This can be done either slowly, if you want to output works and scroll then across the hat, or very fast to display an whole image at a time.
The data can be created by hand by drawing out a picture of the animation in pixels and then converting that into binary and then converting that into hexadecimal. You can see my example along with a blank page for print out if you want to make your own, i would love to see what cool animations can be done. It is hard to make things look nice on this low of resolution.
These data strings are held in the animation.h file in unsigned long variables. Some phrases are too big for this so they get a bigger matrix with multidimensional properties. And the functions are also different to account for this.
The Code:
The entire code is separated out into individual functions that handle different animations. There are things ranging from PacMan and Space Invaders to continuously scrolling through "HaHa". Then those animations are controlled through functions in the main C++ file based off the user button presses. This is the basic idea of how the code works, keep reading for a deeper inside starting at SPI level.
So to output to the shift registers I used the built in function of the Atmeg328 chip to communicate over serial lines.
SPI.transfer(byte); will shift out the byte the same way shiftOut(byte) would but SPI does it much much faster.
The data is read from a long set of hexadecimal data. If you don't know basic bit-wise operations than it wont make much sense, but in essence dataToDisplay() is reading the the bytes and putting them into something that can be shifted out to the registers.
long hexadecimal numbers are inputted into the first column of the display and then are shifted LED clockwise by shiftClockwise(). This can be done either slowly, if you want to output works and scroll then across the hat, or very fast to display an whole image at a time.
The data can be created by hand by drawing out a picture of the animation in pixels and then converting that into binary and then converting that into hexadecimal. You can see my example along with a blank page for print out if you want to make your own, i would love to see what cool animations can be done. It is hard to make things look nice on this low of resolution.
These data strings are held in the animation.h file in unsigned long variables. Some phrases are too big for this so they get a bigger matrix with multidimensional properties. And the functions are also different to account for this.
Downloads
The Videos
Now that you've patently looked through the the project and are wondering what can be done with it... Here you go!
This one is of all the math functions: sin wave, tangent wave, ect.
This one has the adorable fish swimming across the hat
This one has two. The first loops HaHa over and over. The next one is just "Stay Classy"
And for those school sporting events show off your pride with some blinding lights! (much nicer in my opinion than a fog horn in the ear)
Who doesn't want to signal to all those around them on Valentine's Day that they care?
This one is of all the math functions: sin wave, tangent wave, ect.
This one has the adorable fish swimming across the hat
This one has two. The first loops HaHa over and over. The next one is just "Stay Classy"
And for those school sporting events show off your pride with some blinding lights! (much nicer in my opinion than a fog horn in the ear)
Who doesn't want to signal to all those around them on Valentine's Day that they care?
Additional Notes
I love the hat, but it does have its limitations.
First the pixel density is really bad. Anything detailed will not look right at all. In addition because of the spacing of vertical and horizontal LEDs with the shape of the hat, most things look stretched out on the hat. For example, PacMan looks like an oval if made in a perfect circle. Adjustments have to be made for how the image is going to look.
There are Arduino libraries that allow for numbers as arbitrarily large as you want them, but i couldn't get them to work in MariaMole. That being said it would be simpler in the code to shift in a larger number than having a multidimensional array.
The buttons are hard to see in the dark... Really this is a bigger problem then I thought, I think I will add a red LED or something to make the buttons usable in a dark room.
Using hot glue on fabric is as tough as bond as the solder joints, well its a close call. Trying to take off something once its been hot glues down my hurt the hat so test before you glue.
I said it before, and I'll say it again, diffused LEDs look better but cost more. Be sure to think about what type you'll want to use.
On an LED note, some LEDs ordered off ebay will have very small leads making it hard to use in the hat. Look for longer leads and good reviews from ebay sellers.
That's all I can think of. Let me know what you think!
First the pixel density is really bad. Anything detailed will not look right at all. In addition because of the spacing of vertical and horizontal LEDs with the shape of the hat, most things look stretched out on the hat. For example, PacMan looks like an oval if made in a perfect circle. Adjustments have to be made for how the image is going to look.
There are Arduino libraries that allow for numbers as arbitrarily large as you want them, but i couldn't get them to work in MariaMole. That being said it would be simpler in the code to shift in a larger number than having a multidimensional array.
The buttons are hard to see in the dark... Really this is a bigger problem then I thought, I think I will add a red LED or something to make the buttons usable in a dark room.
Using hot glue on fabric is as tough as bond as the solder joints, well its a close call. Trying to take off something once its been hot glues down my hurt the hat so test before you glue.
I said it before, and I'll say it again, diffused LEDs look better but cost more. Be sure to think about what type you'll want to use.
On an LED note, some LEDs ordered off ebay will have very small leads making it hard to use in the hat. Look for longer leads and good reviews from ebay sellers.
That's all I can think of. Let me know what you think!