LED Cube and Arduino Lib

LED Cube and Arduino Lib
There are other Instructables about building LED cubes, this one is different for several reasons:

1. It's built with a low number of off-the-shelf components and hooks up directly to the Arduino.
2. A clear, easy to reproduce circuit diagram is provided with plenty of photos.
3. A unique approach is used for the software which makes programming the cube easier and more expressive.

Parts needed:

-   1 Perfboard
-   3 NPN Transistors (2N2222, 2N3904, BC547, etc.)
- 12 Resistors (~220 ohms and ~22k ohms)
- 13 Headers (male or female)
- 27 LEDs
- Jumper wires





 
Remove these adsRemove these ads by Signing Up
 

Step 1Prepare the LEDs

Prepare the LEDs
This step largely follows the LED Cube 4x4x4 but we'll be building a 3x3x3 cube instead. A cube of this size is about as big as it gets without introducing additional circuitry and complexity. We'll need a total of 27 LEDs that will be grouped into three sets of nine.

Each set of nine LEDs will share a common connection amongst their cathodes (negative leads). I'll refer to each of these sets as a "level". Each of the nine LEDs on a level is connected to the corresponding LED on the other two levels through their anodes (positive leads). These will be referred to as "columns". If that didn't make sense it will become self explanatory as we build the cube.

To start we'll use a drill to create a jig out of a small piece of scrap wood. The jig will hold the LEDs in place while we solder them. I decided to space the holes around 5/8 of an inch apart (~15 mm) but the exact distance isn't critical. The hole should have a tight fit around the LED since we don't want them to move around while soldering.

Once the jig is done we're going to bend the cathode of each LED in a 90 degree angle. The cathode is identifiable in three ways: 1) It's the shorter leg, 2) It's on the flat side of a round LED, 3) it's connected to the larger piece inside the LED. Make sure you bend the cathode in the same direction for all of the LEDs.

Now we're ready to begin soldering.
« Previous StepDownload PDFView All StepsNext Step »
97 comments
1-40 of 97next »
Jan 10, 2012. 9:38 AMRegulators.Mountup says:
I am very new to this whole deal, and I wanted to try this out as a first project (other than blinking LED). The construction of the cube and circuit soldering took significantly longer than I anticipated, but as I said, this is really the first time I've done anything like this, so I was learning as I went. Here are some nuggets of wisdom I picked up:

1) As suggested by the instructor, if I were to do another one of these, I would wire up the LEDs so that the cathodes are on the outside (i.e., the gnd connections that all LEDs on a single level share) and the anodes were on the inside (i.e., the + connection shared by all LEDs on a single column). I did it the opposite way, and i had to bend a lot of the leads on the columns over the LEDs below. Also, I had two rows of blue and one row of red because that's what I had on hand.

2) Definitely be careful about all of the overlapping wires connecting the resistors to the cube's columns. I didn't have electrical tape and used duct tape, which I wouldn't recommend. I'm having some problems with one particular column (#3) not lighting up, which I suspect has something to do with having several different wires overlapping it.

3) I did not have the fancy pin connectors shown in the picture, so what I did was take a bunch of rubber coated leads I had from a starter pack and pulled off one of the metal tips from the rubber gaskets on the end. I then plugged those (now female) sides of the leads onto the pins sticking up from the perf board.

4) This took me several hours to build and solder, but I was extremely happy with the sucker powering up and dancing on the first try. The sample library compiled and uploaded without error on an Arduino Uno r3 and Arduino 1.0.
Photo Jan 10, 1 46 02 AM.jpegPhoto Jan 10, 1 46 19 AM.jpegPhoto Jan 10, 2 10 06 AM.jpegPhoto Jan 10, 2 10 08 AM.jpeg
Feb 8, 2012. 2:16 PMrebelariat89 says:
i need to find out how to get the control box for the cube
Feb 6, 2012. 5:00 PMbirthur says:
hello, do not know why but this code gives me error in the arduino 1.0. Could you please help me and if you leave me a comment here would be great since I have a Blast Card with which to pay to download the file
Dec 8, 2011. 11:01 AMjlateur says:
I want to make a animation as firework for the time of the year. But i don't understand the whole script. can you help me on way? like how do i set 1 led to high etc
Feb 6, 2012. 4:57 PMbirthur says:
hello, do not know why but this code gives me error in the arduino 1.0. Could you please help me?
Jan 16, 2012. 2:20 PMstringstretcher says:
Mine works! What a cool toy. I'll be chillin' out with this for a while. Thanks for the instructable!
Jan 10, 2012. 9:49 AMRegulators.Mountup says:


Booya
Apr 28, 2010. 11:43 AMadumas says:
Hi... I just built this and have a couple of questions...  I tried using the transistors but the LED output intensity was minimal. I bypassed the transistors and when directly to the output pins (which I declared in the pde). That seemed to do the trick - now everything is brightly lit...  So my question, is why the transistors? I doesn't seem to need it... 
Secondly, how can I expand this to be 4x4, 8x8, etc.  Is your library scalable - what modifications would need to be made?  I hope you answer, I loved this project...
May 1, 2010. 6:53 AMadumas says:
Thanks for answering....

My power source is the arduino at 5v - I'm using the Modern Device board. Should I be contemplating an external power supply?

