Instructables
Picture of 4x4x4 RGB LED Cube
P1020672 b.jpg
P1020669 B.jpg
P1020682 b.jpg
P1020625.JPG
P1020676 b.jpg
A while ago, when I first started using Arduino, my first project was a 4x4x4 LED cube, I built it from a Guide I found here in Instructables, I didn't know anything about programming, and little about electronics, yet I was able to build it and make it work, I didn't know how it worked but it did!
That success made me like this page a lot and also made me want to make guides like that one, well documented and properly explained, enabling people to make cool things, at first without them knowing how they work, and from there, from a working piece, start learning and understanding how it works.












note: the last 2 videos are not from my cube, but it works in the same way and gives the same result.
 
Remove these adsRemove these ads by Signing Up

Step 1: Materials

Picture of Materials
For the most basic cube you will need;
  • 1x Atmega328 (With arduino Optiboot bootloader)
  • 3x TLC5940
  • 4x P-Channel MOSFETs
  • 3x 4K7 Resistors
  • 3x 16 pin Male and Female headers
  • 1x 4 pin Male and female header
  • 1x 28pin IC socket
  • 1x 1000uf 10v capacitor
  • 1x 0.1 uf ceramic capacitor
  • 2x 22pf capacitors
  • 1x 16Mhz crystal oscillator
  • 64x RGB common ANODE LEDs (it is very important that you check your LEDs are common ANODE, or else, the cube won't work!!)
  • a LOT of Solder!

for more advanced functions;
  • 3x 8k2 resistors for optional, low power mode.
  • 3x 3pin male headers for jumper selection of the power mode
  • 3x jumpers for selecting the power usage/brightness setting
  • 2 x 64KB EEPROMs for storing custom animations
  • 1x DIP switch for selecting different modes (random, serial, music responsive, random2, custom animations, etc.)
  • 2x MSGEQ7 chips for audio analyzing and music response.
  • Black paint

Tools;
  • An Arduino to use as a USB to Serial converter for programming
  • An USBTinyISP if your Atmega chip is not pre-Bootloaded
  • A Multimeter for troubleshooting and checking connections
  • Some way of cutting PCBs, I used a Circular Saw, but you can use whatever you have in hand.
  • Diagonal cutters
  • A Sharpie or any kind of marker
  • A Drill/Drillpress
  • A Cutter or Xacto knife
1-40 of 105Next »
bill37808 months ago

Hello to those out there that built this cube and only got some of the layers to light,

My build of the 4x4x4 cube only got 3 layers to light up. After checking all the connections, i then started to look at the code. I started playing around with the pin number that are set for the PinMode command. Here is the code that i was looking at. It is in the RGB_4x4x4_LED_Cube_main_1 at the beginning:

#define LayerOne 16

#define LayerTwo 4

#define LayerThree 2

#define LayerFour 15

So, i changed the number for LayerFour from 15 to 17, and presto magic, all 4 layers are lighting up.

Hi bill3780,

How did you figure
out the value of 17 instead of 15? I have similar issue with my cube. I
run the main code and my 4th layer isn't lighting up or only very
faintly. If I run the mapping code, then it lights up very well... I
tried with 17 instead of 15 but then another layer stopped lighting... so
it must be related to this but I am not sure... I take that 2 and 4 are the
digital pins 2 (PD2) and 4 (PD4) on the ATMega chip and they actually match the layers associated with
them... but I used A1 (PC1) and A2 (PC2) for the other layers on a ProMini and I am not sure how they relate to 14 and 15 (or 17).

Thank you

stewe9512 months ago

Would this work with an Arduino MEGA 2560? Please relpy

mbrotcke2 months ago
mbrotcke made it!4 months ago

Here is an updated schematic. with the MSEGQ7 chip added in, and a rest circut for those with out an auto rest programer.

I'm not sure how to code the MSEGQ7 in to this cube, so any help would be great!

4x4x4-light-cube (1).pngIMAG0468.jpg
stucks mbrotcke4 months ago

I plan on building this myself. I'll probably start writing the code while I'm waiting for the parts. I have used the MSEGQ7 chip in many projects so I'll be happy to share what I come up with. One question: where did you source the uninsulated wire that supports the structure? Also, what LEDs did you use?

mbrotcke stucks3 months ago

Also, GreatscottLabs built one very similar. http://bit.ly/1vUOasm . His code also works with basic changes. BUT i like This code better.

mbrotcke stucks3 months ago

That would be great! I used 18 gauge Bus wire. but it was a PAIN to fit through bread board, had to dremmel an angle on each wire. I will use 20 or 22 gauge next time i built it, BUT the 18 Gauge makes it super strong.

I used CLEAR common ANODE LED's, from ebay... http://bit.ly/1vUMX4h

Hope to see your code soon. I had to make a few changes to his code to make it work with the way its wired up, all of which i found in these comments. I can send you what i have if needed.

mbrotcke4 months ago

Have my Cube built and Atmega programed. It turns on with the Main code and starts to run, But the LED's are Dim and each color flickers as it's fading in and out. as if it's to low on power. After a minute the top layer goes on solid and the rest turns off (like the chip locked up)

I am using a 5v 2A power suply, have tried two of them.

Any suggestions? I have looked for shorts, and test connections

Thank you...

mbrotcke mbrotcke4 months ago

So I have determined the flickering is part of the PWM used for fading by the 5940's. i wonder if there is a way to turn that up so it's not so noticeable.

Also the cube seams to work fine via USB power from my PC.. so it's just my larger power supplies that cause issue!

http://youtu.be/zscuqmPN3rM

mbrotcke4 months ago

I made a full schematic of the "Basic cube" So you don't have to go back and forth. I

4x4x4-light-cube.png

Thanx dude :) Thats what I´ve been waiting for a long time :D

