loading
Are you bored? Let's try making an LED cube. A work of art, that lights up.

Check out my new project on sending a balloon into space!!
https://www.instructables.com/id/My-Space-Balloon-Project-Stratohab-Success-High/

Step 1: What in the World Is and LED?

LED is an acronym for Light Emitting Diode, where electricity can only go one way and when it passes through the "LED" it lights up!

Step 2: Materials You Will Need.

Let's see what you need to make this...

• 27 LEDs - radioshack sells 20 for 3 bucks. You can go to digikey, or be smart and get two packs of assorted LEDs at radioshack.

• Arduino Programming Board - Go to the maker shed or arduino.cc

• Some like 2ft of wire(choose your favorite)

• A breadboard for connecting all the pieces. 

• A soldering iron! 

and your set to go!

Step 3: Assemble the Cube!

So as you can see in that first picture. The cube is 3x3x3. Which means a 3x3 led in one layer, and three layers of 3x3 LEDs.

You need to make a jig for this. I used foam core and basically drill some holes in a 3x3 matrix shape about 1/2 an inch between each hole.

now, when you have all of your LEDs in the holes and the pins are sticking up to the sky you need to bend the cathodes.

Easy enough to understand. The longer one is the positive and bear with me, this one is called the anode.

now you want to bend the cathode (the shorter one) the way the arrows go on this picture. Then when that cathode is bent it should be touching the other LEDs cathode. This is your soldering place.(melt the solder here).

Great all done! Now you have a 3x3 led square. Repeat this step two more times so you have three. 

Lay those three LED squares on the table in front of you. now, i used some wire we discussed earlier to connect them all. On the squares there should be 9 anodes sticking up. You want to connect the anode of the first LED square to the corresponding anode one the second layer.

So, when your finished you should have 9 columns of anodes.

Then you need to solder you some wires going from the negative connections of all three layers. You should end up with three separate wires coming from the negatives(the cathodes).

Step 4: So Your's Should Look Like This

Exactly, Now you need to connect all of these anode pins to your breadboard and make sure that you have access to the rows they are on. Leave the cathode wires there.

Step 5: Programming Time!

I found this awesome program here:

http://www.stationinthemetro.com/index.php/archives/2008/01/19/makedc-led-cube-workshop/

I'll save you a trip and post the code right here. Load this up to arduino via the arduino environment you can download at arduino.cc (a website).



Based on ledcube.c from Make: September 7, 2007 weekend podcast
http://blog.makezine.com/archive/2007/09/make_a_pocket_led_cube_we.html

Custom animation programmed by Mark Boszko, http://stationinthemetro.com
*/

#include <avr/pgmspace.h> // allows use of PROGMEM to store patterns in flash

#define CUBESIZE 3
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 3333 // time each plane is displayed in us -> 100 Hz refresh
#define TIMECONST 20 // multiplies DisplayTime to get ms - why not =100?

