In this project a LED is used to mimic a flickering candle as closely as possible. When using a LED to behave like a candle, it may not be possible to sway the flame, but what can be achieved is the random variation of intensity.

The intensity of the LED can be varied using a random number generator and PORTB of the microcontroller implement the intensity control. To simulate the color of light of a candle, a warm white or yellow LED can be used.

The picture below shows the diagram of the flickering candle.