Our friend Pete Mills developed this great ATTiny based Electronic Candle, we have seen electronic candles before but what makes this one shine is how the flickering was done. Pete actually sampled the actual flicker patterns of a real candle flame so that this reproduced flame would look as close to the real thing as possible.
You can see some other electronic candle designs here for inspiration.
“The ATTiny Candle is an LED candle. It uses a high brightness LED and some software to mimic the look of a traditional candle without the dangers associated with an open flame.
I figured the hardest part of this project would be making the flicker look realistic, so I decided to let nature do that part for me. I made this candle with a Light Detecting Resistor ( LDR ) and a fixed resistor acting as a voltage divider. This is fed to one of the ATTiny85’s ADC inputs and sampled at discrete time intervals. At this time, the sample rate is 100mS. These 8-bit light level values are then stored to EEPROM so that the candle can recall the flicker pattern to play back on the LED that is connected to a PWM channel after being turned off. You only need to program the pattern once, but you can program it over and over again with just the push of a button.”