I am changing gears and will use shift registers... I want to build an 8x8x8 cube...  I now have 3x3x3 and 4x4x4 cubes working fine using your library... Which is great.

I think it would be great to have your library handle the 8x8x8.

I just finished making an acrylic template that will allow me to build a more precise cube. The wood base lent itself to errors... I used a laser cutter for the acrylic...
Jan 8, 2012. 2:57 AMjwgillon says:
I've been trying to modify the code to work on a 4x4x4 cube without any luck. Can you send me your code? If so, can you specify if you used transistors ...
Feb 24, 2011. 4:46 PM4and20chars says:
I am attempting to build a 4x4x4 and I wanted to know what were the resistors on the base of your transistors.

Also, I was not sure if I needed to change the library or not. There were some items in the example code I though to change but I am not sure. I have java experience but I am new to arduino, so understanding code is easy but understanding the arduino is harder.

Would you be willing to send me the source for your 4x4x4 so I have something to work off of? Thanks.
Jan 8, 2012. 3:02 AMjwgillon says:
Did adumas ever send you the code? If so, can you forward that when you get a chance? I made a crude version of your 3x3x3 cube --- very cool --- and just finished a much nicer looking 4x4x4 ...
Dec 7, 2011. 11:44 AMjwgillon says:
Very nice tutorial. Thanks!
LedCube3x3x3.jpg
Dec 7, 2011. 3:14 PMjlateur says:
I get compile errors...
i use the latest arduino software. its the same as andray.
What version do you use Jwgillon?
Dec 7, 2011. 3:23 PMjlateur says:
problem found. thx. change WProgram.h to Arduino.h. its work perfectly
Feb 14, 2010. 8:22 PMandraiy says:
 is there meant to be a "WProgram.h" file? because its #included but its not in your library as far as i can see. i also get the error: 'byte' does not name a type when i compile your code. any help is appreciated
Dec 6, 2011. 10:02 PMjwgillon says:
For latest arduino software you need to replace "wprogram.h " with "Arduino.h" in the LedCube.cpp and LedCube.h files.

See this http://arduino.cc/forum/index.php?topic=81078.0 for more information.
Nov 27, 2011. 10:42 AMdaniedb says:
Hi
I've build this cube Will this code work on ARduino Uno. Getting a Bunch of Compile errors
Thanks for sharing
Danie
Nov 6, 2011. 3:43 PMtheAVRdude says:
movie
Nov 6, 2011. 3:32 PMtheAVRdude says:
Will this work?
sorry i dont want to wast your time, just trying to figure things out.
YUL_5173.JPG
Nov 6, 2011. 12:57 PMtheAVRdude says:
tHats so cool, made mine this weekend and it works! Very Happy about your ible,nice and simple.
I used female headers so I could use the jumper wire I had.
Heres a pic

I would kill to get some more code, effects for my cube but I just can't get my head to figure out how to do this...

anyway, thanks

Eric
Nov 6, 2011. 3:25 PMtheAVRdude says:
Can someone explain to me how to upload pics and vids??

Thanks
http://img.instructables.com/files/deriv/F01/I0OW/GUOAEGJA/F01I0OWGUOAEGJA.SQUARE.jpg

that was a try...
Oct 22, 2011. 5:55 AMmbaviskar says:
Hi when i compile the code' Led has not declared 'come what should i do in this case please help me
Sep 30, 2011. 3:14 PMfdratwa says:
It's possible to build it with out the Arduino and the 13 headers?
Sep 16, 2011. 3:45 PMMudbud says:
I flipped the anode in and dude... HUGE MESS.... Like, it wasn't a cube shape lol. Don't try it..
Sep 15, 2011. 1:55 PMMudbud says:
Will this work with the BS2?... Well I will find out anyway :P
Sep 16, 2011. 3:40 PMMudbud says:
Works AWESOME!! woot thanks man! Will post pics later..
Sep 6, 2011. 8:17 PMaxeman911 says:
Thanx so much in all the other other instructibles they make it really confusing on the build of the cube. Ur's is s simple! :)
Aug 27, 2011. 11:58 PMraymondlowe says:
Short vid to show that it came out nice.

Thanks again for the great instructions.

Jul 28, 2011. 6:42 AMraymondlowe says:
Thanks, I just finished building this with my son and it came out great.
Jul 26, 2011. 5:10 PMccardenas2 says:
I have already created my LED cube but do not know how or what program you are admitted to the instructions to arduino
Jul 26, 2011. 8:06 AMBlackice504 says:
Hi mate nice job, but if all the transitors are connecting the levels or rows to ground why not use just 3 transistors or even having said that do the calculations for the total current and have 1 resistor to ground on the trasistor because no matter what all current must flow to ground via the transistor?
yes the value would be higher then what you are using i.e 1 watt but i think that may work but i could be wrong anyway i have nearly finished my own so i will try this with a 50 Ohm POT, anyway thanks for your help.
Jun 17, 2011. 8:01 PMTesla-inc says:
can this be done with an Arduino uno
Jul 5, 2011. 2:44 AMnwebster4 says:
Yes it can be done with the arduino uno , why? Because all arduinos have the exact same pinout, even the mega, although the mega has the same pinout it's extended with a lot more pins. So you would be able to do it, and it will work with the same code and lib, I should know... I've got the Uno too :)
1-40 of 97next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
31
Followers
4
Author:gzip