Introduction: Color Changing Mood Light
Get in the mood with some fairly simple ATTiny85 based homemade color shifting lamps! The code is Arduino IDE compatible for easy customization.
Step 1: Step 1: Materials
- Sheet of wood
- Wood screws
- Various hole cutter bits
- 6" Acrylic Cupcake / CAKE / Centerpiece Tube Extension (for diffusing the light)
- 2 Watt 10 Ohm Metal Film Resistor (qty 3)
- Your preference for on off switch (I used the rocker switches in the attached picture)
- ULN2003AN (High-Voltage High-Current Darlington Transistor Array)
- 3W RGB Color High Power LED Light Common Anode with 20mm Star Heatsink
- ATTiny85 (and some means of transferring a sketch to it)
- 5v 2W power supply
- Basic soldering equipment (solder, solder iron, wire cutters\strippers, etc)
- Hot glue gun
- 4 rubber feet
Step 2: Step 2: Build Your Box
You can build or buy your box as you desire. If you build your box I recommend the following dimensions.
Top and Bottom of the box should be 8x5 inches
Front and Back of the box should be 8x3 inches (Box will be 3 + 2*X inches tall where X is the width of your wood)
The two end pieces should be (5 - 2*X)x3 inches where X is the width of your wood. (the end pieces will be as wide as your bottom piece minus the width of the front and back pieces)
Sand all edges
Assemble bottom, front, back and both edge pieces and hold them together with wood screws.
Align and drill your pilot holes for the top piece to be secured later.
Pro tip (err.... amateur tip)
If your woodworking skills are as abysmal as mine you may end up with some gaps where your sides don't line up quite right. You can diguise those gaps by mixing together some of your sawdust with a little wood glue to make a paste. Fill your gaps with this paste and allow it to dry. After it is dry you can sand it smooth.
Step 3: Step 3: Prepare Your Box
Using a regular drill bit put a hole low in the back of your box where the wire from your 5v power supply to be feed into the box. Only account for the diameter of the wire and not the plug as we'll be cutting the plug off.
Use a spade bit the same size as your rocker switch to make a hole for mounting (or do whatever you need to do to mount the switch you've chosen)
Use a hole drilling bit (see picture) the same diameter as the acrylic tube to make a groove for the tube to rest in. Your LED will rest in the center of this circle. Inside this circle you'll drill four holes for you to feed wire from the electronics inside to the LED outside.
Once everything is drilled and sanded to your liking you can stain the wood if you wish.
Step 4: Step 4: Software
Load the attached code.
Loading software on an ATTiny is a project in itself. I'll leave these two links here to get you started.
(Credit: The attached code is a modified form of the crossfader turorial)
Step 5: Step 5: Electronics
Install your power switch into the lid of your box.
Cut the plug off of your power supply and feed the wires through the back of the box to the inside.
Cut your protoboard so that it will fit on the inside of the box when completed.
Solder a wire to each of the four pads on the RGB LED. Place the LED in the center of the circular groove on the lid of the box and feed the four wires through the four holes toward the inside of the box. I found that the wires held the LED in place just fine but you can add some hot glue if you wish.
Wire power through your power switch to the common anode wire of your LED (marked C) and pin 8 of your ATTiny85.
Wire ground to pin 8 of the ULN2003AN and pin 4 of the ATTiny85.
Add your smoothing capacitor between power and ground. It should be rated over 5 volts and have a value around 10 μF
Wire ATTiny85 pin 3 (output for color RED) to ULN2003AN pin 1. Attach the wire on the LED's red pad (marked R) to the associated ULN2003AN pin 16 with one of the 10 Ohm resistors.
Wire ATTiny85 pin 5 (output for color GREEN) to ULN2003AN pin 3. Attach the wire on the LED's green pad (marked G) to the associated ULN2003AN pin 14 with one of the 10 Ohm resistors.
Wire ATTiny85 pin 6 (output for color BLUE) to ULN2003AN pin 5. Attach the wire on the LED's blue pad (marked B) to the associated ULN2003AN pin 12 with one of the 10 Ohm resistors.
The ATTiny85 code will cause the ULN2003AN to sink power from the LED through the resistor independently for each color.
Power everything on and make sure everything is working before finishing off the build.
Step 6: Step 6: Finish Up
Once everything seems to be working properly you stick the protoboard to the inside of the box with some hot glue.
Add some hot glue on the inside of the box where the power cable comes in to prevent it from getting tugged on and pulling away from the board.
Use very fine sandpaper on the clear acrylic tube to make it cloudy so it diffuses light. The LED will be very bright so I recommend making the tube very cloudy so the light is not blinding.
Put the tube into its groove on the lid and fix it in place with hot glue.
Screw the lid into place.
Glue the four rubber feet to the bottom of the box.
We have a be nice policy.
Please be positive and constructive.