LED Cube with Arduino and custom PCB

 by ajmontag
This instructable details the design and building process for a 5 x 5 x 5 LED cube, controlled with an Arduino, which resides on a custom printed circuit board. 

Additional information, photos, and videos can be found on my website.

The finished product is shown in the video below:

 
 
Remove these adsRemove these ads by Signing Up

Step 1: Design concept and materials

I have seen many designs for LED Cubes, and they all share the same problem:  How to control so many LEDs with so few pins.  Many designers choose to utilize shift registers, which uses a serial load with parallel output.  I was not to fond of this idea, primarily because of the time needed to shift all bits and the possible resulting trailing effect, so I started from my own drawing board, see attached.   

My design uses 5 x 3-8 line decoders (also known as DEMUX) to convert a 5-bit parallel binary output to a one-hot 25-bit parallel output, which drives the columns of LEDs.  "One-Hot" means that only one of the 25 output pins will be "hot" at any given moment.  If the five output pins of the arduino are: 01010, this is the number 10 in binary.  The decoders take interpret this signal and in turn power on output pin number 10 of the 25 columns (numbered 0-24).  See the attached design for illustration.

As many other LED cubes do, my design also uses NPN transistors to switch the cathodes of each plane of the cube.

My design also includes a custom designed Printed Circuit Board, to eliminate the many unsightly wires that would otherwise be needed.    

Materials:

Part No.          Description                          Vendor             Quantity     Each        Total
74HC238       3-8 Decoder                        eBay                  5                $0.70        $3.50
LED                5mm Diffused Blue LED   eBay                 125            $0.09         $11.25
RES               150 Ohm Resistor                                         30              $0.05        $1.50
2N4401         NPN Transistor                    RadioShack    5                $0.20        $1.00
POT               10k Ohm Trim-Pot                RadioShack   1                 $1.49        $1.49
Arduino         Arduino                                   SparkFun        1                 $30.00      $30.00
PCB               PCB + Shipping                    AdvancedCircuits 1          $51.42      $51.42

Grand Total: $100.16

Second Thoughts:  Be sure to get one-HOT decoders, many will have every output high, but the one selected output LOW.  This is the opposite of what we want here.  Be CERTAIN to check the truth table in the  data sheet of whatever chip you purchase. 
 
ajmontag (author) in reply to mstoetz1Jan 19, 2011. 10:46 AM
Yes the gerber files are correct.

The issue was that the selection jumper (the 5x2 male header block) had one side connected to VCC, but this has been changed to GND.

The reason this was an issue is that with no reference voltage, the read value of the pin is useless.

The fix is to enable the internal pullup resistors, which will set the (unconnected) pin to high. Then by jumping this to GND, the pin will go LOW. Thus making these selection pins usable.

Let me knw if you have any more questions,

-Andrew
mstoetz1 in reply to ajmontagJan 19, 2011. 11:09 AM
Great.. thanks Andrew.

I actually had 10 boards being made because the place I am getting them from, changes the price from around $33 (if I only get 3) to $13 per board (if I get 10).

I may have some extras that I may offer up at cost if anyone is interested. But I'll know for sure when they arrive.
Geekaton says: Mar 7, 2013. 10:42 AM
hi
i am 15 and have made my own LED cube, heres a video of how I made it: http://www.youtube.com/watch?v=gTZJOy70rrc&list=LL7RW6Py5QalcKDnSCnX9_Dw
let me know if its helpful!
AmalZone says: Feb 27, 2013. 2:21 AM
Dear Sir,

We are a marketing company in Saudi Arabia . We are interested in buying a customized LED cube for a project that we are handling now. The LED has to be one meter in length and one meter in depth and 2.5 meters in height.

Please let us know if it is possible to build it and give us a quotation on that.

Regards,
Amal Alsayegh
Marketing and PR rep.
Zone Arabia

