Introduction: 3x3x3 LED Cube
I'm sure that many of you have seen many larger LED cubes, but connecting the 512 LED's present in an 8x8x8 LED cube can be rather daunting, so we're going to take a step back and check out how we would put together (and operate) a 3x3x3 LED cube.
Step 2: What We Need
Luckily, there isn't a gigantic variety of materials that we need to make the cube.
For this project I ended up using:
- LEDs (I used one set of 27 for testing, and a prettier set of 27 for the actual cube)
- Three SN74HC595N shift registers (although other components such as LED drivers will also work)
- A lot of breadboard jumper wires
- A large breadboard
- Digilent's chipKIT Uno32
- solder and a soldering iron
Step 3: Prototyping the Prototype: Part 1
Before we start testing out some code to see if we can light up our LED's, we first have to figure out how we would wire our cube together in the first place. After all, our code could easily be rendered useless if it isn't designed for the system that we will ultimately end up using.
As you know, single color LED's only have two leads: the anode that we will provide power to and the cathode which we will connect to ground. Because there are only two leads (as opposed to three), this prevents us from designing a cube where we can light up specific LED's based on an x, y, and z coordinate while still maintaining the inherent structural integrity of the cube. This is because we would be forced to have one of the leads be connected in two different coordinate directions at the same time, making it so the entire cube would be powered from any spot (if it they were anodes) or the entire cube connected to ground (if they were cathodes).
Admittedly, we could design a cube where all the LED's are independent of each other and connect them in a cube shape using some sort of non-conductive material, but let's be honest: that would be a pain to do all of those extra connections and waaaaay more wires than we would like to deal with.
Step 4: Prototyping the Prototype: Part 2
So, this leaves us with the option of creating a two dimensional sheet of LED's. What we will be doing, in essense, is creating a fence of LED's which will snake back and forth into a cube shape. All nine of the fence posts (for the 3x3x3 cube) will be the anodes and the three horizontal fence bars will be the cathode layers. Check out the above picture for a visual look of what the cube would look like.
As a clarifying point, the anode posts and the cathode layers are not connected; they just are the same color and visually look like they are touching when, in fact, they are not touching.
Step 5: Prototyping the Prototype: Part 3
Great, now we know how we need to design our cube. But if you're like me, you may want to create a flat breadboard version of the cube before soldering all of the LED's into a cube shape. If we take a look at the datasheet for the shift register that we have, we can see that our Vcc is on pin 16 and ground is on pin 1 so we can straddle our three shift registers across a valley and make our power connections like you see in the first picture.
Then, we can also see from our data sheet that in order to be able to output any data from the shift registers, we need to set OE to ground, so we can do that as well in the second picture.
Finally, we can connect the serial inputs, the serial clock that moves our data in the shift register, the register clock which updates the outputs with the inputted data, and serial clear to different digital pins available on our Uno32 as you see in the third picture.
Step 6: Prototyping the Prototype: Part 4
Now we can setup the LEDs in a fashion that simulates how the actual 3x3x3 cube would operate. What we can do is make three clumps of nine LEDs where all of the cathodes in a single clump are connected on a bus strip to simulate each of the layers of the LED cube. We can then use jumper wires to connect the anodes in each post together.
In the pictures, the three yellow wires control the cathode layers and the nine orange wires control each of the anode posts. Remember that because each shift register only has 8 outputs, we need two shift registers to be able to control all nine of the anode posts.
Step 7: Running the Cube
Now we are finally at the exciting bit of actually running our LED cube. If you are not familiar how shift registers work, you can learn from my Operating a Shift Register Instructable here. The code to light up one specific LED is provided below. If you don't have it already, to be able to run the code you will need the free MPIDE software from chipKIT.
Step 8: Creating the Real 3x3x3 LED Cube
Although we have now completed our proof of concept, our prototype is simply not the same thing as an actual LED cube. In terms of how to solder the LEDs together in the cube shape, I recommend pre-bending all of your LEDs that you have in a style similar to the picture shown with the anode pointing down and the cathode pointing out.
I would find some sort of way to get the first snaking layer of LEDs soldered together by their cathodes. You will notice that the 9th LED's cathode will then be sticking out to the side; feel free to solder this to a cathode of one of the other LEDs in that layer to help provide some structural integrity.
I would then take the next set of nine LEDs and solder their anodes to the anode of the LED beneath them and solder the cathodes of that layer together as well and then do the same thing for the third set of LEDs. After you are finished, you should get something similar to what you see in the second picture, taking into consideration that I am not the greatest solder'er in the world.
Step 9: 3x3x3 Cube in Action
And now we are finally at the moment we've been waiting for: the fully assembled 3x3x3 LED Cube. The code that runs the cube as seen in the youtube demonstration video is provided below. Check it out!
Feel free to comment or ask me any questions you might have.
Step 10: But Wait!
Why stop here at the 3x3x3 LED cube? Come back later for the larger 8x8x8 LED Cube with constant current drivers!