LED Cube 4x4x4 using Microcontroller Atmega16
Amazing 3 dimensional LED display.
64 LEDs makes up this 4 by 4 by 4 cube, controlled by an Atmel Atmega16 microcontroller.
Each LED can be addressed individually in software, enabling it to display amazing 3d animations!
8x8x8 LED cube now available, by popular demand:
First of all, you need quite a bit of time to solder together 64 leds 😉
- Basic electronics and soldering skills
- Know how to program an AVR microcontroller – I will not cover that in this instructable.
- Protoboard. The type with copper circles.
- Atmel AVR Atmega16 microcontroller
- Programmer to program the Atmega16
- 64 Leds
- 2 status leds. I used red and green. (optional)
- Max232 rs-232 chip, or equivalent.
- 16 resistors for leds. (100-400ohms) will get back to this.
- 2x resistor 470 ohm. for status leds
- 1x resistor 10k
- 4x resistor 2.2k
- 4x NPN transistor BC338 (or other transistor capable of switching 250-ish mA)
- 1x 10uF capacitor
- 1x 1000uF capacitor
- 6x 0.1uF ceramic capacitor
- 2x 22pF ceramic capacitor
- 1x crystal 14.7456 MHz
- 2x tactile button
- optional pwr switch
- connector for 12v power
- optional connector for 5v power
How to control 64 LEDs without using 64 individual wires? Multiplexing!
Running a wire to the anode of each led would obviously be impractical, and would look really bad.
One way to get around this, is to split the cube into 4 layers of 16×16 LEDs.
All the LEDs aligned in a vertical column share a common anode (+).
All the LEDs on a horizontal layer share a common cathode (-).
Now if i want to light up the LED in the upper left corner in the back (0,0,3), I just supply GND (-) to the upper layer, and VCC (+) to the column in the left corner.
If i only want to light up one led at a time, or only light up more than one layer at the same time.. this works fine.
However, if I also want to light up the bottom right corner in the front (3,3,0), I run into problems. When I supply GND to the lower layer and VCC to the front left column, I also light up the upper right led in the front (3,3,3), and the lower left LED in the back (0,0,0). This ghosting effect is impossible to workaround without adding 64 individual wires.
The way to work around it is to only light up one layer at a time, but do it so fast that the eye doesn’t recognize that only one layer is lit at any time. This relies on a phenomenon called Persistence of vision.
Each layer is a 4×4 (16) image.
If we flash 4 16 led images one at a time, really fast, we get a 4x4x4 3d image!
Making the cube, template
Soldering grids of 4×4 LEDs freehand would look terrible!
To get 4 perfect 4×4 grids of LEDs, we use a template to hold the them in place.
I wanted to make the cube as easy as possible to make, so I chose to use the LEDs own legs as much as possible. The distance between the lines in the grid was decided by the length of the LED legs. I found that 25mm (about an inch) was the optimal distance between each led (between the center of each led that is!) to enable soldering without adding or cutting wire.
- Find a piece of wood large enough to make a 4×4 grid of 2,5cm on.
- Draw up a 4×4 grid of lines.
- Make dents in all the intersects with a center punch.
- Find a drill bit that makes holes small enough so that the led will stay firmly in place, and big enough so that the led can easily be pulled out (without bending the wires..).
- Drill the 16 holes.
- Your ledcube template is done.
Making the cube, solder the layers
We make the cube in 4 layers of 4×4 leds, then solder them together.
Create a layer:
- Put in the LEDs along the back and along one side, and solder them together
- Insert another row of LEDs and solder them together. Do one row at a time to leave place for the soldering iron!
- Repeat the above step 2 more times.
- add cross bracing in the front where the led rows are not connected.
- Repeat 4 times.
Making the cube, connecting the layers
Now that we have those 4 layers, all we have to do is to solder them together.
Put one layer back in the template. This will be the top layer, so choose the prettiest one
Put another layer on top, and align one of the corners exactly 25mm (or whatever distance you used in your grid) above the first layer. This is the distance between the cathode wires.
Hold the corner in place with a helping hand and solder the corner anode of the first layer to the corner anode of the second layer. Do this for all the corners.
Check if the layers are perfectly aligned in all dimensions. If not bend a little to adjust. Or re-solder of it’s the height distance that’s off. When they are perfectly aligned, solder the remaining 12 anodes together.
Repeat 3 times.
For more Detail: LED Cube 4x4x4 using Microcontroller Atmega16