AVR night light
Geir's RGB night light was such an inspiration I just had to make my own. Instead of Picaxes I decided to use ATTiny 2313. At first I tried to program it with C but I ran to some "differences of opinions" with gcc when I tried to assign dedicated registers to variables holding duty cycle values (for speed optimizations). After some struggling I gave up and coded the whole thing in AVR assembly. I was quite surprised how easy it was after all. It took me about one weekend and I got first versions running nicely.
My AVR night light drives 5 RGB leds with software PWM. Using a 8-bit timer, "8-bit duty cycle" ranging from 0 to 255 and 2313's internal 8MHz resonator I got 122Hz PWM. That's enough to get flicker free leds. Leds are driven by two ULN2803 darlington arrays. That's because ATTiny 2313 can only handle 200mA max. I also added a switch so I can change between different modes and a potentiometer to control the speed (of fading or whatever the selected mode does with the potentiometer). Because 2313 doesn't have any ADC's I used 555-timer and one input of 2313 to "read the position" of the potentiometer. I found this page useful: http://home.cogeco.ca/~rpaisley4/LM555.html
And here's some pictures:
The AVR night light. Connectors below the power switch are ISP (In System Programmer) and power connection.
Electronics, top view
Electronics, bottom view
Last but not least: Thank you Geir for inspiration :-)