amal@arabiczonesa.com
ajmontag (author) in reply to AmalZoneFeb 27, 2013. 10:42 AM
Thank you for the offer, but I am not interested at this time. There are many others online who have made a similar device that you can ask.
yonch says: Aug 26, 2012. 12:43 PM
Can it work with Arduino Uno?
ajmontag (author) in reply to yonchAug 26, 2012. 6:40 PM
yes, they should be pin-compatible.
yonch says: Jul 21, 2012. 11:14 AM
I think I did it wrong. Is the power to the LED's coming from the column or plane? I connected the short pin of the led to the plane and the long to the column.
ajmontag (author) in reply to yonchJul 31, 2012. 5:05 PM
Each plane is for negative, each column is for positive.
yonch in reply to ajmontagAug 12, 2012. 1:32 AM
I'm very confused with the negative positive. According to the led pinout below, which pin is connected to the plane and which to the column?
yonch in reply to yonchAug 12, 2012. 1:35 AM
Pinout:
LED Pinout.JPG
ajmontag (author) in reply to yonchAug 12, 2012. 6:24 PM
Cathode is (-), meading the short lead is the plane.
yonch says: Jul 18, 2012. 12:13 PM
What wire is used to build the columns?
ajmontag (author) in reply to yonchJul 18, 2012. 4:52 PM
This is the wire that I used:
https://picasaweb.google.com/lh/photo/BzxnN5Km48B30_egfA262dMTjNZETYmyPJy0liipFm0?feat=directlink
yonch says: Jul 13, 2012. 9:11 AM
Can someone PLEASE explain how the LED's are wired, to one another and to the circuit? Are all the cathodes connected? Where are the anodes connected?
ajmontag (author) in reply to yonchJul 13, 2012. 4:05 PM
Each column has a common anode (positive), and each level or plane has a common cathode (negative).
yonch in reply to ajmontagJul 14, 2012. 11:19 AM
But then if I want to turn on two LED's not on the same level or column, for example (2,3,4) and (2,1,3), two more LED's will glow.
ajmontag (author) in reply to yonchJul 14, 2012. 12:40 PM
Yes, you are correct. That is why we only ever light up one LED at a time, but we just cycle through them really fast (a few micro seconds). It gives the illusion that they are lit simultaneously.
purpulhaze says: Jun 16, 2012. 8:34 AM
I'm really trying to understand the wiring of the decoders to the cube but I just don't get it.
ajmontag (author) in reply to purpulhazeJul 13, 2012. 4:07 PM
each output of the decoders go to one of the columns (anodes). This supplies the current for the LEDs.
sunhmt says: Feb 14, 2012. 3:52 PM
Nice job!
I want to ask about how I can use a music to controll the CUBE like a VU meter. I need to change the arduino type?
mr_pinooo says: Jan 9, 2011. 11:18 AM
Thumbs up for this cube !!

Are there any plans of making a control program for controlling the cube live from a PC ?

Cheers.
ajmontag (author) in reply to mr_pinoooJan 10, 2011. 9:57 PM
Not in the near future, I would like to have it standalone and not connected to a PC. I could do the GUI in swing, but from previous experience, i understand that serial communication in java is unreliable... understandable.
sunhmt in reply to ajmontagFeb 12, 2012. 7:17 PM
Thankyou for the idea. I want to know how to add a audio input to this arduino.
I want to make a VU meter by 3D.
Psychojm says: Dec 3, 2011. 11:03 PM
Hi, can you please tell me just how to turn 1 random x, y, z LED
thats all I need.
Thanks
Psychojm says: Dec 2, 2011. 11:24 PM
Hi im new here, I just made this cube with 6x6x6 instead of 5 and im also new with arduino so i would like to know how to make the patterns work properly, with 6^3, and also I dont quite understand the jumpers part.
Also realy cool project ill try with a PIC later, also new on those too :)
and sorry for my bad english.

Thanks
Tuffy_DK says: Oct 16, 2011. 4:09 PM
Hi ajmontag.

I've tried to build your cube 5x5x5x by using your schematics (Cube.sch), but its not working.

I think there is something wrong with your layout (cube.sch). Can you please check it again??

Regards
Tuffy_DK
ajmontag (author) in reply to Tuffy_DKOct 16, 2011. 9:31 PM
I am quite positive the schematic is good, since I made a PCB from it and it works too. Check your wiring and let me know if you have any questions.
Tuffy_DK in reply to ajmontagOct 17, 2011. 12:49 PM
Hi ajmontag.

