This is a nightlight that projects color changing
patterns on the ceiling. It is a pleasant companion for kids to
use when drifting off to sleep at night.
The whole build is pretty simple, but here are some misc comments and
The light has 3 modes: red/green/blue color
changing with fade to black, red/green/blue without black fade, and
random color fading
The lamp shuts off and goes into low power mode after
about 20 minutes of use
Because the sleep mode of the PICAXE is optimized to
use very little power (eg, nanowatts), the microcontroller is
continuously running. When the light is off, it still polls the
push button to know when it has been turned on. Battery life of
the light is almost the shelf life of the batteries.
The light flashes to indicate mode (eg, mode 2=2
flashes). The flash color indicates the battery voltage.
Designed to use 3 AA cells, blue=good, red=low (<3.45v). The
M2 devices now have reference voltage routines, which are really handy
for measuring supply voltage.
The circuit and program are really just a color
blending RGB LED with a timer routine. The new PICAXE M2 devices
have multitasking and timer routines built in, which makes this a
pretty easy project.
The color blending routines would be a bit
complicated to do via bit-banging the RGB outputs. But the 20M2
used in this project has 3 pulse-width modulated outputs. These
makes RGB control pretty simple.
The transparency mask is at the top of this page. You can edit it in GIMP to do almost anything you'd want. From my work with computer generated holograms, I've
done quite a bit of testing of laser-printer transparencies.
For the sweetdreams light, almost any transparency will do.
Printing method (laser vs ink-jet) is not critical, either. You
will notice some small aberrations on the projected images:
diffraction: fuzziness around the edges of
color-banding: the red/green/blue shadows are
slightly misaligned due to the physical separatoin of these LEDs within
the superflux packaging. This causes some rainbow effects at the
edges of the projected shapes
The Sweetdreams Light in
light is housed in a decorated beach bucket purchased for $0.50 at a
dollar store. Bubble-wrap is used to hold the batteries and
circuit-board in place. The superflux RGB LED is a very bright
light source, and cheaply available via ebay. But there's no
reason that 3 separate LEDs couldn't be used. If you go this
route, you'll probably want to comment out the blended projection
modes, since misalignment of the discrete LEDs will cause overlapping
projections of different colors.
1 normally open momentary contact pushbutton switch
2 resistors (10K, and 22K; for in-circuit programming)
1 3-pin programming header
misc: wire, DIP socket, a battery holder, veroboard
Children's beach bucket
My schematic is above, and here is the
My style/documentation is pretty rigorous, but I strongly advocate good
coding practice regardless
of the machine; all software only becomes more obfuscated over time.