sinaarian7 months ago

Can someone send me the file that is working on a cube. my cube is built but i cant find a code that works with out any errors? The one in this instructable is having a lot of errors and anything with the TLC5940 name is a error or "not decleared in this scope" . CAN SOMEONE PLEASE SEND ME A WORKING CODE. I NEED HELP

ethoxx sinaarian4 months ago

If you didnt solve it by yourself: The code is working, you just dont have the tlc5940.h in your Arduino library folder. Download it here: https://code.google.com/p/tlc5940arduino/

rover87725 months ago

Hi , I build your cube on a breadboard (the electronics, not the cube ...). If you connect the red leads to the first tlc, the green to the second and the blue to the third, with ,starting from left to right on the first row of led's, right to left on the second row, left to right on the third row and finally right to left on the last row, then you can map your leds from 0 to 47...hope this make sense...

mzak28 months ago

How are the mosfets suposed to be wired? I have the layer pin to the leftmost pin center pin goes to actual layer and third pin with 2k resistor to 5v

bill3780 mzak28 months ago

The leftmost pin comes from the ATMEGA328P chip, The center pin goes to the layer and the left pin you have described correctly.

bill3780 bill37807 months ago

correction

and the rightmost (3rd) pin you have described correctly.

mzak2 mzak28 months ago

I can't seem to be able to have different layers on at the same time.

Any advice?

bill3780 mzak28 months ago

Which program are you running? RGB_4x4x4_LED_Cube_main_1 is the program that will light up all layers. If you are running RGB_4x4x4_LED_Cube_map_1 then only 1 layer will light up. This is the program that you use to find out the sequence of the LED lights, so that you can reprogram RGB_4x4x4_LED_Cube_main_1.

AlejandraG8 months ago

Hello! I need some help, i've been looking for the zip file which contains the code but I can't find it anywhere, could anyone email me the code? i'll be very thankful.

jimmy6199 months ago
Hi there! :) Could someone please explain me the code.Also I'll be very thankful, if someone could email the whole code . It's very important because i'm building a 5x5x5 rgb led cube for my project in college. Please reply as soon as possible.
Thanks in advance ! :)

cammace jimmy6198 months ago

