An earlier Idea for Design described LED “candles” that you could blow out just like normal birthday candles (“Electronic Birthday Candles ‘Blow Out’ One At A Time”). A thermistor and heating resistor combination detected air blown over the thermistor. The control circuit incorporated an 8-bit shift register, a quad op amp, and driver transistors, allowing up to eight candles. For each gust of air blown at the thermistor, one LED was turned off, thereby mimicking the action of normal candles.
The improved circuit described here offers a more realistic behavior of the candles. It uses a simpler circuit that increases the number of candles allowed to 20.
To reduce complexity, we used an inexpensive microcontroller. Lots of options are available. We chose a device with one of the smallest footprints available—an ATtiny45 in an eight-pin package. Among other things, modern microcontrollers offer digital I/O and on-chip ADC channels. Both of these features are useful for this project. Although the limited number of I/O pins on the eight-pin package restricts the number of LEDs that can be controlled, an improved LED multiplexing scheme called Charlieplexing alleviates that problem (“Eight-Pin Microcontroller Handles Two-Digit Display With Multiple LEDs”).
The revised circuit is similar to the previous version in that a 47-O resistor is used to heat a 150-O thermistor (see the figure). A resistor divider network formed by the thermistor and a 100-O resistor monitors the ambient temperature. When air blows over the thermistor, it cools the thermistor, increasing the voltage at the junction (the node labeled Temp). The voltage at this junction is monitored continuously by the MCU’s ADC channel0. The rest of the five I/O pins control the 20 5-mm LEDs. We chose LEDs of different colors to serve as our birthday candles.
At power up, all of the LEDs glow. The microcontroller controls the LEDs with four levels of intensity that vary the LED light output randomly to provide the appearance of a flickering candle. The MCU continuously monitors the thermistor’s temperature, and when the ADC count increases a few counts (a variation of five in the ADC count works well), the LEDs are turned off randomly. Not only is the sequence of LEDs being turned off random, but also the number of LEDs that go out at one time is random.
We chose that count to be between zero and three LEDs at a time. Thus, the LEDs blow out much more realistically. Also, if the candles are to be used for a birthday cake and it’s desired that all but one candle be blown out, the control software can easily be modified to do that.
Four rechargeable batteries (NiCD or NiMH) with a terminal voltage of about 1.2 V power the system. A freshly charged battery terminal voltage is about 1.3 V. Even at that value, the combined voltage of the four batteries is well within the operating voltage range of the ATtiny45.
The control software for the candles is written in C using the AVRGCC C compiler under a Windows operating system. The compiled code, which is about 2500 bytes.
We built the candle circuit on two printed-circuit boards (PCBs) separated by spacers. The component side of the top PCB held the LEDs, the switch, the thermistor, and the heating resistor. The solder side held the microcontroller and other components. The bottom PCB held the batteries.