I've now tested all my wireing with an ohm meter and all wires are ok - I started all over on my breadboard and finished up with the same thing as yesterday... Nothing.. :-(

But then I removed the GND wireing (on pin 4 and 5) from the 74HC238 (V1 to V5) and then it seems to work (LEDS are flashing on and off).

Is it a mistake to wire pin 4 and 5 to GND???

Kindly Regards
Frank

ajmontag (author) in reply to Tuffy_DKOct 17, 2011. 9:16 PM
That should not be the problem, If you have checked everything over I would pull everything off the breadboard and start over. You could also unit test a single decoder (74-238) to make sure that is working properly
Tuffy_DK in reply to ajmontagOct 17, 2011. 3:07 AM
Hi ajmontag.

I'll check all my wiring, and get back to you.. Perhaps there are one broken wire (on the breadboard)...

Regards

Tuffy_DK
Blackice504 says: Aug 20, 2011. 5:39 AM
Nice PCB neat layout and simple to follow and the idea of mounting the arduino on brilliant but it would be nice to have a option just to mount the chip on.

are you doing any work on RGB led cube?
ajmontag (author) in reply to Blackice504Aug 20, 2011. 9:42 AM
Indeed, I have since been working on a different project with a standalone micro-controller; at the time i was not comfortable with this. It would be a simple change to the PCB.

I have not done any work with RGB, but hope to with time.
jlenert says: Jun 16, 2011. 8:49 AM
Awesome instructable!

Wondering how you calculated your transistor base resistor to be 130 ?
ajmontag (author) in reply to jlenertJun 16, 2011. 3:38 PM
I just used what I had, its just that a short does not work
mstoetz1 says: Feb 10, 2011. 4:17 PM
I'm willing to depart with 5 or 6 of the PCB's I got made. The cost ended up being $206.08 ($15.50 + $29 shipping + $22.08 taxes x 10 boards) for me to get them.

The choices I had at order time was around 12 with 10 day turn around, or 15.50 with 6 day turn around. I would have been good with the 10 day, except the place I ordered from (Ottawa Canada) celebrated Chinese New Year and shut down for 10 days over that time, so I decided to do the $155.00 / 10 board plan.

I have Andrew to thank for providing this instructable, and the gerber files. He did all the work.. thank you Andrew!! PS: your name is on my boards, so you're going to be famous ;)

I've attached a pic of the one I've started. To be honest, I sort of "whipped it together". The next one I think I'll spend more time making the cube perfectly straight.


seatra in reply to mstoetz1Mar 22, 2011. 6:59 AM
Do you still have any boards left for sale? If so, are the jumpers corrected (to GND)? Thanks.
mstoetz1 in reply to seatraMar 22, 2011. 7:08 AM
I'm not actually using the jumpers... we're just changing the code.

Btw... if anyone has done some additional code, let me know. I'll share what we've done.
mstoetz1 in reply to seatraMar 22, 2011. 7:07 AM
Hi, yes.. I built three cubes.. I may do one more using different LED's.. so I'll have 6 boards left if you or anyone wants them. (at cost).
seatra in reply to mstoetz1Mar 22, 2011. 7:46 AM
I am interested in one. Email me at seatra@gmail.com with the details. Thanks.
mstoetz1 in reply to mstoetz1Feb 10, 2011. 4:20 PM
Here is the board so far... I am waiting on the resistors still though.
ledcube1.JPG
mstoetz1 in reply to mstoetz1Feb 22, 2011. 5:56 AM
We've had the cube up and running now, and since my room mate is much better at c++, she's working the code to do some different patterns.

She seems to be catching on fast, and the only issue we've noticed is with "some" patterns, some incorrect LED's are very dim, but being lit. Its a bit weird in that if you light a vertical set of 25 LED's and go left to right, it works fine, but up and down had a this issue.

We can share the code of different patterns with anyone who is willing to work together in coming up with some cool patterns.