hey jimmy, I've spent sometime working on this cube and can tell you a bit about the code. First off, the code is actually posted in a zip file within the instructions but you will also need to download the TLC5940 header which can be found here: https://code.google.com/p/tlc5940arduino/ . you'll have to place the file within your libraries folder in arduino. Once you have this all you have to do is redefine some of the pins on both the arduino and the TLC's. It's a similiar process described within the instructions. Honestly, once you get a good grasp of what your doing you can rewrite some of the code and take out a lot of it to make things simpler. Another important thing to do within the TLC header is to change the number of TLC's in your circuit. this function can be found within a file called something like "config.tlc". I hope this helps you out a bit, feel free to contact me if I didn't answer something.

sinaarian cammace8 months ago

i went to the link but i don't know what to go to get the code. can you help me , i just got done with the cude.

Hi cammace, I am building the led cube but I can't find the zip file within the instructions, could you be able to email me the code? I would be very thankful.

Hello cammace, i've been looking for the zip file within the instructions but I can't find the code, could you be able to email me the zip? I would be very thankful :)

sinaarian8 months ago

Every time I try to upload the code I get all of these random undefined for things like TLC and PD4. Can someone help me to get the code figured out. Thanks in advance

You need to download the TLC5940 header file. That should resolve your TLC errors. See the comments below by cammace and where the file is. What kind of errors are you getting from PD4?

Anything with a TLC in front of it is counted as not declared

mzak28 months ago

So i have everything working now based off of the arduino alone. Way less parts! So i have the layers mapped out, i have all of the pins mapped out, but when i program the cube to only turn on certain lights from the top layer, i get "ghosting" and all the lights below the ones i wish to turn on turn on as well. so if i only want the top left light closest to me to be on, i get the entire column lit up. Anyone else have any insight?

image201404170001.jpg
mzak28 months ago
Hey there,
I'm trying to get this together but was wondering a couple of things. First how is it powered? Second, can this be made from the arduino directly sans the atmega? Third, how do you connect the 1000uf capacitors? From what vcc?
GranpaO448 months ago

In your instructions, you say to use Common Anode RGB LED's The long lead on them are the "+" lead. On page 6 of the instructions, you state that the long lead of the RGB is the "-" negative lead. That would make the LED Common Cathode.

Was that a wrong statement on page 6?

bill37809 months ago

Howdy, great job on the article to build the 4X4X4 LED cube. I just finished building the cube and started to test it out. Got the top three layers to light up and trying to figure out about the bottom layer (#4). The code in RGB_4x4x4_LED_Cube_Main_1 object has these lines of code that i'm not sure what it means:

#define LayerOne 16

#define LayerTwo 4

#define LayerThree 2

#define LayerFour 15

Just want to understand more about the code. Are the numbers referring to pins? on which chip?

Thanks

cammace bill37809 months ago

I'm having the exact same problem as you. What MOSFETs did you use?

bill3780 cammace8 months ago

I used IRF9540N MOSFETs.

mbrotcke9 months ago

Which MOSFET p-channel transisters do we need to use for this?

lgruen made it!10 months ago

Awesome tutorial! Had lots of fun building this.

Small error here: "3. Start bending the leads (the Rightmost lead goes to the bottom left at about 45 degrees) (pic 3)." should be "goes to the bottom right".

I've placed my MOSFETs very close to each other, similar as in your photo. However, after some debugging I found out that they'll actually short if their heat sinks touch (which in my case only happened when putting the PCB layers together ;) ). It would be nice to mention to be careful about this.

Some guidance about the power supply would be nice. I guess in practice a 5V / 2A wall wart is good? Batteries deplete amazingly quickly with this :).

led-cube.jpgIMG_6257.jpg
msadeghlou11 months ago

hi tanks for your guidance, I have a problem with your design, according to your circuit when we set the red pin in a column we set it in all of it and we can't have different color in a column.

sorry for my bad english

tomriddl311 months ago
how hard would it be to adapt this to use common cathode LED's?? any help would be appreciated :-P
Steve25 tomriddl311 months ago
Wow i bought cathode leds too :(
1-40 of 105Next »