You are on page 1of 12

Home Sign Up!

Browse Community Submit


All Art Craft Food Games Green Home Kids Life Music Offbeat Outdoors Pets Photo Ride Science Tech

The 4x4x4 LED cube (Arduino)


by forte1994 on September 2, 2010 Table of Contents License: Attribution Non-commercial Share Alike (by-nc-sa) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intro: The 4x4x4 LED cube (Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . step 1: Get the materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . step 2: assemble the board(the LED cube base) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . step 3: Defuse the LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . step 4: Construct the cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . step 5: PROGRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . step 6: ADD on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 2 3 4 5 8 9 9 9

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

License: Attribution Non-commercial Share Alike (by-nc-sa) Intro: The 4x4x4 LED cube (Arduino)
In this instructable I will show you how to make a 4x4x4 LED cube that will be controlled by an Arduino Demulionove. now yes you might say" that Arduino has only 14 I/O pins well also the 6 analog pins can be used as pins 15,16,17,18,19,20. that way giving us enough pins (16 columns + 4layers = 20 I/O pins) This instructable is made for those who know how to solder (well) and how to program the Arduino. Also I will be providing detours to skip sum steps so if you see (Detour available skip to __ Step) you can follow if you are to lazy to do that.

step 1: Get the materials


To start of you will need these materials: Mandatory -- 64 LED (color optional) ** -- Arduino Demulionove -- Wire Optional --32 male pin strip --PCB prototype board --Fine Grit (400 +) sand paper Your choice -- 64 resistors or 16 you can get 64 resistors which will help by keeping all the lights at the same light out put regardless of how many are on but it will be considerably more work. Tools: --Computer --Soldering Iron --Solder --thin nose pliers

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

**Color is optional but use this website to find the right resistor for your leds http://led.linear1.org/led.wiz (I got Green so I used 100 ohm resistors)

Image Notes 1. 64 LED your choice in this case its green 2. PCB but I didn't end up using this one because it was too small so I used a bigger one 3. broken off peace off the 32 male pin header 4. Arduino 5. 64-100 ohm resistors 6. 400 G sand paper 7. My keyboard

Image Notes 1. supper Bright 2. clear

Image Notes 1. now Defused LED

step 2: assemble the board(the LED cube base)


(Detour available skip to next step) In this step you will need the board and the wiring. First you will want to map out were all the wires will go and then feed the wires through the board. Don't mind the LED and resistor note on the picture for now. NOTE: I recommend you use Different color wire just because you won't get confused which wire is which.

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

Image Notes 1. 100 ohm resistor 2. coloms(+) 1 - 8 3. coloms(+) 9 - 14 4. coloms(+) 15 ,16 5. levels(-) 1 - 4 6. defused LED using sand paper

step 3: Defuse the LED


DETOUR if you don't want to do this then go to next step So to defuse the LED I took normal 400 grit sand paper and sanded all the LEDs which made them look pretty good.

Image Notes 1. 400 GRIT sand paper 2. clear LED

Image Notes 1. now Defused LED

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

Image Notes 1. normal 2. after sanding

Image Notes 1. with flash you can still see the defused one but not the normal

Image Notes 1. this = lighting up the LED above it 2. this = dispersing light

step 4: Construct the cube


Now there is the Easy way to do this and that is to connect all the (--) in one layer and then the columns (+) to the resistor and then board. (Look at picture diagram below) what happens is when you turn it on (all of them) the lights are dimmer then when one is on. My solution to this was to solder a 100 ohm resistor to each LED. (Follow picture instruction on how to do it.) Everything is done in the same way only now you solder all the resistors to the column which is a piece of Ethernet wire. (See picture)

Image Notes 1. the resistor 2. LED

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

3. resistor plased in between the (-) bent down and the (+) bent up. 4. start wraping the resistor around the (+) leed. 5. when done solder and snip off the end of the LED that is after the solder.

Image Notes 1. LAYER(--) 2. COLOMN (+) 3. LED 4. 100 ohm resistor 5. connections to arduino pins (+) 6. conections to arduino (--)

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

Image Notes 1. resistor rining from the (+) on the LED to the (+) colom 2. (+) colom runing to the arduino 3. the (--) layer conected to the (--) of the LED

step 5: PROGRAM
Good job on making it too this step now all you need to do is upload this code and you are done. the code did not fit the line so here it is

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

Image Notes 1. All finished YAY took me about 4 days 2-5 hours a day to finish and program.

File Downloads
LED_cube_4x4x4.zip (2 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'LED_cube_4x4x4.zip']

step 6: ADD on
so to program the cube all you need to do is change the B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, 80, code each B1111 corresponds to a line of LEDs in your cube 0 being off and 1 being on. The last number is the time it will display that part in milliseconds. so get programing and enjoy.

Related Instructables

LED Cube and Arduino Lib by gzip

How to build an 8x8x8 LED cube and control it with an Arduino by R-

Make a 24X6 LED matrix by Syst3mX

LED Cube 4x4x4 How to build a 8x8x8 led cube by chr (English version) by agofi

8x8 LED matrix by hemmikarl

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

Advertisements

Comments
24 comments Add Comment

emihackr97 says:
i dont understand, doesn't Arduino only have 3 GROUND PINS?? how cmoe you connect 4 different wires to it, please answer.

Dec 8, 2010. 3:46 PM REPLY

Mike32526 says:

Dec 8, 2010. 5:30 PM REPLY the 4 diff coms are so you can turn on an individual level with out turning on that whole colum of leds just the one on that level u wish to come on Mike

emihackr97 says:
yeah, i know that, but, arent the Level pins supposed to be ground??? as far as i know, those pins can supply V out but not gnd, in confused. Do you understand me??? can you explain me how these work??

Dec 8, 2010. 7:21 PM REPLY

Mike32526 says:

Dec 8, 2010. 8:34 PM REPLY All your pin on ur arduino can be manipulated to do any thing for example +5v (HIGH) or 0 volts (LOW) (gnd) by useing somryging like: digital.Write(2,LOW); Or something of that nature to tell the pin hey go gnd or go positive, Dont do this as a power Source!! As this will blow i/o pins and/or the micro processor( the brain of it) Leds pull very little so they are semi safe to use. The resistor is to protect the arduino from the led pulling to much as it limits the power it can draw from the pin. The i/o pins are very universal in use i begin to love my arduino more and more every day!! Mike

emihackr97 says:
or wouldn't you need transistors???

Dec 8, 2010. 3:52 PM REPLY

chr says:
Hi forte1994, Nice LED Cube! :) I've built a few led cubes, and want to share some insights and design considerations.

