Whether it is required to simulate an open fire in a nativity scene, a forest fire in a model railway landscape, a log fire in a doll’s house or simply for an artificial candle, neither steady light nor the commercially- available regularly flickering lights are very realistic. The circuit described here imitates much better the irregular flickering of a fire. For maximum flexibility, and to reduce the component count to a minimum, a microcontroller from the Atmel ATtiny range has been selected to generate the flickering pattern. Two miniature light bulbs, each driven by a transistor, are controlled using a PWM signal to produce eight different light levels. Potentiometer P1 in the RC network adjusts the speed of the clock to the microcontroller, and hence the speed of the flickering.
Generating the light levels in software is straightforward in practice, but the underlying theory is far from simple: hence the ‘intelligent’ in the title. Using a digital pseudo-random number generator (an 8- bit shift register with feedback arranged according to the coefficients of a primitive polynomial) a sequence of period 255 can be produced. In order that the flickering is not too violent, the sequence is smoothed using a digital FIR low-pass filter which takes the average of the last two sample values. If desired, a jumper can be fitted that compresses the dynamic range of the output by adding in a fixed basic intensity. The result is an irregular flickering which closely resembles that of a fire.
A further option allows the brightness values to be read from a look-up table instead of using the sequence generator; this option obviously gives the greatest flexibility. A jumper gives the choice of two different tables. The look-up tables can be used to produce other decorative light effects, such as a light fader, or the continuous mixing of two differently-colored lights. It could even be used to imitate rotating flashing lights on a model. If the design were expanded to three channels, it would be possible to connect three miniature light bulbs in red, green and blue (or an RGB LED) and generate arbitrary color patterns. The printed circuit board is just the size of a postage stamp and so should be easy to fit within small models or model landscapes.
The board is single-sided, and making the board and populating it should not present any difficulties, thanks to the absence of SMDs. The total component cost is very low, at around two or three pounds, not including the circuit board. Power can be obtained from any regulated 5 V supply. If only an unregulated supply is available, then this should be connected to V+. Current consumption is of course mostly dependent on the choice of lamp.