This idea came from the Trippy Night Light published in Make by Charles Platt and the "Trippy RGB Color Mixing Night Light" by e024576.
It uses pulse width modulation to "randomly" "fade" the intensity of a red, a green and a blue LED so that they mix in endless combinations of colors.
I'd like to point out that you can get similar color changing functionality at about one-fifth of the cost and one-tenth the work by simply using one RGB Slowchanging LED. But you couldn't customize the program, it wouldn't be as bright, and you wouldn't get any cool shadow effects. What fun would that be?
The shadow picture was made seconds after I successfully powered the project straight from my laptop. I pointed the light at the ceiling and discovered a 10-ft wide psychedelic light show!
Step 1: Parts and Tools
- Soldering Iron and stuff for soldering - If you don't have one yet go buy it! Mine has already paid for itself with the simple repair of broken audio cables.
- Programming cable and software for PicAxe microcontroller
- 3 x Picaxe 08M microcontroller - Sparkfun
- 24 hole IC socket - I actually used a 16 and an 8 because that's what I had. You could use 3 x 8 if that's what's available - Local Radio Shack (this is what they look like). When I look online it seems cheaper to buy 3 x 8-pin sockets than to buy 1 x 24-pin. If you don't have an extra $1.50 for this part you could skip the sockets altogether and solder directly to the chips, but be careful not to burn, melt or brick your chip!
- 3 x 10k
- 3 x 1k
- 3 x 330
- 1 x various (optional for a totally superfluous power indicator LED)
- Red, Green, and Blue LED - 1 Each - I got mine on Amazon
- Some insulated wire - Thickness and flexibility isn't terribly important. Solid core may be easier for soldering.
- Tiny Red LED (Optional for a power indicator) Totally unnecessary since the power will already be indicated by the other lights. I just had this one handy and it cried out to be included in the project.
- Junk USB cable OR Dollar store/thrift store equivalent - Please don't spend more than a dollar on this. You just need one with one end that can fit in your standard USB charger. The other end will get cut off. I nabbed mine off an old device I disassembled a long time ago. You probably already have this in a drawer somewhere.
- Any USB charger - such as for iPhone, Kindle, etc.
Step 2: Design the Circuit
I thought I had taken a picture of the circuit on breadboard, but it has disappeared. I guess the design is pretty easy to see from the pictures. The Picaxe help manuals help with the pin out on your chips and programming needs. I'll work up a schematic if I have time.
Basically you need to deliver 5v via the red (+) and black (-) USB wires. Check with your voltmeter to make sure these are delivering the correct voltage. A few tenths of a volt below 5v should be okay. The LED series resistors are for protecting the little guys from the big bad current. They ARE necessary. The other resistors keep the chips from thinking they are getting a new program. I used the two-resistor set up incase I want to reprogram the chips without removing them, but I think you might be okay with just the 10k resistors. You'd better prototype it on the breadboard first to be sure.
MORE TO COME!
Step 3: Program the Chips
- 22k Resistor
- 10k Resistor
- 4.5 - 5v DC power supply. (3 AA batteries or 9v with a 5v regulator)
- Programming cable. I bought the USB-to-serial converter Sparkfun sells specifically for this purpose and built a connector that makes it easy to plug into the board.
e024576 has done a good job of taking the original code and breaking it into three color specific files for programming.
Clicking the above links should send you to a page with text-only that can be copied into a .bas file in the picAxe programming editor..
Use a different program for each of the three chips. It is not imperative that red goes with red or blue with blue etc. They just need to have the differing rates of change to have the random effect.
You can build a circuit like the one pictured. I have a previous picaxe project that I use to drop chips in for programming.
Step 4: Power Rails - Preparation
I decided to follow the inspiration of the diagrams in Make Magazine Volume 25. They use positive and negative wires running underneath the chips between their pins.
Since we're not using a circuit board we'll need to strip some sections of insulation off those wires in just the right place. There's probably some sweet tool that does this for you or some easy trick to it. But I'll show you how I did it.
First I marked the wires next to the pins that needed to be connected. With the black wire I used an blade to cut the insulation as a mark. Then I carefully used a wire stripper on each side of the mark. Then I sliced the area between the two cuts being careful not to break the wire and peeled off about a millimeter of wire.
Prepare both wires and move on to the next step.
Step 5: Power Rails - Melt Them on With Metal
If you are using more than one socket now would be a good time to glue them together. I wired them up before gluing, and it resulted in a less-than-perfect finish.
I had this fancy tilting vise that did a good job holding the bug still while I stuck the wires on. Helping hands work fine too. Take your time. Double check you have the right pins and solder on! Go ahead and do the positive and negative sides.
Step 6: The Resistance! (add the Resistors)
Now you get to practice your soldering. 9 little resistors. Double check twice before you start each one so that you don't have to undo anything.
Step 7: Dioeds Emitting Light
Now three more things...
Tip: Don't clip both LED leads at once. Clip the positive (longer), solder it on, then clip the negative. It's easy to forget which is which.
Step 8: Power It Up
I found a little led that already was matched with a resistor that would be perfect for a power indicator. It is totally unnecessary in this project, but I was in a soldery mood, know what I mean? I was on a roll so I went for it. We'll see it it was worthwhile .
Step 9: Enshrine Your Creation
I was inspired by the Crystal cMoy Free Form Headphone Amplifier by koogar, but I was too impatient to go buy the right kind of resin and make the right forms etc. I ended up using some epoxy I had on hand which wasn't enough so I also used hot glue. Did not turn out good, so I recommend you design your own enclosure. Head over the koogar's instructable and adapt it for this project.
Whatever you do it would probably be a good idea to strengthen the cable connection to the circuit as this is the weakest point.
I left mine so that the chips could be removed and reprogrammed. Also I left the LEDs free so they could be repositioned slightly. Careful not to bend the leads too much and break them.
Now stick this in your pocket or computer bag and you are ready for some mood lighting wherever you go!
Since it is now summer time and the sun is up more hours than I can stay awake I haven't had a good chance to test this out in my truck yet which I think will be cool.
So far my kids love to use it for making crazy looking shadows on the walls and ceiling. Experiment with different distances for varying color effects.
The next step will be tweeking the code and finding a better enclosure. Let me know if you come up with something.
UPDATE: I made a silicone cover that simulates a glowing salt crystal. See the last picture. When I have time I'll make an instructable on how I made it.
Finalist in the