A nice night light multicolor, ideal for baby's room.
For the realization I used:
- Out of a pack of bubble bath for children in the shape of teddy bear
- a nightlight with positive economic pressure
- Complete circuit with a PIC16F84A (I was at home, but you can use any programmable microcontroller)
- LED multicolor
I started preparing the teddy bear, all the markings on the package, such as the make and range indications, I canceled with the nail polish remover.
Then I drilled the base so that it gets wedged perfectly on the spherical part of the nightlight I drilled (enlarged the hole) also the upper part so as to pass light well.
Then I switched to accommodate nightlight, I removed the original LED and resistor, and I drilled the top of the ball so as to pass the led.
At this point I have made the circuit of the pic, it is a very basic.
The multicolor LED has 4 feet, the longest (in the type of LED I) is the common cathode, the anode is the other three for red, blue and green (RGB).
The legs were connected respectively to ports RB0 (green), RB1 (red), RB2 (blue) of the pic.
The program does is turn an LED and using the pwm is going to fade the next color:
G -> R
R -> B
B -> G
the duty cycle is of 20000 microseconds, as the duty cycle decreases to a color for the other increases, and so on ...
I mounted the whole, the switch for the circuit I have used one of the lamp, and the teddy bear has been glued with hot glue on the upper part of the lamp.
For more details see: http://www.tutorial360.it/default/tutorial.php?id=221