This (first) tutorial is here to sum up some work I did to clone an IR remote. This is part of a more global project about saving power by switching off idle systems (hifi, tv, ...) when not in nominal use.
If you follow my steps, you will basically be able to clone any standard IR remote.
Please note that being French, you will avoid my thick accent when reading this tutorial but not my spelling and grammar mistakes. So if something is not clear, feel free to signal it !
Step 1: What Do You Need ?
Here are the required items :
• the remote you want to clone
• one arduino UNO (or whatever micro-controller that has an IR library available)
• an IR receiver, I used a VS1838B (works for 38 kHz modulation)
• an IR diode (I use what I found on aliexpress, just check it emits at the 940 nm wavelength)
• a USB logical analyzer and its display software
• a 100 ohms resistor
Step 3: Analyzing the Protocol
As you can see, my day job is not photograph, but the setup is quite easy :
GND (UNO) goes to GND(VS1838B) and GND(analyzer)
5V (UNO) goes to VCC (VS1838B)
OUT(VS1838B) goes to a digital channel
As an option, you can also hook up this signal to the digital pin 13, as it is linked to the internal led and will allow you to see when an IR signal is received (blinking).
When everything is setup, connect the UNO to a power source and try to use your remote pointing towards the VS1838B. If it's ok, you should see the UNO internal led blinking (it's on as far as there is no IR signal).
At this stage, you can make the measurement, connect your signal analyzer, launch its software. I used a 2 seconds window with a 8 MHz sampling rate (overkill for 38 kHz, I know but safe...), you just have to hit the key you want to clone during that window.
As you can see the result consists in two bursts with a 25 ms delay inbetween.
To get a more simple code, use the IRremote library (look here) and modifiy the IRrecvDump sketch to use pin 13.
My signal is decoded as a NEC protocol one with hex value 0xA55A38C7.
Step 4: What the Heck ?
Ok, why getting in all that trouble when one could only use the IRrecvDump sketch and play back the code ?
Well, just because that sketch seems to analyze only single bursts and that my remote had the bad idea to send two in a row with a given delay inbetween.
Is that standard ? I have no clue and leave that question to experts, but what I know is that my hifi amplifier didn't recognize the single burst signal and I tried EVERYTHING (5 cm away, more power, capacitor, ...).
Step 5: Simulating the Remote
For the setup, use this one.
I used this sketch (customization of the example of the IRremote library)
Step 6: Afterthougt
To clone an IR remote with an arduino, you may have two extreme ways :
• The simple way, seems to work with Sony type remotes (my TV) : use IRrecvDump and play back the code;
• The hard way consists in analyzing the signal and reproducing the raw output (you can even do it with a sketch that outputs this signal with a 38 kHz modulation).
But, this tutorial gives you a third method, just in between, feel free to use it if you're stuck with a "strange" protocol and don't want to try the hard way.