Project is based on the Trippy Crystal Nightlight by Charles Platt in Make Magazine Volume 25; see link below for additional details. A fun and simple project to get started with PICAXE microcontrollers.
For this variation on the original Trippy Nightlight an inexpensive (> $2.50) USB AC charger provides a traditional nightlight plug-in-the-wall form factor. To simplify the main circuit board I removed the download circuitry from the board and instead programmed the PICAXE 08M microcontrollers on a separate breadboard. Instead of a quartz crystal, two Jell-O snack-size containers and a little bit of Saran Wrap diffuse the light.
Total materials cost is about $15.00. The unit has been running problem-free for over six months. Electricity usage is almost too low to measure. Watch the YouTube video below to see the nightlight cycle through its color changes.
Cut a piece of stripboard a little more than 4 traces wide and about 3/4 inches long.
Sand or file down edges so it fits tightly in USB charger socket with the 4 Traces centered within the socket so you're making a good connection with left side +5 VDC pin & right side ground pin. Verify that you're getting a good connection with a multi-meter. Secure stripboard with hot glue.
If you don't have another 5 VDC power supply to use for programming the PICAXE ICs in the next step then you can now solder Red (+5VDC) and Black (ground) wires to stripboard. Make wires a little long so you can use it to power the PICAXE chip on the breadboard during programming.
Otherwise you can wait until after you have built the main circuit board to solder the power supply wires.
Tape over USB Charger’s “Power On” red LED to block its light.
Build up solderless breadboard with PICAXE 08M IC and AXE029 breadboard adapter as shown in photographs.
For additional info go here, and/or see the PICAXE Manual 1 available from the Programming Editor Help menu.
Download Programming Editor from PICAXE website and install on your computer. Connect your PC using either Serial or USB cable, and download programs to PICAXE ICs. You can download the code here.
For additional help with programming, see the Editor's Help menu. Manual 1 is the most helpful for getting started the first time.
You need to program three PICAXE chips, one for each color LED – red, green, and blue. Program code is the same for each LED except for one line of code as shown below. Red LED: Colorinc =17 Green LED: Colorinc =23 Blue LED: Colorinc =37 This provides an offset so as to get a pleasing mix of color variations.
Step #3: Build Main Circuit Board & Attach to USB Charger
Using Radio Shack perf board 276-148, build the circuit as shown. You'll need to cut down the corners a little bit.
Cut a cardboard disk the same diameter as Jell-O snack cup bottom flange and attach to circuit board using double-stick foam tape and hot glue.
Bend a small piece of sheet metal into a "U" and with double-stick foam tape and hot glue attach it to top of USB charger as shown.
Solder power leads from the main circuit board to USB charger. Test to be sure all three LEDs illuminate. With double-stick foam tape and hot glue attach cardboard and circuit board to U-shaped bracket on top of USB charger. Bend the USB charger prongs outward a little to ensure it does not fall out off the wall socket.
Bend LEDs together so they will fit inside Jell-O cup. To diffuse the light, wrap LEDs with Saran Wrap - experiment to get pleasing visual effect.
Rough up outside of the Jell-O cups using sandpaper.
Put first Jell-O cup over LEDs and Saran wrap, wrap thin layer of Saran Wrap outside the first Jell-O cup, then install second Jell-O cup on top of the first cup. Again, experiment to get the most pleasing visual effect. Finally, attach Jell-O cups to cardboard base using hot glue. That’s it; you're done!