How to get the IR Remote Control Protocol ?

Started by AmrReflection 5 years ago10 replieslatest reply 5 years ago8800 views

I have an Air Conditioner that I want to decode and then transmit its remote control signals through a Microcontroller and an IR transmitter. 

As far as I know there are different protocols for IR, so is there any way I can know which protocol does this remote use? The remote is rg56n/bgef from Carrier:

I am currently just making a proof-of-concept on an Arduino Board, but ultimately I would be implementing this project on an Atmega16
[ - ]
Reply by SpiderKennyOctober 7, 2019

You are right that there are a number of different IR prtocols.

None of them are very difficult to decode or emulate, so you are in luck!
I'm certain there will already by Arduino projects out there already for receiving, storing, and retransmitting IR codes just like you want to.

You could do worse than start by looking here:

If you wish to do it all yourself, and gain an understanding of how it all works as you go, then here are some hints.

1. The IR Signal is a modulated 36Khz or 38Khz. That is, it is a 36(38)KHz signal which gets turned ON or OFF to makes BITs.

2. The IR signal starts with a preamble - which is just a length of time with the 36(38)Khz carrier ON. Then a synch period (carrier off) followed by the bits.

3. The bits can be encoded in different ways. Some IR remotes use a fixed period for a bit and vary the duty cycle to distinguish 1 from 0. So say (for example, not real figures) a bit is 1ms long. A "1" might be 200ns of Carrier, followed by 800ns of no-carrier. And vice versa for a '0'.

4. Most remotes transmit a manufacturer code (8 bits) followed by a button code (8 bits). Sometimes ther are transmitted as 16 bits each but are actually 8-bits followed by the same 8-bits, but inverted.

5. When a button is held down, most remotes issue a HOLD signal which does not contain any bits, just a pre-amble and a long sync.

6. To re-transmit the signal you can use an IR Led, but somehow you need to modulate a 36 or 38 Khz carrier with your selected bit encoding. You might aslso get away with a standard RED led, depending on how close you are to the receiver.

7. Most remotes are not as smart as you think. For example, selecting FAN Speed - the remote has NO IDEA what speed you are on just now, it just sends a code for "faster" or "slower" but as soon as you add a micro, your users will want it to be smarter! They will be quite happy to select "up" "up" "up" on a hand-held remote, but if you give them a UI they will want "slow, fast, max" options instead! (Just an example)

Did I mention it might be easier to start with an existing project?

Good luck! Let us know how you get on!

[ - ]
Reply by AmrReflectionOctober 7, 2019

Thank you a lot for the explanation. It helped me a lot, for real.

I started by the basics and decoded the IR signal of TV remote controls. I then got struggling a bit with AC Remote Controls as they seemed to have more bits sent each time, and decoding them and re-sending the signals needed some tricks.

I mainly used the help of AnalysIR to decode the signal, and then used an Arduino Nano with IRremote library to re-send the signal.

I am currently in the final stages of the project, and if it would be helpful to people I'd make a whole article explaining all the stuff I did to get this working.

[ - ]
Reply by mr_banditOctober 7, 2019

The easiest way is to hook up an oscope to the IR LED and capture the waveform. TV remotes use a NRTZ (NRZ) (non-return-to-zero) protocol. Even TV remotes do not have a "standard" protocol in terms of what the bits mean. If you *really* want to delve into the TV remotes, get a tv-b-gone and see how Mitch did it.


I reversed engineered a TV remote in the early 90's. The basic tech remains the same. It took me a couple of days - not hard to capture && replicate the protocol. Should be easy to do with an arduino. Be aware the signal is modulated via a 38-40 kHz clock. Easiest way is to have a 40 kHz output and AND gate to modulate the IR LED.

You have two basic choices: open the case && use the scope to directly look at the IR LED. This is the best. The alternative is use an IR optotransistor to read the signals. In that case, try to minimize the outside IR noise - eg create a little light-proof box so the sun and lights do not swamp the IR LED signal.

If you want a hand-held device, consider an arduino mini-pro.

[ - ]
Reply by AmrReflectionOctober 7, 2019

Everyone told me oscilloscope is the way to go, but I couldn't get to reach one unfortunately.

I used an IR reciever (TSOP-3438) along with Arduino and AnalysIR program, and I was able to successfully decode the signals. Of course not the best way to learn since I used the aid of AnalysIR, but it worked in the end.

[ - ]
Reply by mr_banditOctober 7, 2019

Take a look at https://www.tequipment.net/Rigol/DS1054Z/Digital-Oscilloscopes/?v=0

$350 for a 4 channel 50 MHz oscope. I cannot mention there is a tool on the net that will change one byte in the eeprom to make it 100 MHz...

It also has the capability to analyze RS232 && other serial protocols.

This has 95+ % the capabilities (plus some others) of my 12yo $2400 Tek oscope.

goto harbor freight and get a hard case - get one large enough for both the oscope and the probes. Runs about $70.

And - AnalysIR - finding a good tool to solve the problem is a perfectly fine way of solving the problem.

[ - ]
Reply by s-lightOctober 7, 2019

for a really advanced library have a look at

originally by Ken Shirriff

i don't now for sure in what state the library is currently...
i used it some years ago with great success...

sunny greetings


[ - ]
Reply by AmrReflectionOctober 7, 2019

The library works very well with remote controls, just struggles a bit with new AC remotes because there signals are long.

[ - ]
Reply by rtomkinsOctober 7, 2019

Some super information here.

Moons ago I had stumbled across something, and just tracked it down.

The infrared remote database, irdb.

[ - ]
Reply by CustomSargeOctober 7, 2019

It's a Lot Easier to determine the carrier freq, buy the matching IR receiver and then learn each command pattern. A 555 drives an IR LED just fine, use reset to modulate the pattern.

I wrote my 1st A/V system remote in C+ in '97 using a laptop. I was lucky everything was 38k back then.

[ - ]
Reply by AmrReflectionOctober 7, 2019

90% of all the remotes I tried used the 38kHz modulation, probably that's the most common and where you should star.