Introduction: DIY Funky Nightlight: the 4x4x4 LED Cube

This was actually an old project I did. My own version of the popular LED cube. Anyway, if you have plenty of time and you're crazy enough to do this simple-looking yet complicated nightlight project, you may choose to follow my tutorial -- but there are tons of comprehensive online LED Cube tutorials out there.


1) 64 pcs. LED (Blue) - I decided to create a 4x4x4 for the mean time because I don't quite have the budget to do anything more than the 4x4x4. 64 pieces of LEDs cost me around $8, Blue LEDs are a little expensive than Green, Red and Yellow obviously because Blue and White LEDs have more demands than the rest of available colored LEDs.

2) 64 pcs. Resistors - Although I was not able to acquire and connect resistors to my 4x4x4 LED Cube, it is advisable to connect resistor to each LED. You can use this site to compute for the resistance value. You can also use 16 resistors instead of 64 and connect them to the wires which will be directed to the I/O pins. 64 is just way too much work.

3) Arduino Duemilanove - The main brain of your nightlight. The one responsible for controlling the light sequence. You can use any model of Arduino, mainly depends on what you prefer but this is the only model of Arduino available in my place as of the moment. Moreover, when buying a microcontroller like this, it usually comes with a CD which contains your uploading software, bootstrap and driver for your MCU. However, if you didn't receive any CD, you can always download everything from the Arduino website.

4) Craft Metal Wire - If LEDs are the heart, Arduino the brain, your metal wire is like the spinal of the 4x4x4 LED cube. This metal wire is the one responsible for holding everything together and most importantly, the medium to allow current to flow to your LEDs. Try acquiring the thinnest craft metal wire in the market. As much as possible the one which is easily bendable. I got mine under $3 at Ace Hardware store.

Other Materials:

- Soldering gun/iron
- Soldering lead
- Solid wires
- Pliers and cutters
- Measuring material
- Board marker / pencil
- Illustration board
- Fine sand paper (400 grit)
- Scotch tape
- Glue gun
- Glue stick
- Screws and nuts
- Screwdrivers


1) First things first, you need to diffuse your LEDs. How would I do that? Prepare your sandpaper and LEDs. All you need to do is make the surface of your LED opaque by rubbing it against your sandpaper. Moreover, if you're not on a tight budget, you can just spray it with a white lacquer but then I'm poor so... Anyway, what's the purpose of this anyhow?

2) Getting ready to make the 4x4x4 LED cube. Prepare your craft metal wire and make a square out of it. I decided to make my LEDs 1 inch apart from one another.

3) Connect all the cathode (-) of your LEDs to the craft metal squares you just made. Be creative, make sure that the anode (+) is not touching any metal wire connecting all the cathodes of your LED. How would I determine which one is the anode and which one is the cathode? The shorter pin of your LED is the cathode (-) while the longer pin is the anode (+). Makes sense right?

4) Connecting all the 4 layers. This also mean that you would now be connecting the anode pins of your LEDs.

5) Prepare the casing for your Arduino and LED cube. Since I'm a poor, I just used illustration board as the casing for my Arduino and LED cube. I've drawn a box about 5x5x1.5 inches and punch holes for the 17 metal wire pins that I would be connecting to my Arduino.

6) Cutting your solid wires. Cut 16 red solid wires for the Vcc and 1 white solid wire for your common ground. I prefer my wirings to be color coded.

7) Connecting all the wires to your Arduino. Connecting the wires to your Arduino is kind of tricky. It mainly depends on you which I/O pins you would want to connect your LED cube to. However, Arduino Duemilanove model only has 14 I/O pins and you would be needing 16. Fortunately you could use the additional Analog pins 0-5 on your Arduino as an I/O pin so all in all you can actually use 20 I/O pins for your 4x4x4 LED cube. Take note that this tutorial is only for the 4x4x4 LED cube. If you want to make a bigger cube, you need to acquire multiplexers for additional I/O pins and for your also to individually control the sequencing of your LEDs.

8) Download and upload the codes. Now all you need to do is finished up the box casing, connect your Arduino to your computer and upload the codes.

This is a pattern I have created which is still unpolished, some patterns are still incorrect, but to understand the hexadecimal pattern, for example we have the codes below:

B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, B1111, 80,

Each B1111 corresponds to a line of LEDs in your cube "0" being "off" and "1" being "on." The last number is the time it will display that part in milliseconds.

Step 3: Final Product


As I have said in my previous post, this pattern is still unpolished, some patterns are still incorrect. Will try to correct them as soon as I have the time and will add more patterns soon.


If I have extra money, I'll be saving up and add mini mp3 recorder and player then synchronize the lights to the sound. :)


mitchell+graham made it!(author)2012-05-27

Hi i was just wondering for some more information on where to connect each wire to on the Arduino? Im a bit confused :)

vishalapr made it!(author)2011-12-30



plz help :)

Andrew_48 made it!(author)2011-12-20

Hey Great project!
I have already started making mine but i have one question
as i can see you have connected all the (--) together and that make it like you can just light up only one layer it will light all the layers but not all the leds
is there a way instead off 1 ground use 4? that way you can control each led!

Jiax made it!(author)2011-11-01

I don't get how you connect wires to arduino. My leds will just blink as random and not in order when I use the code. 'Cause I wired them up just randomly. Which ports should I be using? There is something I do wrong, but I don't know what. Please help!

redhead1856 made it!(author)2011-10-04

Hey Great job where did you get your LEDs from i'm new so I don't really know any good sites. Thanks

bkeaton made it!(author)2011-08-19

Nice job on the cube.

You can get 100 carbon film resistors for around $2.50 on eBay. Even the tighter tolerance metal films are around that price. Free shipping too.

Isn't the cube kinda bright for a night light? I built a 4x4x4 with diffused blue 5mm leds and it's really bright. I started hand sanding them, but quickly switched to my Dremel which made the job much easier. You could easily control the brightness with higher value resistors or you could cover the cube with something.

bkeaton made it!(author)2011-08-19

BTW, if you're interested in seeing my cube projects, go here

veeectorm made it!(author)2011-08-15

Question, wouldn't you need resistors for those leds instead of driving them directly from the arduino pins?

rmagtibay made it!(author)2011-08-14

Ma'am that's cool!!! hahahaha!!!

zazenergy made it!(author)2011-08-09

Nice Job!

About This Instructable




Add instructable to: