#625 Remote Control Candles
Examining some intrared-controlled LED candles, reverse-engineering the control protocol, and making them dance to the tune of an Arduino.
Here’s a quick demo..
Flickering LED candles are popping up all over the place.
I found a relatively cheap pack of 6 candles with infrared control on aliexpress to play with.
After taking one apart to find how they tick, I was able to very easily capture the IR protocol and so make a simple demonstration of how to control these candles with an Arduino.
The kit comes with multiple candles and an infrared control. They are all powered by CR2032 batteries (included!). So far it seems that the battery life isn’t great if you leave the candle on.
The smarts of the candle are all in an 8-pin package - presumably a standard MCU of some description, although in the volumes that these candles seem to be produced in, perhaps an ASIC could have been justified?
It is quite simple:
- an infrared receiver
- LED for candle effect
- a coil to repel the magnet in the “flame”
Reverse Engineering the IR Protocol
I used the ReceiveDump example from the Arduino-IRremote library, with a CHO 1838 intra-red receiver to capture the payload sent for each buttin on the remote control.
The raw captures are in protocol_decode.txt.
This confirmed that the NEC protocol was being used with a series of 10 commands. An empty (0x0) address is used, which makes sense as this is intended to “broadcast to all tea candles”!
The commands are as follows:
|Function||Address||Command||Raw Data 32 bits LSB first|
Controlling with an Arduino
The protocol is very trivial - just 10 commands transmitted with the NEC protocol. The Arduino-IRremote library can be used to send these commands from any MCO the library supports. In this case I’ve just grabbed the nearest to hand - an Arduino Uno.
The RemoteControlCandles.ino sketch is just a very simple sequence that demonstrates some of the basic commands - on, off, mode, dim.
It uses the Arduino-IRremote library to send comands in the correct NEC protocol format.
We just need an infrared transmitter connected to a GPIO pin of the Arduino:
Credits and References
- Pack of 6 or 12 Remote or Not Remote Flameless Battery Candles,Realistic and Bright Flickering Fake Dancing Flame Tea lights - aliexpress
- 50pairs 3mm 940nm LEDs infrared emitter and IR receiver diodes - aliexpress
- Arduino-IRremote library
- TSOP1838 datasheet - one of many similar IR sensors