Revisiting Candle Flicker-LEDs: Now with integrated Timer

Years ago I spent some time analyzing Candle-Flicker LEDs that contain an integrated circuit to mimic the flickering nature of real candles. Artificial candles have evolved quite a bit since then, now including magnetically actuated “flames”, an even better candle-emulation. However, at the low end, there are still simple candles with candle-flicker LEDs to emulate tea-lights.

I was recently tipped off to an upgraded variant that includes a timer that turns off the candle after it was active for 6h and turns it on again 18h later. E.g. when you turn it on at 7 pm on one day, it would stay active till 1 am and deactive itself until 7 pm on the next day. Seems quite useful, actually. The question is, how is it implemented? I bought a couple of these tea lights and took a closer look.

Nothing special on the outside. This is a typical LED tea light with CR2023 battery and a switch.

On the inside there is not much – a single 5mm LED and a black plastic part for the switch. Amazingly, the switch does now only move one of the LED legs so that it touches the battery. No additional metal parts required beyond the LED. As prevously, there is an IC integrated together with a small LED die in the LED package.

Looking top down through the lens with a microscope we can see the dies from the top. What is curious about the IC is that it rather large, has plenty of unused pads (3 out of 8 used) and seems to have relatively small structures. There are rectangular regular areas that look like memory, there is a large area in the center with small random looking structure, looking like synthesized logic and some part that look like hand-crafted analog. Could this be a microcontroller?

Interestingly, also the positions of the used pads look quite familiar.

The pad-positions correspond exactly to that of the PIC12F508/9, VDD/VSS are bonded for the power supply and GP0 connects to the LED. This pinout has been adopted by the ubiqitous low-cost 8bit OTP controllers that can be found in every cheap piece of chinese electronics nowadays.

Quite curious, so it appears that instead of designing another ASIC with candle flicker functionality and accurate 24h timer they simply used an OTP microcontroller and molded that into the LED. I am fairly certain that this is not an original microchip controller, but it likely is one of many PIC derivatives that cost around a cent per die.

Electrical characterization

For some quick electrical characterization is connected the LED in series with a 220 Ohm resistor to measure the current transients. This allows for some insight into the internal operation. We can see that the LED is driven in PWM mode with a frequency of around 125Hz. (left picture)

When synchronizing to the rising edge of the PWM signal we can see the current transients caused by the logic on the IC. Whenever a logic gate switches it will cause a small increase in current. We can see that similar patterns repeat at an interval of 1 µs. This suggests that the main clock of the MCU is 1 MHz. Each cycle looks slightly different, which is indicative of a program with varying instruction being executed.

Sleep mode

To gain more insights, I measured that LED after it was on for more than 6h and had entered sleep mode. Naturally, the PWM signal from the LED disappeared, but the current transients from the MCU remained the same, suggesting that it still operates at 1 MHz.

Integrating over the waveform allows to calculate the average current consumption. The average voltage was 53mV and thus the average current is 53mV/220Ohn=240µA.

Can we improve on this?

This is a rather high current consumption. Employing a MCU with sleep mode would allow to bring this down significiantly. For example the PFS154 allows for around 1µA idle current, the ATtiny402 even a bit less.

Given a current consumption of 240µA, a CR2032 with a capacity of 220mAh would last around 220/0.240 = 915h or 38 days.

However, during the 6h it is active a current of several mA will be drawn from the battery. Assuming an average current of 2 mA, the battery woudl theoretically last 220mAh/3mA=73h. In reality, this high current draw will reduce its capacity significantly. Assuming 150mAh usable capacity of a low cost battery, we end up with around 50h of active operating time.

Now lets assume we can reduce the idle current consumption from 240µA to 2µA (18h of off time per day), while the active current consumption stays the same (mA for 6h):

a) Daily battery draw of current MCU: 6h*2mA + 18h*240µA = 16.3mAh
b) Optimzed MCU: 6h*2mA + 18h*2µA = 12mAh

Implementing a proper power down mode would therefore allows extending the operating life from 9.2 days to 12.5 days – quite a significant improvement. The main lever is the active consumption, though.

Summary

In the year 2023, it appears that investing development costs in a candle-flicker ASIC is no longer the most economical option. Instead, ultra-inexpensive 8-bit OTP microcontrollers seem to be taking over low-cost electronics everywhere.

Is it possible to improve on this candle-LED implementation? It seems so, but this may be for another project.

8 thoughts on “Revisiting Candle Flicker-LEDs: Now with integrated Timer”

  1. Tim,I read the blog at mikrocontroller.net but did not see a suggested micro.Suggest a suitable (cheap) one (that has some kind of toolchain and programming info) Paduk? and I’ll write some assy code to see how low I can go. I’ll report my code and results.LCSC has 24 pin Cypress parts for <$0.02 crazy.Barry

    1. No idea which controller was used. My bet would be on a generic PIC-derivative. There are many of those, for example Nyquest. They are even cheaper than Padauk. But I guess in terms of low power operation Padauk would perform well.

      A cypress controller for $0.02 must be about cleaning stock.

  2. Nice analysis! I did a similar one a few years back when having some more time for passion project, though in my case I never ended up using it for real besides for making a blog post (should consider fixing that now that I have a better idea to use it!)

    Fake candles, and flame algorithms

    I link from there to the GitHub repo with an implementation for CircuitPython because that was the thing I had easiest access to at that point in time 😉

    1. I suppose the microcontroller does not have a separate low power oscillator. After all, that just adds cost (silicon area)…

      CR2032: Indeed, that was a typo. Fix’d

  3. I llooked around to find gate count of PIC12F, best estimate I got was 100k.

    I would venture that a random seed based flicker circuit would be 150 gates max. Obvious silicon space is money, but LED can’t be made much smaller. That, in CMOS, would be tens of micro amps or less.

    PIC12 should have external RC osc capability to run well below the 4MHz internal osc also.

    1. 100k is waaay overestimated. The die size of a PMC150C (with more functionality than a PIC12) is just 0.25mm². 180nm CMOS is about 80-100kgates/mm².

      The die in the LED is a bit larger. I could not measure it properly due to distortion of the lens, but I don’t think its more than 0.5mm

Leave a comment