// LED Pattern Table in PROGMEM - last column is display time in 100ms units
// TODO this could be a lot more compact but not with binary pattern representation
prog_uchar PROGMEM PatternTable[] = {
// blink on and off
B111, B111, B111, B111, B111, B111, B111, B111, B111, 5,
B000, B000, B000, B000, B000, B000, B000, B000, B000, 1,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 5,
B000, B000, B000, B000, B000, B000, B000, B000, B000, 1,
// flash each LED in sequence:
// Left->Right column, then Top->Bottom row, then Upper->Lower plane
B100, B000, B000, B000, B000, B000, B000, B000, B000, 1,
B010, B000, B000, B000, B000, B000, B000, B000, B000, 1,
B001, B000, B000, B000, B000, B000, B000, B000, B000, 1,
B000, B100, B000, B000, B000, B000, B000, B000, B000, 1,
B000, B010, B000, B000, B000, B000, B000, B000, B000, 1,
B000, B001, B000, B000, B000, B000, B000, B000, B000, 1,
B000, B000, B100, B000, B000, B000, B000, B000, B000, 1,
B000, B000, B010, B000, B000, B000, B000, B000, B000, 1,
B000, B000, B001, B000, B000, B000, B000, B000, B000, 1,
B000, B000, B000, B100, B000, B000, B000, B000, B000, 1,
B000, B000, B000, B010, B000, B000, B000, B000, B000, 1,
B000, B000, B000, B001, B000, B000, B000, B000, B000, 1,
B000, B000, B000, B000, B100, B000, B000, B000, B000, 1,
B000, B000, B000, B000, B010, B000, B000, B000, B000, 1,
B000, B000, B000, B000, B001, B000, B000, B000, B000, 1,
B000, B000, B000, B000, B000, B100, B000, B000, B000, 1,
B000, B000, B000, B000, B000, B010, B000, B000, B000, 1,
B000, B000, B000, B000, B000, B001, B000, B000, B000, 1,
B000, B000, B000, B000, B000, B000, B100, B000, B000, 1,
B000, B000, B000, B000, B000, B000, B010, B000, B000, 1,
B000, B000, B000, B000, B000, B000, B001, B000, B000, 1,
B000, B000, B000, B000, B000, B000, B000, B100, B000, 1,
B000, B000, B000, B000, B000, B000, B000, B010, B000, 1,
B000, B000, B000, B000, B000, B000, B000, B001, B000, 1,
B000, B000, B000, B000, B000, B000, B000, B000, B100, 1,
B000, B000, B000, B000, B000, B000, B000, B000, B010, 1,
B000, B000, B000, B000, B000, B000, B000, B000, B001, 10,

// Some little cube - big cube fun
B000, B000, B000, B000, B011, B011, B000, B011, B011, 10,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 10,
B000, B000, B000, B000, B011, B011, B000, B011, B011, 5,
B000, B000, B000, B000, B000, B000, B000, B000, B001, 2,
B000, B000, B000, B000, B011, B011, B000, B011, B011, 2,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 2,
B000, B000, B000, B000, B011, B011, B000, B011, B011, 2,
B000, B000, B000, B000, B000, B000, B000, B000, B001, 2,
B000, B000, B000, B000, B011, B011, B000, B011, B011, 2,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 1,
B000, B000, B000, B000, B011, B011, B000, B011, B011, 1,
B000, B000, B000, B000, B000, B000, B000, B000, B001, 1,
B000, B000, B000, B000, B011, B011, B000, B011, B011, 1,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 1,
B110, B110, B000, B110, B110, B000, B000, B000, B000, 1,
B100, B000, B000, B000, B000, B000, B000, B000, B000, 1,
B110, B110, B000, B110, B110, B000, B000, B000, B000, 1,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 1,
B000, B000, B000, B000, B011, B011, B000, B011, B011, 1,
B000, B000, B000, B000, B000, B000, B000, B000, B001, 1,
B000, B000, B000, B000, B011, B011, B000, B011, B011, 1,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 1,
B110, B110, B000, B110, B110, B000, B000, B000, B000, 1,
B100, B000, B000, B000, B000, B000, B000, B000, B000, 1,
B110, B110, B000, B110, B110, B000, B000, B000, B000, 1,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 1,
B000, B011, B011, B000, B011, B011, B000, B000, B000, 1,
B000, B000, B001, B000, B000, B000, B000, B000, B000, 1,
B000, B011, B011, B000, B011, B011, B000, B000, B000, 1,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 1,
B000, B000, B000, B110, B110, B000, B110, B110, B000, 1,
B000, B000, B000, B000, B000, B000, B100, B000, B000, 1,
B000, B000, B000, B110, B110, B000, B110, B110, B000, 1,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 1,
B000, B011, B011, B000, B011, B011, B000, B000, B000, 1,
B000, B000, B001, B000, B000, B000, B000, B000, B000, 1,
B000, B011, B011, B000, B011, B011, B000, B000, B000, 1,
B111, B111, B111, B111, B111, B111, B111, B111, B111, 1,
B000, B000, B000, B110, B110, B000, B110, B110, B000, 1,
B000, B000, B000, B000, B000, B000, B100, B000, B000, 1,
B000, B000, B000, B110, B110, B000, B110, B110, B000, 1,

// Diagonal wipe, starting in the center
B111, B111, B111, B111, B111, B111, B111, B111, B111, 5,
B111, B111, B111, B111, B111, B111, B111, B101, B111, 1,
B111, B111, B111, B111, B101, B111, B111, B101, B111, 1,
B111, B111, B111, B111, B101, B111, B111, B100, B111, 1,
B111, B101, B111, B111, B100, B111, B111, B100, B110, 1,
B111, B101, B111, B111, B100, B111, B111, B100, B110, 1,
B111, B011, B111, B111, B100, B110, B111, B100, B100, 1,
B111, B100, B110, B111, B100, B100, B111, B100, B000, 1,
B111, B100, B100, B111, B100, B000, B111, B000, B000, 1,
B111, B100, B000, B111, B000, B000, B011, B000, B000, 1,
B111, B000, B000, B011, B000, B000, B001, B001, B000, 1,

// 2-LED wide diaginal stripe that orbits the cube
B011, B000, B000, B001, B001, B000, B000, B001, B001, 1,
B001, B001, B000, B000, B001, B001, B000, B000, B011, 1,
B000, B001, B001, B000, B000, B011, B000, B000, B110, 1,
B000, B000, B011, B000, B000, B110, B000, B100, B100, 1,
B000, B000, B110, B000, B100, B100, B100, B100, B000, 1,
B000, B100, B100, B100, B100, B000, B110, B000, B000, 1,
B100, B100, B000, B110, B000, B000, B011, B000, B000, 1,
B110, B000, B000, B011, B000, B000, B001, B001, B000, 1,

// Now, with center flashies, for flavor
B011, B000, B000, B001, B001, B000, B000, B011, B001, 1,
B001, B001, B000, B000, B001, B001, B000, B000, B011, 1,
B000, B001, B001, B000, B000, B011, B000, B010, B110, 1,
B000, B000, B011, B000, B000, B110, B000, B100, B100, 1,
B000, B000, B110, B000, B100, B100, B100, B110, B000, 1,
B000, B100, B100, B100, B100, B000, B110, B000, B000, 1,
B100, B100, B000, B110, B000, B000, B011, B010, B000, 1,
B110, B000, B000, B011, B000, B000, B001, B001, B000, 1,
B011, B000, B000, B001, B011, B000, B000, B001, B001, 1,
B001, B001, B000, B000, B001, B001, B000, B000, B011, 1,
B000, B001, B001, B000, B010, B011, B000, B000, B110, 1,
B000, B000, B011, B000, B000, B110, B000, B100, B100, 1,
B000, B000, B110, B000, B110, B100, B100, B100, B000, 1,
B000, B100, B100, B100, B100, B000, B110, B000, B000, 1,
B100, B100, B000, B110, B010, B000, B011, B000, B000, 1,
B110, B000, B000, B011, B000, B000, B001, B001, B000, 1,
B011, B010, B000, B001, B001, B000, B000, B001, B001, 1,
B001, B001, B000, B000, B001, B001, B000, B000, B011, 1,
B000, B011, B001, B000, B000, B011, B000, B000, B110, 1,
B000, B000, B011, B000, B000, B110, B000, B100, B100, 1,
B000, B010, B110, B000, B100, B100, B100, B100, B000, 1,
B000, B100, B100, B100, B100, B000, B110, B000, B000, 1,
B100, B110, B000, B110, B000, B000, B011, B000, B000, 1,
B110, B000, B000, B011, B000, B000, B001, B001, B000, 1,

// Wrapping up
B001, B001, B000, B000, B001, B001, B000, B000, B001, 1,
B001, B001, B000, B000, B001, B001, B000, B000, B001, 1,
B000, B001, B001, B000, B000, B001, B000, B000, B001, 1,
B000, B000, B001, B000, B000, B001, B000, B000, B001, 1,
B000, B000, B000, B000, B000, B001, B000, B000, B001, 1,
B000, B000, B000, B000, B000, B000, B000, B000, B001, 5,
B000, B000, B000, B000, B000, B000, B000, B000, B000, 3,
B000, B000, B000, B000, B000, B000, B000, B000, B001, 5,
B000, B000, B000, B000, B000, B000, B000, B000, B000, 3,
B000, B000, B000, B000, B000, B000, B000, B000, B001, 5,
B000, B000, B000, B000, B000, B000, B000, B000, B000, 3,

// this is a dummy element for end of table (duration=0)
B000, B000, B000, B000, B000, B000, B000, B000, B000, 0
};