mstoetz1 in reply to mstoetz1Mar 13, 2011. 6:07 PM
These are some examples of how I created loops for the LED leads that helped with the soldering. The first LED cube I did not using these loops was much more difficult and took longer.
LEDPrep1.JPGOneLayerDone.JPG
lostalaska in reply to mstoetz1Jun 28, 2011. 1:40 AM
I know this was posted a while ago, but still wanted to say thanks! I was wondering the same thing after doing a 3x3x3 cube where I used a jig, but soldering the levels together I ended up bending the columns a little too much and they weren't all perfectly square when I was done. This was exactly what I was looking for. I picked up some 18 gauge, 16 gauge and 14 gauge solid core wire to try and figure out what the smallest size gauge I can use and still keep a fairly rigid structure. I eventually want to get up to an 8x8x8, but not sure about the learning curve for using a different type of controller and programming it.

Gonna test it out doing a 4x4x4 cube as I also just need a lot more practice with a soldering iron and from the reading I've done so far the 4x4x4 can be done with an Arduino basically the same way I did my 3x3x3 with a few NPN transistors. I also picked up the parts for this 5x5x5 cube, but I'm a total noob to digital electronics so baby steps...

If you do end up reading this, what gauge and type of wire did you use to build the grid?
ajmontag (author) in reply to lostalaskaJun 28, 2011. 8:17 PM
If you look at step 2, you'll see that my wire was 20ga galvanized steel
lostalaska in reply to ajmontagJun 29, 2011. 9:42 AM
Ah, steel is probably the way to go, I started in last night on a 4cubed and was using 18gauge copper, which seemed to work alright, but steel would probably be less malleable and be less likely to get bent accidently. I'll have to check some hardware shops around Juneau and see what they got. One of the hardware stores is bound to have something like this.

I picked up all the parts to follow this instructables 5x5x5, but didn't want to start it until I figured out how to make a very square and properly lined up cube. With my soldering skills getting better with every attempt and using a grid system as mstoetz showed in the above post I'm pretty sure I'm close to trying a 5x5x5 cube.
mstoetz1 in reply to lostalaskaJun 28, 2011. 3:14 PM
Here is the wire I used for the LED cube. I think I purchased it from Michaels.. where you can get an assortment of craft supplies.
P1000264.JPG
lostalaska in reply to mstoetz1Jun 28, 2011. 4:57 PM
Thanks for the quick response, I'll have to swing by my towns two small craft stores and see what they have. Living up in Juneau, Alaska my local options are _very_ limited. The heaver gauge solid wire I picked up had a plastic sheath on it and I found it at a boat shop in the wiring section, so I was trying to figure out a way to strip off all of it without gouging the copper horribly.

I ordered 200 diffused green T1 3/4 (5mm?) LED's from Jameco that I'll be using to test this grid system out with a simple 4cube this weekend after I've tinkered with the code for my current 3cube. Thanks again!
mstoetz1 in reply to lostalaskaJun 28, 2011. 5:27 PM
I bought all my LEDs from Ebay... these were the two types I used in cubes so far:


5mm straw hat Green LED Wide Angle 14000 MCD (very bright)

5mm Blue Diffused LED 5000 MCD

I paid like $15 for 300 LEDs
mstoetz1 in reply to mstoetz1Mar 22, 2011. 7:20 AM
So far I tried some really bright green LEDs, and diffused blue LEDs.

Both look pretty cool.


Here's some video samples of the code my room mate did. She is going to add more letters, and make it more organized later.

http://www.youtube.com/watch?v=Olfdz9h4c9Y


http://www.youtube.com/watch?v=N0kPb7gx8qs
ajmontag (author) in reply to mstoetz1Feb 22, 2011. 10:47 AM
That is an issue with a mismatched delay time of the NPN (cathode) switching transistors and the propagation delay of the 3-8 decoders. Have you taken any courses in digital logic design? Here is the gist:

The signal to the decoders must pass through many transistors before it comes out the other side, whereas the cathodes are on a single transistor. This _may_ be able to be fixed by adding a very minute delay between the decoder and NPN signals, But i have not tried this.

I notice this primarily on the squares animation, when there are two LEDs instead of one in the center.

-Andrew
mstoetz1 in reply to ajmontagFeb 22, 2011. 3:01 PM
Thanks for the info Andrew. we'll take a look at the timing.