Dec 1, 2010. 6:23 AM REPLY

1) There should be no need to have a resistor for each LED. If you use multiplexing, and it is working correctly, no more than one LED per column will be on at any given time. 2) I would recommend using an interrupt routine to do the multiplexing. Create an buffer array of 4x4 bytes. (that way X and Y is the byte, and Z is the bits within the byte. It will save you 48 bytes of ram) Set up a timer that runs every 10 milliseconds or something, and set up an interrupt routine that is called on every timer reset. Every time the interrupt routine is called, it turns all layers off, loads the next layer from the buffer array onto the IO pins, and turns the next layer on. Rinse and repeat. The cube now draws the buffer contents onto the LED cube in the background, and your main() loop can be preserved for code that generates animations. I haven't tried using timers or interrupts on an Arduino before, but it shouldn't be very different from using them on a plain AVR. You will also free up a lot of programming space by not having to store the patterns in program memory. I have ledcubes that run several minutes of animations on a 16KB avr. You can also populate the cube buffer array via the serial line and control it from a computer. Check out some code examples in my LED Cube instructable: http://www.instructables.com/id/LED-Cube-4x4x4/ Hope you found this useful! -chr

forte1994 says:

Dec 4, 2010. 5:36 PM REPLY I found that for some reson some of the lights do not do multiplexing because I set up a camera that fillmed it and then played it back at VERY slow motion. (by very slow I mean it was a 30 second video and I solowed it down to 30 min.) thanks for the advise next I want to do a 8x8x8 and then 16x16x16 untill I can get to 64x64x64 :)

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