/*
** Defining pins in array makes it easier to rearrange how cube is wired
** Adjust numbers here until LEDs flash in order - L to R, T to B
** Note that analog inputs 0-5 are also digital outputs 14-19!
** Pin DigitalOut0 (serial RX) and AnalogIn5 are left open for future apps
*/

int LEDPin[] = {16, 3, 1, 15, 4, 6, 14, 5, 7};
int PlanePin[] = {19, 18, 17};

// initialization
void setup()
{
int pin; // loop counter
// set up LED pins as output (active HIGH)
for (pin=0; pin<PLANESIZE; pin++) {
pinMode( LEDPin[pin], OUTPUT );
}
// set up plane pins as outputs (active LOW)
for (pin=0; pin<CUBESIZE; pin++) {
pinMode( PlanePin[pin], OUTPUT );
}
}

// display pattern in table until DisplayTime is zero (then repeat)
void loop()
{
// declare variables
byte PatternBuf[PLANESIZE]; // saves current pattern from PatternTable
int PatternIdx;
byte DisplayTime; // time*100ms to display pattern
unsigned long EndTime;
int plane; // loop counter for cube refresh
int patbufidx; // indexes which byte from pattern buffer
int ledrow; // counts LEDs in refresh loop
int ledcol; // counts LEDs in refresh loop
int ledpin; // counts LEDs in refresh loop

// Initialize PatternIdx to beginning of pattern table
PatternIdx = 0;
// loop over entries in pattern table - while DisplayTime>0
do {
// read pattern from PROGMEM and save in array
memcpy_P( PatternBuf, PatternTable+PatternIdx, PLANESIZE );
PatternIdx += PLANESIZE;
// read DisplayTime from PROGMEM and increment index
DisplayTime = pgm_read_byte_near( PatternTable + PatternIdx++ );
// compute EndTime from current time (ms) and DisplayTime
EndTime = millis() + ((unsigned long) DisplayTime) * TIMECONST;

// loop while DisplayTime>0 and current time < EndTime
while ( millis() < EndTime ) {
patbufidx = 0; // reset index counter to beginning of buffer
// loop over planes
for (plane=0; plane<CUBESIZE; plane++) {
// turn previous plane off
if (plane==0) {
digitalWrite( PlanePin[CUBESIZE-1], HIGH );
} else {
digitalWrite( PlanePin[plane-1], HIGH );
}

// load current plane pattern data into ports
ledpin = 0;
for (ledrow=0; ledrow<CUBESIZE; ledrow++) {
for (ledcol=0; ledcol<CUBESIZE; ledcol++) {
digitalWrite( LEDPin[ledpin++], PatternBuf[patbufidx] & (1 << ledcol) );
}
patbufidx++;
}

// turn current plane on
digitalWrite( PlanePin[plane], LOW );
// delay PLANETIME us
delayMicroseconds( PLANETIME );
} // for plane
} // while <EndTime
} while (DisplayTime > 0); // read patterns until time=0 which signals end
}
{ 6 comments& read them below or add one }

