Intro: LED Color Changing Desk Cube
I found a cool Instructable by AlexTheGreat about making an LED cube. Here is the link.
I decided to give it a try, and I wound up adding some extra circuity to make the LED change colors.
The result is a cool looking desk toy that I am very proud of.
Step 1: Creating the Box
I bought some thin acrylic sheets and cut out 5 squares. Then I hot glued them into the shape of a cube. After letting the glue dry, I sanded all of the sides with a mini-sandblaster. This helps to diffuse the light from the LED. Sandpaper would work as well.
Step 2: Adding the Metal Designs
Using inspiration from AlexTheGreat's instructable, I cut out some shapes out of sheet metal to hot glue onto the cube. After experimenting, I figured out the easiest way to do this.
Start by cutting out five sheet metal squares the same size as the sides of the cube. Mine was 3x3". Next, use a ruler and trace out your designs. Then cut them out with some metal sheers. Rounded shapes and curves are very difficult to make with sheers, so keep this in mind if you decide to make it.
I decided to make the corners one piece to avoid any inconsistencies. It took some trial and error with cutting and folding, but the end result looks slick. Next, hot glue the metal designs onto the cube.
This process took the longest, just be patient and make careful cuts.
Step 3: Electronics
The LED I used for this project is an RGB all-in-one LED. There are four leads on the diode: negative, red, green, and blue. By varying the amount of voltage to each pin, you can change the color to anything you want. To help diffuse the LED, just sand it lightly with some sand paper.
The output pins of an Arduino have 255 voltage levels. By varying the voltage (between 1 and 255) to each color lead on the LED, you can control the color.
Instead of using an entire Arduino Uno for this project, I opted to use the ATTiny85 IC. It's a much simpler and smaller version of the IC found on the Uno, and it is very cheap. Programming the ATTiny is extremely easy as well, but you need an Uno to do it. It involves downloading a library to the software, and connecting the ATTiny to the Uno with a few wires and capacitor (to prevent resetting). If you'd like to figure out how to do this, just search "Shrinkify Arduino" in YouTube. There are several good videos describing the process.
The only parts I used in this build were three resistors, an ATTiny, an RGB LED, a switch, and a battery. I could have designed and ordered a PCB for this build, but the circuit was so simple that it was not worth the effort.
Step 4: Software
The software is simple as well. By changing one parameter in the "setup" part of the code, you can control the length of time before the color changes.
I wrote some code to have the color fade from one to the next too, but I like the simple color change better. If you want to see the fade code just let me know. It involves creating arrays and incrementing them inside of a loop.
NOTE: I changed the hexidecimal color codes within the Arduino software files to give the IDE a "dark" theme. I can't stand coding on a white background.