Now with built-in Timer – Tim’s Weblog
Years in the past I spent a while analyzing Candle-Flicker LEDs that comprise an built-in circuit to imitate the flickering nature of actual candles. Synthetic candles have advanced fairly a bit since then, now together with magnetically actuated “flames”, a good higher candle-emulation. Nevertheless, on the low finish, there are nonetheless easy candles with candle-flicker LEDs to emulate tea-lights.
I used to be lately tipped off to an upgraded variant that features a timer that turns off the candle after it was lively for 6h and turns it on once more 18h later. E.g. if you flip it on at 7 pm on at some point, it will keep lively until 1 am and deactive itself till 7 pm on the subsequent day. Appears fairly helpful, truly. The query is, how is it applied? I purchased a few these tea lights and took a more in-depth look.
Nothing particular on the skin. It is a typical LED tea gentle with CR2023 battery and a swap.
On the within there’s not a lot – a single 5mm LED and a black plastic half for the swap. Amazingly, the swap does now solely transfer one of many LED legs in order that it touches the battery. No extra metallic components required past the LED. As prevously, there’s an IC built-in along with a small LED die within the LED bundle.
Wanting high down by the lens with a microscope we are able to see the dies from the highest. What’s curious concerning the IC is that it moderately massive, has loads of unused pads (3 out of 8 used) and appears to have comparatively small constructions. There are rectangular common areas that appear to be reminiscence, there’s a massive space within the heart with small random trying construction, trying like synthesized logic and a few half that appear to be hand-crafted analog. May this be a microcontroller?
Apparently, additionally the positions of the used pads look fairly acquainted.
The pad-positions correspond precisely to that of the PIC12F508/9, VDD/VSS are bonded for the ability provide and GP0 connects to the LED. This pinout has been adopted by the ubiqitous low-cost 8bit OTP controllers that may be present in each low cost piece of chinese language electronics these days.
Fairly curious, so it seems that as an alternative of designing one other ASIC with candle flicker performance and correct 24h timer they merely used an OTP microcontroller and molded that into the LED. I’m pretty sure that this isn’t an authentic microchip controller, however it seemingly is certainly one of many PIC derivatives that value round a cent per die.
Electrical characterization
For some fast electrical characterization is related the LED in sequence with a 220 Ohm resistor to measure the present transients. This permits for some perception into the inner operation. We are able to see that the LED is pushed in PWM mode with a frequency of round 125Hz. (left image)
When synchronizing to the rising fringe of the PWM sign we are able to see the present transients attributable to the logic on the IC. At any time when a logic gate switches it should trigger a small enhance in present. We are able to see that comparable patterns repeat at an interval of 1 µs. This implies that the primary clock of the MCU is 1 MHz. Every cycle appears barely completely different, which is indicative of a program with various instruction being executed.
Sleep mode
To realize extra insights, I measured that LED after it was on for greater than 6h and had entered sleep mode. Naturally, the PWM sign from the LED disappeared, however the present transients from the MCU remained the identical, suggesting that it nonetheless operates at 1 MHz.
Integrating over the waveform permits to calculate the typical present consumption. The typical voltage was 53mV and thus the typical present is 53mV/220Ohn=240µA.
Can we enhance on this?
It is a moderately excessive present consumption. Using a MCU with sleep mode would enable to deliver this down significiantly. For instance the PFS154 allows for round 1µA idle present, the ATtiny402 even a bit much less.
Given a present consumption of 240µA, a CR2023 with a capability of 220mAh would final round 220/0.240 = 915h or 38 days.
Nevertheless, in the course of the 6h it’s lively a present of a number of mA will likely be drawn from the battery. Assuming a mean present of two mA, the battery woudl theoretically final 220mAh/3mA=73h. In actuality, this excessive present draw will reduce its capacity significantly. Assuming 150mAh usable capability of a low value battery, we find yourself with round 50h of lively working time.
Now lets assume we are able to scale back the idle present consumption from 240µA to 2µA (18h of off time per day), whereas the lively present consumption stays the identical (mA for 6h):
a) Each day battery draw of present MCU: 6h*2mA + 18h*240µA = 16.3mAh
b) Optimzed MCU: 6h*2mA + 18h*2µA = 12mAh
Implementing a correct energy down mode would due to this fact permits extending the working life from 9.2 days to 12.5 days – fairly a major enchancment. The primary lever is the lively consumption, although.
Abstract
Within the 12 months 2023, it seems that investing improvement prices in a candle-flicker ASIC is not probably the most economical possibility. As a substitute, ultra-inexpensive 8-bit OTP microcontrollers appear to be taking on low-cost electronics in every single place.
Is it attainable to enhance on this candle-LED implementation? It appears so, however this can be for an additional undertaking.