Led-Cube 4X4X4 blue
"How is it possible that after 3 years studying electronic's you haven't done this!!": was the shocked comment I got from a visitor at school. His comment referred to the well known Led Cube project every person who does something with electronics (apparently) should have done at some point.
At that time I had done several project that definitely could rival this one, but an easy project is a perfect opportunity to test your skill and keep you motivated.
Construction
First I started with the actual cube construction. Since it was just a little project on the side I chose for a 4x4x4 size cube with only blue colored led's.I found in previous projects that making a custom 'tool' for repetitive work is essential to keep things consistent. So to make the rows, and later the level's, I measured a patron on a piece of cardboard, this for ease of soldering and to keep the connections straight.
The cube has been constructed as followed:
- Each led's anode (positive side) is connected with the led's above it.
- The led's cathodes (ground side) are all combined for each level.
Design
Now that the cube itself was assembled I started to think about the actual controller circuit. In just one afternoon of searching the web I found several dozens of different ways to go about this. Everything from giant power controllers, I/O expander's and even one where only a couple of 555 timer chips had been used.From this I could conclude it's something that wouldn't be to difficult, so I decided to simply find my one way to solve the problem.
Considering the chip's and peripheral's (resistors, capacitors, ets.) I had lying around the following construction came to be:
So a quick run through the schematic:
- For the brain's of the design I went with a PIC16f690. There is no significant reason for this other than the number of I/O's and the amount of current it can sink. It's easy to get a fast simple prototype for me since I already had lots of code on hand for this particular chip. Plus only requires a PICKIT to program without losing some of the I/O pin's.
- The PIC can't source enough current (it's max 1 level of the cube at a time = 16 led's x 20 mA = 320 mA, not many controllers can send this directly) so there had to be a power amplification. Using BC557B transistors will convert the low signal current to a real power current to the led's.
- To relieve a bit of computing stress for the PIC, and to save I/O, I placed 74HC4094 shift registers between the PIC and the transistors. Now the PIC simply sends the data serially to the shift registers who then send it parallel to the cube via the transistors.
- The ground for the levels is directly sinked via I/O pins from the PIC.
- Further more I put a couple of push buttons on it. This to change the running animation and simplify the debuging of the software. The moto my teacher always held on to: "Any software can be debugged with 1 button and 1 led, it might take while but it works".
Animation
With this construct in mind I made a quick test circuit for half of the cube. This showed no immediate problems but hinted at the difficulty of the animations.
In the PIC each cube image is stored as 8 bytes of data with each bit corresponding to a led in the cube. It's not so easy to figure out which bit you need to set for which led, I would need some kind of translation tool between the designing of the animation and the eventual memory data.
For simplicity, and exercise at the time, I design the translation program in Labview:
It's a simple program, but one that has a couple of great features:
- The tools at the top give me a simple via of each cube level. The combination of those levels is then shown in the 3D graph to make it easier to see if the image is any good.
- Then you can stock the image, this is to combine the images into an actual animation.
- This animation can be run through on the graph.
- Or it can be converted to an actual .c file that can be imported directly into the PIC project.
So now the circuit board could be build and programmed with the animations from the translation program. The unpractical part is that for new animations the PICKIT needs to be used. If I ever do an update of this construction I will add some form of communication and local memory.
I, with the help of a good friend, build a plexi-glass casing for the cube, This serves as both protection and as led diffusion, creating a beautiful mirroring effect.
So here stands the result:
A picture can only say so much, to conclude the project, a little movie is in order: