Intro: 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.
Step 1: WHAT YOU NEED?
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.
- 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
Step 2: LET'S START WITH OUR FUNKY NIGHT LIGHT!
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. :)