Instructables

Reverse Engineering: RGB LED Bulb with IR remote

Featured
Picture of Reverse Engineering: RGB LED Bulb with IR remote
We bought 20 of these RGB LED Light bulbs for a party at work, but I was a little disappointed with the color fading functions they provided. So I decided to take one apart, reverse engineer the IR protocol, and see if it had more functions than those available from the IR remote.


Other instructables related to reverse engineering:
If you find this instructable interesting, you should have a look at this. It also goes more in depth on the tools used in this instructable. 

http://www.instructables.com/id/USB-controlled-home-automation-hack/
 
Remove these adsRemove these ads by Signing Up

Step 1: The product and proect goals

Picture of The product and proect goals
IMG_7153.JPG
This is a really cheap RGB LED bulb that fits into a regular E27 bulb socket. It has an IR remote that lets you choose between different modes and colors.

I want to use them in the color fade mode, but the color fade in these bulbs suck. For some reason they fade the LEDs to almost white color, which doesn't look that great.

I am hoping to find some hidden modes, or alternative ways of controlling this thing without too much work. 

Step 2: Sniffing the remote

The first obvious thing to do here is to sniff the IR led on the remote control.

I soldered on some wires to the LED, and put the cover back on, so I could have easy access to the signal while pressing the buttons.

Step 3: IR carrier frequency

Picture of IR carrier frequency
20131004_193625.jpg
ir_remote.png
Now I have access to the data sent by the IR remote, great. However, IR remotes uses a carrier frequency to transmit their binary data. This creates a whole lot of garbage data in the logic analyzer. See the screenshot.

One important thing I can get from the IR remote, is the carrier frequency. I used the frecuency measurement in my oscilloscope to measure this.
domdomegg1 month ago

Would this be possible to control from a USB connection from a Windows machine? If it could, you could do all sorts of awesome stuff :D (thinking of disco, ambilight, auto turning on lights in morning, auto dimming slowly at night). Congrats, great post!

algalopezg1 month ago

Thanks for this tutorial, it helped a lot although I ended up using a different code.

Hoping that this comment will be useful for someone, be aware that in the extended NEC protocol, the address is not always 0x00FF, for example, my lightbulb uses 0x00F7 (0x00F720DF for red).

It took me a while until i found it out :)

hi, great hack and nice job of decoding the protocol!

I'd like to use your code as part of my Halloween display this year.

(Colored ghosts...)

Where can I find your code for the arduino?

Thanks!

ocaman3 months ago

Hi

Where is the arduino sketch? thanks

ludwigsystems4 months ago

Great post. Good instructions for duplicating what I needed to do for my garden LED lights. Thanks a lot!

pbhatter4 months ago

Excellent article and photo's. Thanks for sharing it.

With this article, some code I downloaded for Arduino and modified, and article from Vishay ( http://www.vishay.com/docs/80071/dataform.pdf ) I was able to figure out the codes used by my IR control.

bpark100011 months ago
You are going to run into what is in my opinion a dead end (depending upon what you are after). The analog circuitry driving the LEDs is a fixed current only (it is a single transistor "starved" by a second transistor). Dimming is done by pulse width modulation of the current. This causes flicker. This is especially evident for yellow shades. With the cheap stock Chinese computer in the bulb, or an Arduino, you can't go fast enough. This is one of those products where you need to trash out all the circuitry, LED drivers included, and put in better designed circuitry (you can still use "slow" PWM, but you low-pass filter it with an RC circuit, and feed that to an ANALOG current source). I went down this path (I wanted to make subtle shades with the lamp, fixed but settable). The other thing I wanted was to eliminate the "feature" of way too many digital products made today: they "forget" everything when they are turned off! If you put this in a fixture controlled by a wall switch, you have to remote control it every time you turn it on.
You do have a nice documentation of the IR control protocol. You are lucky, that it wasn't more complicated (I'll bet you could randomly strobe IR LEDs at it and get random results, as there is really no error protection in the code). I hacked a toy dragon set, and the protocol was much more complicated.

To KROKKENOSTER: the currents are fixed, and pulse width modulated. Your retina is the "low pass filter" that creates the illusion of dimmer light.

With an Arduino you can run the hardware PWM output at up to 234375hz (16mhz/256), but PWM in devices like these are intentionally run slowly. LEDs output different shades of light at different voltages, so for accurate colour reproduction almost all well designed dimmable LED lights use PWM which is as slow as is acceptable for the application. The reason for the slowness is that the wires from the switches to the LEDs act as both inductors and capacitors, and at higher frequencies the waveform becomes more like a sine wave due to the unintentional low-pass filtering of the wires, causing the LED to output incorrect colours during the transition whenever the digital output changes high or low. Slower PWM means there is less time spent transitioning and more time spent at the most ideal voltage and current, so the colour reproduction is much more consistent. Without this you would need a lookup table to determine which colour your LED outputs at each constant current, and some code to transform an input colour in to an output that can represent that shade with analog LED driving.. which would be very complicated and impractical for a small microprocessor like the Arduino. Of course, if your colours don't have to remain accurate at different brightnesses, it doesn't matter.

