LED cubes are a dime a dozen these days, and ours probably won’t be anything to write home about. That said; if you’re interested in a total newbie’s point of view, then here’s the place to find it.
This project is not limited to the sizes mentioned, and is only limited by the computing power there is to drive it. For the sake of simplicity, we built a 3^3 cube. A 3^3 cube is a compromise between a 2^3 (which is 8 LEDs) and 4^3 cubes (64 LEDs) while having the upside of still being suitable to mount on a breadboard.
As you may have inferred from the title, you are going to need a fist full of transistors; but LEDs, being the go anywhere, be anything kind of components they are,won’t need much in the way of current or voltage, which means that any general use transistors will do the trick.
How many are you going to need? Again, it depends on your build, but with a small caveat: as your cube size increases you won’t need an exponential amount of transistors. A transistor is still required for every base LED (or column, to be precise) but only a single transistor for every row. Thus a helpful equation, if you want to know how many transistors you are going to need (for our setup, which is extremely basic) all you do is square your base then add the rows (x^2 + x). Pretty simple stuff. In terms of this cube, that still means 12 transistors; but if you were to build a 4^3 cube that would be 16. You get the point.
The layout seems far more complicated on paper than it is in real life. For one I had the grand misconception that this schematic is a top down view instead of a side view (obvious now, not so much then).
This is really the heart of the project, and the real reason for building the LED cube in the first place. The code needed to control the cube is a great way to get to know how the Arduino handles commands which are too fast to see. Coming in at a max clock speed of 1.6 kHz, the Arduino makes multiplexing LEDs a breeze.(Not that other microcontrollers are going to be any different.)
LEDs are magnificent little components, and this project takes advantage of aspects of their design. LEDs will only turn on if you have a potential difference in a specific direction across a set LED. That means controlling both the anode (+) and cathode (-) is possible via the transistors. Thus a row and column of LEDs will share a common cathode or anode with a row or column.With that in mind, you can now activate a specific LED. But that offers a problem with multiple activation (A problem to be solved in due time).
It’s simple enough to understand and incredibly simple to build, the only thing that can trip you up is connecting a LED in the wrong direction. The easiest way to get past this is to bend the legs of whichever side you are going to use. Polarity only comes into play in two areas: A) how you link up the LED arrays and B) how neutral power is going to be supplied to the cube (3V that are not directly controlled by the Arduino).
Building a cube is not hard. Building a straight cube, on the other hand… That’s a different story. For that, you are going to need a way to keep the LEDs an equal distance from each other. Anything will do really, as long as you know that each increment will be the same as before (keeping in mind that that also means keeping things as square as you can). Making a layer that is 90 degrees in all three planes is going to be near impossible if you are only going to be able to measure one at a time, so optimize! What you need is a surface without “give”. That means wood is “good”; a pair of old undies is “bad”. After your material has been found, draw a grid with as many intersecting points as LEDs in a given layer/row.
The grid’s size is arguably arbitrary, but the maximum length is determined by the shortest pin. If you don’t have enough space to bend and solder the cathode, your spacing is too wide (ours is 20mm, which was already pushing the length limit a bit too far). If you’re planning to put in a little extra effort tomake the spacing board out of wood, (And why not? You’ve already come this far) you can drill a couple of extra holes for if you ever want to build a larger version. Or you might find a use for a perforated piece of wood, who knows. Otherwise, if this is a one-off project then Styrofoam will work just fine,but don’t expect it to last very long.
With that done, it’s on to the dumb work (not too dumb though, you’re going to have to keep track of the cathodes and anodes). Bend the cathode on each of the LED’s in the same direction (you can use the anode per layer but the shorter pins on the cathode makes it the better choice). Once that is done, the LEDs can be inserted into the spacing board.
I found that two things helped greatly:the first was that bending the LEDs that are on corners horizontal to the anode gave a better solder angle; and the second was that bending the ends of the pins at a 15 degree angle and slipping the pin underneath the next LEDs bend point made soldering a good deal easier; no clips, no mess, and a easy way to snip off excess. Because they are all bent in the same direction if the first pin is a corner, then the last LED will be the one intersecting with said corner; in which case slipping in underneath will be a simple case of placing the LED on the board at a odd angle then rotating it into position. (*A small side note: although it’s not going to change the look of your cube in any way, consider planning the cube so that all the anodes are on the inside. It won’t be blatantly obvious if it isn’t, but there is one person who will know.*)For the inner LEDs the same method applies, but for extra stability you may want to solder a wire pin over the last gap.
That’s the first layer done. Rinse and repeat. One more thing:it’s really up to you when this is done but its best to test every LED before you finish off the build.It’s simple enough just use the logic that you will need to make the code negative lead to the cathode and positive lead to the anode if the LED lights up you are good to go. If not, you can just put it back in the board, de-solder, swap pins, or replace. This is easier done when there is only one layer to deal with.
Once all the layers are done the hard part starts (for me at least). The tricky part is that you want to connect the layers with each other, while maintaining equal space all around. Now the best approach is to have a scrap length of wood available which is cut to the size of the pin lengths of the layers(at least end to end). Do not just eyeball it, that’s a terrible idea that I somehow thought would work. The end product is less than desirable, but will work nonetheless. The key to this project is working as neat and square as you can.
So, measuring device in hand, you should now be able to get equal space all round. There should also be a decent amount of overhang on the anode (even If you are accounting for the LED head); bend them back to fit underneath the next layer down and solder. If the pins are sticklers for not staying put,then you can use a crocodile clip to keep the leg against the LED while you solder. After the soldering is done, the pins aren’t going anywhere, so don’t feel like you have to bend the legs to stay put. The middle pins are always a challenge. Just be sure to be aware of open appendages nearby (it’s hard to explain how you managed to burn your nose with a solder iron). Other than that, there is really no other way but to power through.
Now you can stop here, or you could add a touch of awesome, a printed circuit base. We only have the 3 by 3version (available for download here), but the PCB is extremely easy to make and will add a good deal of durability to the cube.