ReadyWater says:

Nov 26, 2010. 6:48 AM REPLY Any chance the ingredients were purchased at Creatron in Toronto? The resistor bags and led info sheets look awfully familiar.

forte1994 says:
hehe YEP

Dec 4, 2010. 3:25 PM REPLY

forte1994 says:
Does anyone now how to rate something (instructible ) before it was stars, what is it now? Thanks in advance.

Sep 13, 2010. 10:30 PM REPLY

zascecs says:

Nov 25, 2010. 9:13 AM REPLY You go to the stars above someone's name, and then click on how many starts you think the person deserves ( From worthless, 0.5 starts, to best ever, 5 stars). If you're asking how many stars yours has, its 4.33 out of 5.

thomasofacton says:

Nov 20, 2010. 3:02 PM REPLY I love it. I want to make one of these. But could you upload your code. When i do the copy and paste well arduino Ver 21 doesn't like it. Thanks again good job

forte1994 says:
ok i changed the code and tested it and it works (the step wasnt alowing more text and cut it off) thank you for noticing

Nov 20, 2010. 6:56 PM REPLY

mertaxoy says:
there are many missing commands in program like this for (ledrow=0; ledrow can i give us the code as a file please ? thank you..

Nov 8, 2010. 9:43 AM REPLY

zack247 says:
cool! i have always wanted to make a led cube, but i never found enough leds, maybe a 3x3x3 will be good enough for me. PS: its spelled diffused, not defused, sorry if this came across as negative

Sep 12, 2010. 12:13 AM REPLY

forte1994 says:
Na I always make mistakes ( I'm only human) lol thanks

Sep 13, 2010. 10:21 PM REPLY

herpelcano says:

Sep 9, 2010. 11:25 PM REPLY Since only one layer is on at a time you could have saved yourself a lot of trouble by only putting your resistors on the wires leading to the sixteen columns.

forte1994 says:

Sep 10, 2010. 3:25 PM REPLY ya at first i tried it with a 3x3x3 led cube and the colons would get considerably darker as more then one led on that colon turned on so thats why i did the extra work.

the seaker says:

Sep 9, 2010. 9:03 AM REPLY my last post was done when i was half asleep and i apoligize, i deleted it and ill start over. okay so if you do it your way using 20 pins, wouldnt lighting all the leds up draw more current than the arduino can put out?

herpelcano says:

Sep 9, 2010. 11:23 PM REPLY The authors cube is multiplexed which means only one layer it sixteen LEDs is on at any one time and they layers switch back and forth every couple milliseconds to make it appear as if they are all on. Sep 9, 2010. 3:10 PM REPLY well since each led is using its own 100 ohm resistor then i don't see why it would pull to much ( i don't know much about that stuff yet only grade 11) but the Arduino works perfectly fine and all the leds have the same light out put.

forte1994 says:

the seaker says:

Sep 10, 2010. 8:27 AM REPLY i am only grade 11 as well. and i see what you're saying, thanks for putting it that way because i some how managed to over look this simple fact. with both the arduino turning the leds on and off every couple milliseconds and the resistors, there wouldn't really be any way to go over the current limit of the arduino.

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/

forte1994 says:

Sep 13, 2010. 10:27 PM REPLY There is actualy a way to see the led cube having one led on (at a time) while our eye sees the whole cube lit. Get a cammera and (don't know much about cameras) and there is a setting that will make the cube look like it's flashing. That way it is way easier to understand it.

the seaker says:


That actually makes a lot of sense. Thank you

Sep 14, 2010. 7:56 AM REPLY

http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/