acrimson6 months ago
Would be awesome if someone know how to port the codes to use an android device to control this kind of lights
SuperTech-IT9 months ago
I like your scope - how much was it, and where did you get it?
clazman11 months ago
Wow, you guys and gals and your brains could resolve the electronics age problem of controlling multiple devices with ONE remote. A GUI remote with the help of the Arduino.

For example, I would like to have a pc program for laptop that would depict each of a persons remotes with a GUI. It would be a simple matter to select a devices remote from a menu pull up that device GUI. Then click on the button function desired.

Where do I start? I've not done any GUI development. Or, has this already been accomplished???

I need to learn how to handle all of the "input" (knowledge) that "Instructables" brings to the table. It is almost limitless. For me, it is information overload. It is so depressing to discover just how stupid this retired mechanical engineer is.
yosoufe clazman11 months ago
We can read the TV remote control data! and use it for other devices! for instance using it as a remote control of the lights of the room! or maybe a device to control the curtain of the room! even the air conditioner of the house! all in once!
yosoufe11 months ago
Good! I am doing something like this! My PCB is being printed! I will control a relay which switch my room's lamp, using a remote control!

For all the protocols, there is a good website!
http://www.hifi-remote.com/johnsfine/DecodeIR.html
Mostly these controllers are following the NEC Protocol! I have bought a remote control like yours!
lesizz11 months ago
How did you remove the glass bulb from the rest of the unit?
chr (author)  lesizz11 months ago
Its plastic, and its also threaded
KROKKENOSTER11 months ago
This is a clever way to do it I just wonder if the different colours draw different currents to generate the same light? Love your oscilloscope in any case
buttim11 months ago
Nice work. Could you please lift the quartz and take another picture of the PCB?
It seems like the chip under the quartz might be an Atmel Attiny85, a thing that would open plenty of possibilities
chr (author)  buttim11 months ago
There is no part number on the chip. It's not scraped off or anything, it's just unmarked :/
maxhuey11 months ago
Many people in north america have a tendency to add unnecessary comment on products made in China as "cheap". The fact is, you will not find cheap low quality products in China, but only in north america, Europe and most other developed countries around the world. This is because the merchants around the world are not willing to pay for good quality products, they just want the lowest possible prices so they can make the most profit for themselves. I travel to China at least twice a year and if you do too, you will notice that everything they used there are build to last and last they do, much longer than products made in other countries. Chinese manufacturers simply made products to fit what foreign merchants are willing to pay for, so as the saying goes - you get what you paid for... Westerners have no one else but themselves to blame for cheap products. Example: The wings of Boeing 767 are made entirely in China. Would you call that cheap too?
chr (author)  maxhuey11 months ago
These LED bulbs are really cheap, and have a low build quality. I have yet to see any RGB LED bulbs in stores here in Norway in the same price/quality range. But hey, I wanted cheap and in bulk, and that's exactly what I got. So I'm happy. You can probably find "better" ones on ebay, but we're going to use these things once a year for a company party, so I couldn't care less about the quality..
Maxhuey, I like your picture! I think you should get a different hobby though, instead of jumping on a band wagon and beating a drum about on little comment make in the articular about China " witch is the king of inexpensive stuff"! Only saying this because it will make you a biter person, life is to short, there are bigger and more important things you can do with your time and energy!
Malenaar11 months ago
Very good article
ccotton111 months ago
Yes Thanks, a very readable post. I had some a-ha moments, thanks to this
What a coincidence! I recently did the same reverse engineering although I didn't have an oscilloscope. I used a 38KHz IR receiver to read the signals and then decode the remote buttons. My remote was for controlling for RGB LED strip. But unluckily the controller box got destroyed during installation so I'm right now working on making a controller circuit(which will be inside your bulb) with more functions. Instructable coming soon. ;P
spizarro11 months ago
This procedure is very clean, didactic, and I learned some good points. How is it possible, no comments? Reverse engineering is such an interesting field.

Thanks a lot for this one!
chemicalvamp11 months ago
Good read, Wish you could have enhanced the bulb! Have you tried this hacking approach to other IR devices, or even a TV remote?

I have (kinda), and it unlocked debugging features, One button would cycle the TV from Red, Green, Blue, Normal. But for that 'hack' all i had to do was cut a hole in the plastic case to expose a button in the silicon keypad.
ArneTR11 months ago
Very nice! Thanks for sharing.

A friend of mine recently had a similar problem with the Philips Living Colours Light. The white is not really mixed well and has a bit of a yellow touch.
It uses some RF in the remote, but still, the approach should be pretty much the same.
studleylee11 months ago
Very Well done!!!
ssamc11 months ago
Nice tutorial. I learned a lot!
ethan170111 months ago
I hope that during your research, you came accross this Arduino IR library:
http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html
It saved me a lot of work when I reverse-engineered the IR protocol my airconditioner uses.
carlmal11 months ago
I've stripped a couple of these IR receivers to add DMX decoders. I was thinking about doing a reverse engineer on these as well to see if they would take a DMX signal in place of IR, but from what I gather, you just saved me tons of time!

Great Instructable. Keep 'em coming.
cobourgdave11 months ago
Nice piece of work. Easy to follow and well written
Thank you for sharing. I just bought a couple of LED strings with controllers similar to yours and am interested in understanding the design. Your Instructable will go a long way in helping.