Michelle
tzq33tdq says: Feb 12, 2011. 2:10 AM
this looks great! is there a way to use an arduino mini and only make it with a 4x4x4 or a 3x3x3? and did you use an arduino uno?
mstoetz1 says: Jan 19, 2011. 5:45 AM
Hey Andrew,

The Gerber files you had here work ok? I noticed some comments about some pull up resistors. Or are the gerber files accurate and tested ok?

Thanks
the seaker says: Jan 6, 2011. 8:31 AM
Hello i love the design! its amazing to see you control 125 leds with barely any pins. But i was wondering if you could give some more information about where you got all your parts or what exact parts you got. Thank you
ajmontag (author) in reply to the seakerJan 11, 2011. 6:39 PM
LED's
Decoders
Potentiometer
NPN Transistors
PCB

Did I cover it; anything else?
the seaker in reply to ajmontagJan 11, 2011. 6:45 PM
Thanks thats exactly what i was looking for, and thanks for the info!
maewert says: Jan 6, 2011. 6:45 AM
Nice Instructable.
I finished my 5x5x5 cube recently also.

In my case I used 74138's which as you noted give a HIGH output to all pins but the selected, which is opposite what we want so I included 6 hex inverters to invert the signals.  Yes, it was a pain but I could not find any 74HC238's.  Rethinking it now I believe three shift registers would have been SO much simpler in both HW and software and use fewer pins as well.

My LEDs also had very short leads so my cube came out small.  Still nice though and it fits in a nice display case. 

Also my LEDs were not diffuse.  AFTER we soldered them I heard others had diffused theirs by sanding them before they soldered the cube up.  Wished I had done that.  I'm thinking that maybe I can spray the cubes with something to frost them up a bit.

I see our software solutions are also very different.  In my design I created a 5x5 array of bytes and my pattern code sets the bits in the arrays to turn LEDs on and off.  The row scanning is managed using an interrupt driven by a timer.  This seemed like the easiest way since the pattern routines didn't have to concern themselves with scanning.  Also for speed I did not use digitalWrite but I wrote directly to the portB and portD.  I'm glad your method works well.

I like your idea of using input pins to set the pattern.  In my design I alternated the patterns every 5 seconds which is not so nice.  Could you use the digital pin's internal pull-up resistors to make the inputs work correctly on your board?

Again, nice instructable and nice cube!

Best Wishes,
Mark
ajmontag (author) in reply to maewertJan 10, 2011. 10:03 PM
Thanks for the comments! As far as internal pull-up resistors go, I believe this is done by:
pinMode(p, OUTPUT);
correct? I did this and no luck. I believe it is not working for me because when the pin is plainly disconnected, there is no voltage reference, and the pin reading is unstable.

I have not deeply researched a solution, or the internal pull-up resistors. If you have any insight on the situation feel free to share!

Also, I am currently working on a "The Matrix" (the film) like pattern!
maewert in reply to ajmontagJan 11, 2011. 8:22 AM
To use the internal pullup resistors, I believe on input pins that either get a ground when the switch is pressed (option is selected) or an open when it is not, we set the pin as an input pin and we do a digital write 'HIGH' on the pin.  Writing to an input pin sounds wrong :-) but it is how the arduino knows to activate the 20k internal pullup resistor.  This will then allow the 'open' state to be read as 'HIGH'.

Best Wishes.
Mark
ajmontag (author) in reply to maewertJan 11, 2011. 9:09 AM
Sounds promising, but the problem is that the second jumper row is connected directly to +5v, would this be able to work by:
pinMode(p, input);
digitalWrite(p, LOW);
//then a disconnected pin would read low and a jumped pin would read high

I will give your idea a shot later, thanks for the input!
maewert in reply to ajmontagJan 11, 2011. 11:07 AM
Unfortunately the chip does not have internal pulldown resistors, only pullup resistors so get your board to work youd have to cut the trace to 5v and jumper the pins to grd.  :-(
ajmontag (author) in reply to maewertJan 11, 2011. 1:45 PM
Darn, Well this was the only aspect of the project I did not prototype before the PCB manufacture. Guess I learned my lesson on that one! Thanks for your input!
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!