Step 6: Connecting All of the Pins

K get some wire and you set to go.

Connect the first one all the way on the top left to analog 2 on the arduino board.
number 2 anode to digital 3
number 3 anode to digital 1
number 4 anode to analog 1
number 5 anode to digital 4
number 6 anode to digital 6
number 7 anode to analog o
number 8 anode to digital 5
and number 9 anode to digital 7

then connect the top to bottom wires in this order analog 3, 4, 5.

Step 7: Turn It on and Set It to Some Music!

Your done plug it in and it will light up! Yeah what an accomplishment! WOW!

Finally find a good song and play it turn all of the lights off so its dark and watch your creation light up!!!
IT WORKS!!!! muhuhahaha. Hey man thanks a million for puttting out this how to! I thought I was working on a disaster but I am looking at it right now run through all of its programs and it is just beautiful. clap calp my friend!
Awesome project! You can almost 'see' in a way what the code is going to do if you scroll down through the 1's and 0's and look at the pattern they make as they go past :P
<em><strong>Thanks man</strong></em>, me and my buddy here in israel built two led cubes with your help.<br /> we appreciate your hard work of writing this tutorial thanks alot.<br /> <br />
Im confused about several things. Mainly, isn't the max current for each digital i/o pin 40mA? So isn't there a maximum of 3 leds connected in parallel to each pin at a time? And, doesn't each led require around 3.6V for blue or green, and lowed for red, so aren't resistors needed for each layer connection? And, I made my cube of LEDs using these: http://ledshoppe.com/Product/led/LE1003.htm which draw 30mA, 70mA peak, so wouldn't three of those all on at one time blow out something? I made my cube of LEDs, but i'm too worried to wire them to the arduino. Help would be appreciated.
I thought only one led was lit at a time...by using POV( persistence of vision) to appear that many are lit
Thanks Mark. Yes, this post is a few years old. I learned a lot since then. :)
Can i do this for a 4*4*4 led cube?
Thanks for the code! Will this code work for the Baby Orangutan?
https://www.instructables.com/answers/Would-You-Guys-Like-a-Wireless-Power-Kit/
hey there peepz im doing this project now and i was wondering where do you actualy put the 1st pin from the led to the arduino board coz the discription here is not that clear, its a bit vauge if possible u can shed smome light on that <br /> <br /> and&nbsp; next is the 3 cathode conction, u say its conected to analog 0,1,2. but the analog 1 and 2 is used for the number 1 and 7 anode so i was wondering which one is ryt? im a bit confused here <br /> <br /> do pls. help me in those area and i hope to hear from you guys as quick as possible pls. thank you.<br />
&nbsp;this might help! I built one, got bored changing 0 and 1's to make it go! if you want to change the above code this little page i made will do it easily...&nbsp;
&nbsp;oops forgot the link<br /> www.evehosting.org/oracle/led.php
where on the arduino board should i connect the 3 catode pins?<br />
&nbsp;i know not the best instrctable ive seen and im wondering the same thing!!!!!
hey erod998<br /> <br /> i found out how to connect the 3 catode pins. they go to analog 0,1,2<br />
&nbsp;i havent tried that yet but thaanks even if it doesnt work<br /> <br /> <br />
here is the working link to the code: http://stationinthemetro.com/blog/2008/1/20/makedc-led-cube-workshop.html<br />
i built the cube and it worked perfectly<br />
I'm building 2x2x2 LED cube next weekend.. It's going to be a bit easier than 3x3x3.. And I'm gonna make my code different way; connect each LED to one pin and make the code about by modding the &quot;Blinking LED&quot;... I 'm not good at all at Arduino coding yet; I just can make some piezo buzzer sounds and making LEDs blink the way I want =)<br />
Spelling and grammar check, Get rid of that huge block of code; it doesn't work. The bloggy thing has turned the conditionals into links. The link to the original code is better. You could also offer it as a downloadable Arduino sketch.<br/><br/>It's still a helpful instructable, but you should try to explain *what* is going on (charlieplexing?) so that someone can use the knowledge to build off it. That whole teach a man to fish thing.<br/>
I'm glad you said something about the code, I down loaded it and it didn't work nor could I figure out what was going on with it. I'm new to using an Arduino and programming. I've probably been at it now for 2 or 3 weeks and it's tough as hell grasping concepts and so on, but I'm getting there slowly so I take all the advice I can get my hands on. You mention something about the original code. I checked the links and didn't really see anything I could use. I'm not even sure if it is code my Ardunio board can interrupt. I am using the software for windows which I believe is C or C++, regardless, would you know where I can obtain a down load of the code for a 3 x 3 cube in C or for the windows version of the code? Any assistance would be appreciated. Thanks,
using MY cube and Mac u did this, and i dont see any acknowledments!
Besides spelling and grammar, this was a very good instructable, I found it quite useful. Thanks for the help!
"LED backlight display"
LCD computer monitors contain cold-cathode tubes as backlights.

About This Instructable

81,807views

76favorites

License:

Bio: I'm 17. I enjoy making cool stuff, and promoting the "maker" community. Vote for my space balloon in the hurricane laser contest and hands ... More »
More by robotkid249:My Space Balloon: Project Stratohab Success!! High School Student's Budget Electricity Generating Kite! Wireless Power 
Add instructable to: