12
http://www.instructables.com/id/The-4x4x4-LED-cube-Arduino/ 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) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Intro: The 4x4x4 LED cube (Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 step 1: Get the materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 step 2: assemble the board(the LED cube base) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 step 3: Defuse the LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 step 4: Construct the cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 step 5: PROGRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 step 6: ADD on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

The 4x4x4 LED Cube Arduino

Embed Size (px)

Citation preview

Page 1: The 4x4x4 LED Cube Arduino

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

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) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Intro:   The 4x4x4 LED cube (Arduino) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

step 1:   Get the materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

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

step 3:   Defuse the LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

step 4:   Construct the cube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

step 5:   PROGRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

step 6:   ADD on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

Page 2: The 4x4x4 LED Cube Arduino

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 14I/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 materialsTo 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 16you 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

Page 3: The 4x4x4 LED Cube Arduino

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 Notes1. 64 LED your choice in this case its green2. PCB but I didn't end up using this one because it was too small so I used abigger one3. broken off peace off the 32 male pin header4. Arduino5. 64-100 ohm resistors6. 400 G sand paper7. My keyboard

Image Notes1. supper Bright2. clear

Image Notes1. 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 LEDand 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.

 

Page 4: The 4x4x4 LED Cube Arduino

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

Image Notes1. 100 ohm resistor2. coloms(+) 1 - 83. coloms(+) 9 - 144. coloms(+) 15 ,165. levels(-) 1 - 46. defused LED using sand paper

step 3: Defuse the LEDDETOUR 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 Notes1. 400 GRIT sand paper2. clear LED

Image Notes1. now Defused LED

Page 5: The 4x4x4 LED Cube Arduino

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

Image Notes1. normal2. after sanding

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

Image Notes1. this = lighting up the LED above it2. this = dispersing light

step 4: Construct the cubeNow 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 diagrambelow) 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 allthe resistors to the column which is a piece of Ethernet wire. (See picture)

Image Notes1. the resistor2. LED

Page 6: The 4x4x4 LED Cube Arduino

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

Image Notes1. LAYER(--)2. COLOMN (+)3. LED4. 100 ohm resistor5. connections to arduino pins (+)6. conections to 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.

Page 7: The 4x4x4 LED Cube Arduino

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

Page 8: The 4x4x4 LED Cube Arduino

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

Image Notes1. resistor rining from the (+) on the LED to the (+) colom2. (+) colom runing to the arduino3. the (--) layer conected to the (--) of the LED

step 5: PROGRAMGood 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

Page 9: The 4x4x4 LED Cube Arduino

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

Image Notes1. 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 onso 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,

codeeach 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 andArduino Lib bygzip

How to build an8x8x8 LED cubeand control itwith an Arduinoby R-

Make a 24X6LED matrix bySyst3mX

LED Cube 4x4x4by chr

How to build a8x8x8 led cube(Englishversion) by agofi

8x8 LED matrixby hemmikarl

Page 10: The 4x4x4 LED Cube Arduino

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

Advertisements

Comments24 comments Add Comment

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

 Mike32526 says:  Dec 8, 2010. 5:30 PM  REPLYthe 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:  Dec 8, 2010. 7:21 PM  REPLYyeah, 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??

 Mike32526 says:  Dec 8, 2010. 8:34 PM  REPLYAll 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/opins 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 ledpulling 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:  Dec 8, 2010. 3:52 PM  REPLYor wouldn't you need transistors???

 chr says:  Dec 1, 2010. 6:23 AM  REPLYHi forte1994,

Nice LED Cube! :)

I've built a few led cubes, and want to share some insights and design considerations.

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 onat 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. Rinseand 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 ofanimations 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  REPLYI 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 slowmotion.(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 :)

Page 11: The 4x4x4 LED Cube Arduino

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

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

 forte1994 says:  Dec 4, 2010. 3:25 PM  REPLYhehe YEP

 forte1994 says:  Sep 13, 2010. 10:30 PM  REPLYDoes anyone now how to rate something (instructible ) before it was stars, what is it now?

Thanks in advance.

 zascecs says:  Nov 25, 2010. 9:13 AM  REPLYYou 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  REPLYI 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 goodjob

 forte1994 says:  Nov 20, 2010. 6:56 PM  REPLYok i changed the code and tested it and it works (the step wasnt alowing more text and cut it off)

thank you for noticing

 mertaxoy says:  Nov 8, 2010. 9:43 AM  REPLYthere are many missing commands in program like this for (ledrow=0; ledrowcan i give us the code as a file please ?thank you..

 zack247 says:  Sep 12, 2010. 12:13 AM  REPLYcool! 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

 forte1994 says:  Sep 13, 2010. 10:21 PM  REPLYNa I always make mistakes ( I'm only human) lol thanks

 herpelcano says:  Sep 9, 2010. 11:25 PM  REPLYSince 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  REPLYya 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 theextra work.

 the seaker says:  Sep 9, 2010. 9:03 AM  REPLYmy 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 theleds up draw more current than the arduino can put out?

 herpelcano says:  Sep 9, 2010. 11:23 PM  REPLYThe 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 couplemilliseconds to make it appear as if they are all on.

 forte1994 says:  Sep 9, 2010. 3:10 PM  REPLYwell 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) butthe Arduino works perfectly fine and all the leds have the same light out put.

 the seaker says:  Sep 10, 2010. 8:27 AM  REPLYi 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 currentlimit of the arduino.

Page 12: The 4x4x4 LED Cube Arduino

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

 forte1994 says:  Sep 13, 2010. 10:27 PM  REPLYThere 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 knowmuch 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:  Sep 14, 2010. 7:56 AM  REPLYThat actually makes a lot of sense. Thank you