Attiny13 PWM Candle

While ago I found project that emulates candle flame using attiny13 MCU and two colored LED (red/yellow) or alternately two separate LED’s. Project author used method of randomly turning on and off LED’s and it looked relatively OK but it was a bit hard for eyes. I decided to make it from scratch using PWM (Pulse wide modulation) that randomly changes light intensity instead of turning on and off completely LED’s. It resulted in much more realistic candle flame simulation. It’s handy for making romantic atmosphere without fear of setting fire 😉


LED’s are connected through 100Ω resistor to PB0 and PB1 attiny13 pins (pin 5 and 6). Attiny is powered from 5V source. Program is written in Bascom. One thing that should be done while programming attiny is to change lfuse from 6A to 7A so that MCU clock is changed from default 1.2MHz to 9.6MHz and that also changes PWM speed so there is no visible blinking of LED’s due to low PWM frequency.

And here is source and compiled hex file for download


Leave a Reply

Your email address will not be published. Required fields are marked *