RGB Nightlight Variant

RGB-APT.bas (2464Bytes)
nightlightschematic.jpg (61719Bytes)
nightlight_guts_108.jpg (1416692Bytes)

Insired by Geir Andersen's RGB Nightlight, I thought I'd build one for my daughter. She's just started having nightmares (she's 3 years old) and wants the lights on all night.

There are a few major differences between Geir's original design and my variant. I decided to only use one Picaxe-08, mostly because I only had one available. The original design used three RGB LEDs. Mine uses three single color LEDs. The Picaxe-08 can only provide a single PWM signal on Pin2, which I use for controling the brightness. So all three of my LEDs are the same brightness.

I used the same Random statement that Geir's code uses to set the next PWM duty to also select which LEDs will be lit for this cycle. Some logical code is also inserted to get a new random number if the current one would result in all three LEDs being off for a cycle.

nightlightschematic_0.jpg

An external circuit feeds the PWM signal into the base of three 2N2222A NPN transistors, via 1k resistors. Pins 0, 1, and 4 control which LEDs are on, and each feeds into a collector of the transistors. The emitters of the transistors each go through a resistor sized to keep its LED at 20-25 mA.

Also new is an LDR connected to Pin3 that turns the lights off if it is bright in the room. I also used a potentiometer to control a delay factor for the fading loop in the code. I used a diode and resistor to prevent interference between input from the potentiometer and output on Pin1. Geir’s original design had each of three Picaxe-08s set to a fixed, but slightly different delay factor. With my design you can vary the delay from 0 to 255.

Let’s see any other differences? Um, I found a pink LED, so I used that instead of a green one. My daughter loves pink, and I never saw a pink LED before. Oh, and I made use of fancy piece of metal from an old clock for a decorative reflector.

This is a fun project that let’s you learn some fundamentals of programming and construction. I always learn something new on a project, sometimes what not to do. On this one I learned about Pulse Width Modulation (PWM), the Random command, using a potentiometer with an ADC input, etc. I also learned how to scrum printing off of ping pong balls (soft scrub liquid cleanser, an abrasive dish washing pad, and patience).

https://www.youtube.com/watch?v=f0KLsvLTevE

Such a great adaptation

And how fun it is to have made something that others here at LMR are building on. I’ll show this post to my girls.
Thanks for the post.

Thanks to you! I love your

Thanks to you! I love your work.

Nice work

I used sandpaper to remove printing from ping pong balls. 240 grit if I remember correctly.

 

My whole woodworking shop is

My whole woodworking shop is packed up in the garage, and I couldn’t find my sandpaper. But SoftScrub worked pretty well. ; j

I’m even mentioned in the

I’m even mentioned in the video!! This might just be my ticket to fame and fortune. :slight_smile:
Have a nice weekend ignoblegnome and say hello to your daughter from me.