My sister wanted me to build something for my nieces and nephew who were 8 and 6 at the time. We decided that it should be some sort of night light and I was playing with RGB LEDs at the time, so I decided to make a RGB night light.
Powering the device was an issue as I live in the United States (which uses 110V 60 Hz), while the rest of my family lives in Australia (which uses 240V 50 Hz). After some thinking I decided to make the device USB powered so that it could be used in any country, as long as a USB charger or computer was available.
The device uses a ATtiny85 which polls a Light Dependent Resistor (LDR) to determine ambinet light levels. Once ambient light drops below a predetermined level (which can be changed in the source code) it starts the color shifting sequence of the RGB LED.
The ATtiny85 has 2 PWM pins, but for this project I needed 3 PWM pins. So instead the color shifting is done in software.
The whole shift sequence (Cyan, Blue, Magenta, Red, Yellow, Green, Cyan) takes about 11 minutes so that it doesn't keep anyone awake!
IMPORTANT NOTE - To prevent the RGB LED from turning the device off repeatedly, resulting in flickering, mount to Light Dependent Resistor (LDR) on the opposite side of the PCB to the RGB LED ;)
Comments
Please log in or sign up to comment.