LED Cube 4x4x4
LED Cube 4x4x4
LED Cube 4x4x4
Step 8: Wire up the cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Step 9: Compile and program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Step 10: Program the microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Step 11: Go large - 8x8x8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
http://www.instructables.com/id/LED-Cube-4x4x4/
Author:chr
I like microcontrollers and LEDs :D
http://www.instructables.com/id/LED-Cube-4x4x4/
Step 2: Multiplexing
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 16x16 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 4x4 (16) image. If we flash 4 16 led images one at a time, really fast, we get a 4x4x4 3d image!
http://www.instructables.com/id/LED-Cube-4x4x4/
Image Notes 1. All the LEDs on this layer share cathodes (-) 2. All the LEDs in this column share anodes (+)
Image Notes 1. This wire supplies GND (-) to layer 1 of the cube. 2. This wire supplies GND (-) to layer 0 of the cube. 3. All the leds in a layer have their cathodes connected together 4. All the cathodes connected together 5. All the leds alligned directly above each other have their anodes connected together 6. Each of the 16 vertical columns have a resistor to avoid frying the LEDS and the microcontroller 7. This wire supplies VCC to all the leds in this corner...
Image Notes 1. You want 90 degree angles! 2. Acurate measurements 3. Draw up the grid 4. Punch holes so the drill doesnt travel sideways when you start drilling out the holes
http://www.instructables.com/id/LED-Cube-4x4x4/
Image Notes 1. The distance of 25mm between the center of each hole, enable the pins to just barely overlap. just perfect for soldering.
http://www.instructables.com/id/LED-Cube-4x4x4/
Image Notes 1. Start by aligning and soldering the outer edges 2. anode 3. anode 4. anode 5. cathode 6. Bend the cathode leg (the short one) of the LED 90 degrees to one side.
Image Notes 1. All the cathodes (minuses) have been soldered together. 2. Since we bent all the cathodes in the same direction, there will be one sticking out to the side. just leave it for now. 3. The layer is pretty flimsy in this end, and would be bent out of shape if removed from the template like this. See the next image..
http://www.instructables.com/id/LED-Cube-4x4x4/
Image Notes 1. Add a barcing to this side to make the layer more robust. Take a straight piece of wire and solder it to all 4 cathodes.
http://www.instructables.com/id/LED-Cube-4x4x4/
Image Notes 1. cathodes connected to layer 2. Anode 3. Same anode wire connects to the led directly above.. 4. Again, be carefull with the soldering iron when soldering this close to the LED. Be fast. If you make a mistake. Let the led cool down before applying heat again.
http://www.instructables.com/id/LED-Cube-4x4x4/
Image Notes 1. Pins 15 and 16 on the MAX232 are used for power. Pin 15: GND, pin 16: VCC.
http://www.instructables.com/id/LED-Cube-4x4x4/
2. This capacitor should be placed as close to the GND and VCC of IC2 as possible. It's job is to stabilize power to that ic. 3. 5V voltage regulator
http://www.instructables.com/id/LED-Cube-4x4x4/
Image Notes 1. C0 2. C3 3. C4 4. C7 5. A7 6. A0 7. A3 8. A4 9. C1 10. C2 11. C5 12. C6 13. A1 14. A2 15. A5 16. A6 17. Port A 18. Port C 19. Front 20. Back
Image Notes 1. Transistor array for ground wires 2. Port D bit 7 controls layer 0 3. Layer 3 4. Layer 2 5. Layer 1 6. Layer 0 7. Yes this is a picture of another cube. I didn't have the original available when writing this.
Image Notes 1. Ground for level 3 2. Ground for level 2 3. Ground for level 1 4. Ground for level 0
Image Notes 1. Ground wire for level 1 2. All the cathodes on this layer are connected together
http://www.instructables.com/id/LED-Cube-4x4x4/
File Downloads
4x4x4_ledcube-0.2.zip (14 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '4x4x4_ledcube-0.2.zip']
4x4x4_ledcube.hex (19 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to '4x4x4_ledcube.hex']
http://www.instructables.com/id/LED-Cube-4x4x4/
and "avrdude -c usbtiny -p m16 -U hfuse:w:0xc9:m". Be carefull when doing this step! If you get it wrong, you can permanently destroy your microcontroller! If you are using another microcontroller than the ATMega16, be sure to read the datasheet carefully before changing the fuse bytes! After writing the correct fuse bytes, the cube should reboot and start operating at regular speed with all leds operational. Enjoy your new cube :D
Image Notes 1. Write firmware If you downloaded the file 4x4x4_ledcube.hex, it should be U flash:w:4x4x4_ledcube.hex 2. 9KB to spare! You have lot's of space to write new effects or store animations.
http://www.instructables.com/id/LED-Cube-4x4x4/
Image Notes 1. USBTinyISP 2. 6pin cable 3. 10pin cable. This cable has one GND lead for each data lead, making it more stable.
Image Notes 1. USBTinyISP connected to the cube 2. Green lights comes on when connected to the USB port 3. Red light comes on when programming 4. No need to connect to external power. The USBTinyISP supplies the cube with 5V via the ISP cable.
Image Notes 1. When the cube boots up, it flashes the red and green status leds a couple of times. If the leds doesn't do anything else than flasing it's status leds, you have probably flashed it with the wrong firmware. I flashed an m32 with firmware for an m16 once, and got this problem.
You can find the 8x8x8 version here: http://www.instructables.com/id/Led-Cube-8x8x8/ Please rate this instructable if you like it! :)
http://www.instructables.com/id/LED-Cube-4x4x4/
Related Instructables
Comments
50 comments Add Comment view all 534 comments
Mar 15, 2011. 2:40 PM REPLY
googl1 says:
hi i created a fork of your code at [email protected]:googl1/led-cube.git i did some improvements, bugfixing and started implementing some new effects. rick
googl1 says:
this is what i did by now, if anyone wants to try or contribute. http://share.ddf-software.de/main.hex [email protected]:googl1/led-cube.git i also fixed the random effects thing and improved the random numbers by creating a seed to init rand()
http://www.instructables.com/id/LED-Cube-4x4x4/
rick
coppertopneo says:
Mar 15, 2011. 11:42 PM REPLY im new at this and i would really like to try this. i dont know much about programming, but if someone could tell me how its connected to compute. and what program to use to flash it would be helpfully. if you could email me thanks. [email protected]
bhodowanic says:
Would this work as the Max232 rs-232 chip? USB To TTL Converter Module cp2102 arm9 max232 max2332 http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=380319575805#vi-content Also what programmer did you use?
MonkeySin says:
Feb 20, 2011. 5:49 PM REPLY I want to build this SOOO bad but i don't understand how to use most of the electronics here like the microcontroller. Can anyone please suggest a couple of projects i can try first to familiarize myself with the micro controller, atmega16 and things like that? or a website where i can learn them? thank you much appreciated.!!
computurwizard says:
See: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=70673 Start with "A From-Scratch AVR Tutorial"
wmtt says:
Dear chr, your cube is loved my many. May I ask
1.are the LEDs switching on and off without grayscale? In another word, is PWM used in this cube. It appears to be the case in the video but it may be POV effect. 2. How fast the layer mutiplexing is, i.e. the refresh rate? Many thanks. wmtt
Buskleif says:
Just finished building this and it works great. I used the atmega32 instead of the 16, and an avrisp mkII programmer. Running it at 16MHz with no problems.
ricarz16 says:
how can i make the cube faster??? i have a problem with the reprogramming of the atmega16 my programmer is not able to find my atmega again!!! please help me
chris.sevilla says:
can the LED cube be controlled with an Atmel AT89S52 microcontroller??
Steeps5 says:
You may want to add the 10-pin connector for the AVR programmer into the component list. I almost forgot to order it!
wickidude says:
Feb 18, 2011. 5:58 AM REPLY Hey, Im have two problems i have built this on a PCB which i have designed myself and programmed it and most of the columns work fine its just outputs C2-C5 are dim and always on. Also the clock speed is set to the internal clock speed so the program is quite slow how do i set it to the external clock ? thanks
http://www.instructables.com/id/LED-Cube-4x4x4/
wickidude says:
sorrry realised i hadnt set fuse bits works perfectly now
ptorelli says:
Feb 13, 2011. 10:14 PM REPLY A clamp-on heatsink will help keep the LED from melting when soldering (clamp it on the 5mm of space between the weld and the bulb). RadioShack sells them, looks like a pair of industrial eyebrow tweezers. Feb 8, 2011. 3:02 AM REPLY
febinjohn says:
chr ur make file is have some bugs that`s why i got error while compiling the file makefile:1: *** missing separator. Stop.
its due to error in compression i think any way i made a make file by my own for 32 now everything fine i will post some pics very soon :)
febinjohn says:
I made the cube but not working only the status leds are blinking i am using mega32 t i can use same fuse as 16 ??? in high only SUT0 is high and in low SPIEN ,BOOTSZ1 and BOOTSZ0 is high please somebody :-(
chr says:
Hi, I think you can use the same fuses, but you have to change the Makefile and recompile the software. Change this line: MCU = atmega16 To this: MCU = atmega32
If you load the mega32 with firmware compiled for the mega16, it will work long enough for the status leds to blink, then reboot. Remeber to post pictures and video when you get it working :)
febinjohn says:
am getting an error makefile:1: *** missing separator. Stop. when i type make :-( or can u post firmware for 32????
thanhnam2k says:
Hi, If I use ATMega16L, should I change the crystal 14.7456 MHz to 8Mhz or lower? Is there any other change needed? BTW, which should be the equivalent to the transistor BC338? I'm looking for the replacement in 2Nxxxx series, is it possible? Thanks in advance,
http://www.instructables.com/id/LED-Cube-4x4x4/
febinjohn says:
2N2222 is working for me
thanhnam2k says:
Thank you, I'll try it.
Afide says:
Jan 25, 2011. 9:36 AM REPLY Man I want to build this so badly, but I don't get the circuit at all, it would be infinitely amazing if someone made a little video of creating it.
domdomgin says:
where do i have to put the hex file in which directory..i have usbtiny..it cannot locate the hex file to upload the firmware
andrejmdias says:
someone has the full pdf of this circuit to send send: [email protected] thanks
andersop says:
Hi, I was wandering if it could be possible to get a hi-quality picture of that circuit-sketch? and also; what is the voltage on the capacitors? Is 45V bad? 100v? hard to find 5v... I'm almost ready to start building ;)
shaunak says:
The template is a great Idea and it helps a lot.
bdc1513 says:
Jan 13, 2011. 3:24 PM REPLY I'm Planning on building this one, but i'm wondering about how much this entire project will cost. people who have built it, what did it cost you? (if you had none of the parts in advanced, except the soldering equipment) Jan 13, 2011. 2:49 PM REPLY
ricarz16 says:
=)... it RUNS
zref21 says:
Great Instructable!
Some parts of the schematic had me confused for a while (Okay, maybe i went a little overkill for my 2nd electronics project ever...), but luckily google provided some answers :) And, although i had some setbacks during the construction (including one fried ISP programmer because i mounted that 10-pin connector the wrong way... stupid me), my cube is now finished! One thing still confuses me, though... you setup USART in your code (along with the MAX232 and all...) but you never make use of it. I really want serial communication for my cube, so i wonder: Do you have a working USART implementation for this? Or could you point me to some other tutorial/'ible using USART, so i can start from there?
http://www.instructables.com/id/LED-Cube-4x4x4/
chr says:
Thanks for the feedback, I love getting pictures :D I think i tried the rs232 port on this LED cube once.. Just sent random data to it. The 8x8x8 LED cube has a working rs232 stack. The cube buffer has the same layout, only the cube buffer looks like this: cube[8][8], and the 4x4x4 cube has cube[4][4]. You only have to change the if() statements to reset to 0,0 when x and y hit 3, not 7. Download the source code for the 8x8x8 cube and have a look.
zref21 says:
thanks, will do! as soon as i got it running, i'll post a link to the updated code here, so that others can enjoy it as well ^^ for now, i just sit and enjoy watching my cube do stuff :)
cricketm24 says:
Jan 9, 2011. 6:56 PM REPLY you don't have all your componets that are on your board on your list like the connecter for the programmer can you please give the full list
hobbyman says:
painting the leads to black might improve the quality of the produced graphics in the cube I guess.
cricketm24 says:
can anyone tell me how to program the chip and what software to use
samirsky says:
Just saw the 8x8x8. Awesome! Do you have any new or other patterns/software for the 4x4x4?
michalfiasky says:
Jan 4, 2011. 4:52 AM REPLY someone send me instructions on how to put together? Please. send me an email [email protected] I am from Slovakia and my English is not perfect and therefore I'm sorry. Dec 25, 2010. 8:00 AM REPLY
Kartoffelpuffer says:
Awesome!!! Great 'ible!!! I want to build one myself. I've nearly got all parts, only the LED's are missing. Which LED's did you use? I'd especially like to know what angle of radiation your LED's have, and how strong they are!
Thx
http://www.instructables.com/id/LED-Cube-4x4x4/
frollard says:
Jan 1, 2011. 4:37 AM REPLY For a project like this you want any 20ma superbright led (you'll be running it at lower power unless you use a driver) -- and I prefer 'straw hat' leds, or the concave lens leds -Straw hat has the lens immediately at the diode portion, so it radiates 180 degrees, where the indented ones (look like they have a cone-divot in the tip) are designed to shoot more light out the sides than out the tip. Saves having to diffuse them.
andyzug says:
Hi! how I can programm this cube with arduino?? THX
domdomgin says:
i finished the project but some leds dont light vertically for eg 1 / 11..please suggest..the leds are fine..
kahangkatumbal says:
HI! i just wanna ask if this is also applicable with PIC16F84A??
maewert says:
My daughter and I just finished our 5x5x5 cube:
emihackr97 says:
How did you make that, did you use a normal Arduino or an Arduino Mega??
maewert says:
Dec 10, 2010. 12:10 PM REPLY We used a normal 'arduino', specifically an Ardweeny. We used the lower 5 bits of PortD and 5 PNP transistors to supply the power to 5 LEDs at time and we used the lower 5 bits of PortB to select one of the 25 'columns' to supply the ground to the LEDs. To demultiplex the 5 portB bits into 25 individual grounds I used four 74LS138's. The 74LS138 sets one of 8 outputs to ground based on how the three input bits are set. Unfortunately I really needed one of the 25 wires set high while all the others were left low when scanning the columns. To accomplish this I had to use 6 hex inverter chips, 74LS04's. I've seen other circuits that used shift registers (like the circuit used in this instructable) but I like the discrete components since they are easier to teach :-) Anyway, great fun for a geeky father/daughter project
emihackr97 says:
wow, could you post an 'ible on how to make it?? It would be great!
karyochi says:
Dec 6, 2010. 5:57 AM REPLY i'm having some problems, when i use the make command, it responds with:"makefile: ***missing seperator", could someone plz help?, i want to use an ATmega8 or ATmega32, maybe somoene just could send me the HEX code, [email protected]. Dec 4, 2010. 9:14 PM REPLY
capanuwa says:
i ,ve made the cube.it's grate. friend can you give us 8x8x8 led cube schematic and the code? please please please? you are a grate man thanks for the 4x4x4 cube
http://www.instructables.com/id/LED-Cube-4x4x4/
yasoo716 says:
dude u are ultimate .....and hats off for your patients for explaining this............
http://www.instructables.com/id/LED-Cube-4x4x4/