3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

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
«
  • 1.jpg
  • 1a.jpg
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 »
153 comments
1-40 of 153next »
May 12, 2012. 4:32 PMryanprocter says:
also the only jumper wires i can find are breadboard jumpers. are these ok or are these completely wrong?
May 12, 2012. 4:20 PMryanprocter says:
Hi im completely new to all of this and would like to know what board i need to buy. would this work with an arduino USB UNO?
May 1, 2012. 12:49 AMaus151 says:
I'm plugged into Pwm pins 2-10 for columns and 11-13 for levels, it looks great but not like the video. any pointers for a noob? It took 3 prototypes before i came up with a cube that was perfect. All my leds are hitting my output pins with perfect resistance.
Apr 25, 2012. 10:46 PM4eyes12 says:
Made the cube and uploaded the script, but I'm having a technical issue. My bottom center led in the cube will not function in the arduino routine, but is perfectly functional when tested with a battery... dose not seem to be a connection problem as the two leds above it still function. Any advice or ideas??
Apr 23, 2012. 8:36 PM4eyes12 says:
Forgive me if I missed something but it would be nice if you posted a picture or a list of what headers from the cube pcb are connected to which pins on the Arduino. Other than that good tutorial, thank you!
Apr 7, 2012. 1:15 PMDuncan Stewart says:
I built my cube a couple of months ago and am only now getting back to trying it out. Should I be able to upload the library and run it, or do I need to reference the library in a separate sketch?

When I try to upload the library directly, I get the following message:
avrdude: stk500_getsync(): not in sync: resp=0x00

Thanks!
Apr 15, 2012. 10:35 AMDuncan Stewart says:
Cool! It was the com port, apparently (though I also added external power AND switched USB ports, so there's a distinct lack of scientific method here.)

Thanks!

Apr 6, 2012. 12:51 PMsromero3 says:
Hello, I need help please.
In the video (which is the LED cube example) you can put only one LED on the third level, without the need to turn off the rest of the column, the second 4 of the video you can see. Is it possible with Arduino?
How I can do?
My question is because when I try to do, for example, just turn on the LED Level 2 column 4 and the LED Level 1 column 5, the LED on the level 1 column of 4 lights also because the level and column are on
Apr 8, 2012. 9:08 AMsromero3 says:
Thanks a lot, I will try to do with MUX!! Do you have pictures or more information about that?
Apr 9, 2012. 6:31 PMsromero3 says:
sorry for a new cuestion! maybe the only problem that i have is wen i try to turn of only one led when i have the rest in on!! Can you help me with your code?
Mar 31, 2012. 7:30 AMblinkyblinky says:
I lost track. which Arduino pin goes to which transistor? I did some probability and found I could have 6 different possible ways of doing it. Can you please specify?
Mar 31, 2012. 12:13 PMblinkyblinky says:
Thanks. So the top level is pin 11 is the top level, pin 12 is the middle level and pin 13 is the bottom level?
Feb 22, 2012. 9:57 PMmastercheefryu says:
Im getting some problems, the arduino 1.0 version doesnt have the sketch folder so where should i place it? directly to libraries? Im doing that but its not working. These are the probs im getting:

ledcube.cpp:1:21: error: LedCube.h: No such file or directory
ledcube.pde:-1: error: 'LedCube' does not name a type
ledcube.cpp: In function 'void loop()':
ledcube.pde:-1: error: 'cube' was not declared in this scope

Plz help me
Mar 7, 2012. 11:04 PMCloudhail says:
I unzipped it to the library folder then i unzipped it to the examples folder. in the actual arduino script editor you have to go to the sketch tab (up top) and IMPORT LIBRARY!!! select ledcube. once that is imported I went to the file tab(uptop) and loaded ledcube. with all of that done I hit upload and It works now. Does this make any sense?
Mar 8, 2012. 8:29 PMCloudhail says:
This is correct, sorry for the extra step. However the import library is a must. This will give you the error if you don't load the library. It took me a little bit to figure that out.
Mar 8, 2012. 10:07 PMCloudhail says:
Yes
Mar 9, 2012. 12:46 AMCloudhail says:
Sadly I'm still on vista (I'm a Mac) I'm using the UNO, and yes it does put the #include tag into the top of the script. It's working for me just fine. But this is the way I got it to work. I just figure if anyone was having the same problem as me I could share. Is this not supposed to happen? It may help to know that I start the editor program up without anything loaded at all. (just double click the arduino symbol icon) then I do what I mentioned before.
Mar 4, 2012. 9:20 PMstewart_14 says:
Did you ever get this fixed? im having the same problem!
Mar 4, 2012. 9:31 PMstewart_14 says:
Did you ever get this fixed? im having the same problem!
Mar 8, 2012. 2:08 PMstringstretcher says:
I'm experimenting with the routines and find that one column doesn't light up properly in the routine //columns in and out. I have been looking at the cpp file but can't find out what the problem is. Has anyone else seen this? Any ideas? The cube works perfectly otherwise and I love it! Also, the routine you supplied here is not the one featured in your vid is it? Mine doesn't follow these steps!
Mar 9, 2012. 2:05 AMstringstretcher says:
I'm sorry, but I beg to differ! My cube doesn't look like this... maybe it's the nut holding the wheel? (me)I'm wondering it there is a bracket missing, which would exclude some of the routines in my sketch. I see some of the sequences, and they should. I will post a vid link so you can have a look. We might learn something! I don't know enough yet to figure this out, hence the questions. Can you point me anywhere to learn more? Thanks for taking time to answer, this is a great little cube and I have had o much fun showing it to my friends. If anyone is interested I will post my revised code, gives a little variation to the cube's appearance.
Feb 28, 2012. 7:58 PMalsetalokin says:
I fixed even more of the software, and added a few new patterns. There does seem to be a bug, maybe in the hardware, concerning the writing of the buffer using a 128-slot byte array, or rather vector ... which winds up having some crazy values inserted in it somewhere between filling the array with all zeros and writing it to the buffer, which winds up lighting a few lights incorrectly when the buffer is written to the active pins.
The performance of the pattern select button interrupt is still a bit flaky and annoying but overall there's improvement.

http://205.196.120.174/bz76g4wwdkpg/rqi7xkzmjc0yzlg/AlsLEDCube4x4x4Bv2.zip

The other link below has been removed, and the Version 2 really is better, so if anybody actually downloaded the first version, please dump it and use V2 instead.
Thanks for a great time waster !!
--Al
Mar 7, 2012. 7:48 PMfobia says:
Finally I finished! thanks you so much for all the info in this site.
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...
Mar 7, 2012. 7:38 PMfobia says:
Hi I just finished my LED cube and I had the same problem with the LED output, it was very dim, after reading your temporary solution in this post, I by pasted the 220 transistors (there was no way I was gonna de-sodldering) and all LEDs work just fine, now my question is what kind of resistors did you used or think we should used for the next 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...
1-40 of 153next »

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!
41
Followers
5
Author:gzip