Picaxe Blending Nightlight using pic12f683
I had a few multicolor LEDs laying around and wanted to whip up a color-blending nightlight. I built 2 devices, each in its own 20 pin DIP socket without soldering. A 3-pin header is included so I can reprogram the light on-the-fly if desired. On my first build, I used wire-wrap. The next one used multiple wires pushed into the socket. A bit more difficult, but no wire-wrapping or soldering necessary.
- 1 Picaxe-08M microcontroller
- 4 resistors
- 1 bi-color LED
- 1 3-pin programming header
- misc wire, DIP socket, a battery holder
My schematic is above. Take a look at the code and you will see that the light blends between 4 random colors somewhere in the available red-green range. The light uses pwm to fade in and fade out. It does its show about once each 30 seconds, but you can reprogram it if you want it to stay on all the time. On a quick check, the current drain is negligible when the light is off, and < 10ma when blending. The batteries should last close to their shelf life.
And this code turns the light on only when it is dark. It uses the LED to *sense* light level and compare it with the level sensed at initial power-on. It also adds 2 flickering modes, kind of like a candle. Even with a very simple circuit like this one, you can do some interesting things.
For more detail: Picaxe Blending Nightlight using pic12f683
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
JLCPCB Prototype: Only $2 for 10pcs 10×10cm, 24 hours Quick Turn, DHL Delivery in 3 days