That success made me like this page a lot and also made me want to make guides like that one, well documented and properly explained, enabling people to make cool things, at first without them knowing how they work, and from there, from a working piece, start learning and understanding how it works.
note: the last 2 videos are not from my cube, but it works in the same way and gives the same result.
Step 1: Materials
- 1x Atmega328 (With arduino Optiboot bootloader)
- 3x TLC5940
- 4x P-Channel MOSFETs
- 3x 4K7 Resistors
- 3x 16 pin Male and Female headers
- 1x 4 pin Male and female header
- 1x 28pin IC socket
- 1x 1000uf 10v capacitor
- 1x 0.1 uf ceramic capacitor
- 2x 22pf capacitors
- 1x 16Mhz crystal oscillator
- 64x RGB common ANODE LEDs (it is very important that you check your LEDs are common ANODE, or else, the cube won't work!!)
- a LOT of Solder!
for more advanced functions;
- 3x 8k2 resistors for optional, low power mode.
- 3x 3pin male headers for jumper selection of the power mode
- 3x jumpers for selecting the power usage/brightness setting
- 2 x 64KB EEPROMs for storing custom animations
- 1x DIP switch for selecting different modes (random, serial, music responsive, random2, custom animations, etc.)
- 2x MSGEQ7 chips for audio analyzing and music response.
- Black paint
- An Arduino to use as a USB to Serial converter for programming
- An USBTinyISP if your Atmega chip is not pre-Bootloaded
- A Multimeter for troubleshooting and checking connections
- Some way of cutting PCBs, I used a Circular Saw, but you can use whatever you have in hand.
- Diagonal cutters
- A Sharpie or any kind of marker
- A Drill/Drillpress
- A Cutter or Xacto knife
Step 2: Planning
Step 3: Make a Grid
a piece of scrap wood bigger than the size of your cube
a Bit of the right size for your LEDs, its better to measure it with a caliper, but if you don't have one, just trust your maths and the LED Manufacturer's specifications.
my drill press has a table with 2 axis control, it has handles and moves 1mm per revolution, so I just counted 10 turns between each hole, make sure to make your holes at 0 on both Axis (x and Y). Also make sure to set the stopper for the Z axis or you will drill all the way thru your drill press.
I made my grid bigger, 5x5 in case I, in the future want to build another bigger (or smaller) LED cube.
Step 4: Layer by Layer
I figured out an easy process to build the layers quickly and all the same, just follow my steps;
- First off, mark your grid as mine (see pic 1) so you don't get confused about the orientation of the LEDs and as to which pin goes where.
- Now place your 16 LEDs (See pic 2), make sure they are in the correct orientation (flat part to the left).
- Start bending the leads (the Rightmost lead goes to the bottom left at about 45 degrees) (pic 3).
- Keep on with the bending, the 2nd lead from right to left goes to the top right corner at about 45 degrees aswell (pic 4).
- Now bend all the longer leads straight to the top, ONLY for the top row (You'll see why) (pic 5).
- Proceed to trimming all the remaining standing leads from the TOP ROW ONLY! (pic 7).
- Now bend them all to the left (pic 8) they should not touch the neighbor LEDs.
- Repeat steps 5 to 7 for the NEXT ROW, soldering each of the leads that reach the top LED's to the leads of those LEDs that go to the top as you go (pics 9 & 10).
- Repeat step 8 for the rest of the rows (pic 11).
- Trim down all the excess leads (pic 12).
- Now proceed to joining the columns, for this, grab a 10 cm long wire and make a small half-loop at the end (pic 13).
- pull it so the lead of the LED from the FIRST column id inside the half-loop and solder it down, use a gentle amount of solder (pic 14).
- solder the remaining columns to the wire and trim the excess off (pic 15).
- add another 3 wires in the same way (pic 16).
Make sure to test your layers as you go.
Step 5: Make a Mess
Step 6: Inserting the Rest of the Layers
then insert the next layer, making sure all wires fit into their correct "Sections".
To properly add the layers, we need a way to space them correclty, luckily, 9 vlot batteries are just the right size, so get ahold of 4 of them and place them like in pic 4.
Step 7: Repeat for the Rest of the Layers
Step 8: The Control Electronics
Step 9: Mark and Cut the PCBs
Then proceed to sanding all the edges (pic 6).
And finally paint them black with some matte spray paint (pic 7), remember to ONLY paint the top side black, not the copper!
Step 10: Add the Headers to the Top PCB.
First off we need to modify them a bit, pushing the black plastic piece that holds all the pins together right to the very end of the pins, make sure they don't fall off.
Once you've done that, find a proper place to put them in the top board, the exact place is not critical, but try to place them near the edges and make sure they won't obstruct any hole needed by the cube (see next step for more on this) and then push them all the way in and solder ALL the pins from the other side, the 4 pin header will be positioned right at the edge of the board, but don't do that just yet, as we are going to place it in any free space we find left (more on this later).
Step 11: Start Mounting the Cube.
To mount the cube we need to make 48 wires fit in their proper holes, to make this easier we are going to trim the leads of the cube as in pic 1 (in an angle) I used some heavy duty stainless steel scissors for this but you can use your typical wire snippers if you don't have access to stronger tools.
start inserting the leads of the cube to the top PCB, the longer leads first, once you have all the leads from the first row in, bend them a bit to prevent them from going back out, then proceed to the next row, I used a pair of modified doctor's thongs (hemostats) (the long, thin ones) to aid me in getting all the leads to the right place, once you finish a row, bend the leads a bit and proceed to the next one, DO NOT SOLDER ANYTHING YET!
Step 12: Finish Mounting the Cube
Once you have soldered the four corners, check again the height of the corners and, if it's all the same, proceed to soldering all the remaining leads (pic 2).
When you finish soldering all the leads, trim all the excess (pic 3).
Step 13: Connecting the Columns
Step 14: The Second PCB
Step 15: Begin Placing Components
After you have placed them, flip the board and solder all the outputs to the headers (pic 4).
Don't worry about the connections just now, we will first place everything and then connect what we can via Solder traces and connet what's left via small wires.
Step 16: Arduinize It.
Place it somewhere near the center of the board, use a socket for this one as it is possible that you may need to replace it.
In this step, we'll also add the 3 3-pin headers and 2 resistors for each, the 4k7 ones and the 8k2 ones, place those near the center of each TLC5940 leaving a 1 pin thick gap between the two (pic 1).
Step 17: Adding the Oscilator
Step 18: The MOSFETs
If you decided to add some EEPROMs to the cube, now is a good time to add those sockets too, find a small free space and place them there.
Step 19: The Programming Header
Also, add now the DIP switch, in the same side of the board on where you placed the programming header, in the picture it is tanding up, but I later changed it to a flat position because it is way too high.
Step 20: Connecting the ICs
From now on, downloading a high resolution version of the schematic will help you a lot, I would print it if I were you.
Step 21: Pull Up's
Step 22: Getting the Atmega328 Ready
Link: http://dl.dropbox.com/u/2295566/BLOG/arduino label/ARDUINO BREADBOARD 28 PIN LABELS.pdf
Step 23: Connect All the TLCs
See pic 2 for the wiring.
Step 24: Do What You Can
What you need to connect;
your EEPROMs (if you have any).
3 of the 4 pins on the dip switch.
the 2 1000uF caps from Vcc to Gnd
the 2 100nF caps from Vcc to Gnd
the 6 pin programing header, the leftmost pin goes to Arduino's Reset, 2nd pin to Arduino's RX, 3rd to Arduino's TX 4th to VCC and 6th to Gnd, the 5th pin is left unconnected.
Your MOSFETs, the Rightmost pin goes to VCC and the center pin goes to a pin on the 4 pin FEMALE header.
Gnd and VCC to all ICs, try to get at least Gnd done on the bottom side.
Step 25: Do What You Couldn't
Step 26: Troubleshooting.
Step 27: Connecting the Layers.
Step 28: The Code.
Congratulations! you have successfully built an RGB LED CUBE! all that's left it to configure the code so it works properly with your cube, so start by plugging the bottom PCB and the Cube PCB together.
The first thing you need to do is find out which pins are your layers connected to, once you've done that, you need to tell the code which pin goes to which layer.
Download the zip file below containing the 2 sketches you'll need and open the main sketch.
Go to the functions tab (pic 2) and then scroll down to the function called "Void CubeUpdate(int layerNoVal)", in there, scroll down untill you see something like this (pic3);
PORTC |= _BV(PC1); //layer 4
PORTC |= _BV(PC2); //layer 1
PORTD |= _BV(PD2); //layer 3
PORTD |= _BV(PD4); //layer 2
PORTC &= ~_BV(PC2); //layer 1
Change the lines to the Proper ports and port numbers for each layer, see pic1 for the corresponding ports and port numbers for each Arduino pin.
Once you change that, scroll down more and you will find it again, make it look exactly the same as the one you edited above, but instead of layer one pin at the bottom, add the layer 2 pin, repeat this 2 more times for layers 3 & 4.
Finally upload the sketch, your cube should look something like the one on the video, don't worry if it looks all random, we are going to solve this problem on the next step, as long as all the LEDs light up, you are fine.
Step 29: Mapping the LEDs
Upload the Mapping sketch and note down the order in which the LEDs turn on, i would recommend you to make a 4 by 4 table to note down the number in the series in which each LED is lit up, keep in mind that each LED has 3 colors and that you have to note them down aswel, I used different colored pencils for each color, now label all the columns from A to D and the rows aswel.
Now go to the main sketch and, in the Declarations tab, change each LEDs column to the prober number (see pic 2).
Step 30: Enjoy
NOTE: this is not how it should look like, I'll upload the correct video as soon as youtube lets me.
Step 31: (Optional) Make a Nice Base
Step 32: Future Updates.
- Finish an applet to make it easy for you to make your own animations.
- Make a set of custom animations in case you don't wanna bother on creating your own.
- add a Serial mode to be able to control it from a custom app on a computer
- Make it sound responsive with an MSGEQ7 (the chip didn't arrive on time, I will do it as soon as I get it).
This cube is amazing by itself, but, with the proper code, the possibilities are endless so I encourage you to try and Make your own code, to customize it and make it do whatever you want, this cube makes for a great development platform to learn more advanced coding skills.