How Does A Remote Control Work?by@thecashit
320 reads
320 reads

How Does A Remote Control Work?

by LOOK.inJanuary 10th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

For the last 3 years we have been working with IR signals every day. And all this time we learn something new. Let's find out how it works!

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - How Does A Remote Control Work? HackerNoon profile picture

Hi, I am CTO at Remote. This is a universal Wi-Fi+IR smart home control.

For the last 3 years we have been working with IR signals every day.

And all this time we learn something new.

When we start working with new clients, make posts about our product or hiring new employees, we see interest in how IR remote control works.

Let’s find out how it works… Let’s go!

When you point the TV remote control at the TV to watch your favorite movie, and press the button on the remote, the IR diode in the remote starts to emit a signal, and the IR receiver on the TV receives the same signal.

IR diode is just a light bulb that glows in infrared light in the invisible spectrum for us. Therefore, for simplicity of description let us represent the IR diode, which is remote from the air conditioning or television simply flashing light.

Converting light to numbers

But how to turn on the TV with the help of an IR lamp?

In the TV remote control there is a transmitting IR diode, and in the TV itself there is an infrared receiver that can read the flashing of the IR diode in the remote control.

Almost any command transmitted by the remote control is a set of binary data — 1 and 0. The remote control sends the command to the TV “turn on” — the TV turns on, sends a command to increase the volume — the TV increases the volume.

Each such command is just a collection of 1 and 0. Each manufacturer determines the list of commands himself, relying only on his own idea of how it should be. Nevertheless, there are certain standards that, in our experience, very few follow.

For example, for most common Samsung TVs, the switch on code is 0xE0E040BF.

This is the hexadecimal representation of the command.

Digging deeper, the command looks like the following set of 1 and 0:


Now let’s take a look at how this code looks in a graph.

The red curve in the upper part — the light (IR diode in the Samsung TV remote control) is on, the red line in the lower part — the light is off.

Pic 1: This is how the signal to turn on Samsung TV looks like on the graph

Most computing devices operate 1 and 0.

Perhaps the only reliable way to encode 1s and 0s when transmitting over IR is to encode them using the duration of when the IR diode (our conventional light bulb) is lit and pauses. Distinguish between IR protocols with a leading zero and a leading one, but let’s leave that out of the narrative brackets.

Specifically in this protocol (NECx2) for Samsung TVs 1 and 0 are encoded as follows:

  • Pulse (light is on) 600 μs and then a pause (light is off) at 600 μs is 1
  • Pulse (light is on) 600 μs and then pause (light is off) at 1600 μs is 0

Cleverly, right?

Let’s take another look at our graph and mark 1 and 0 on it:

Pic 2: binary digits in a signal from a Samsung TV

Summary: 0 and 1 are encoded only by how long the IR diode (light bulb) lights up and how long it doesn’t.

An attentive reader will ask “What then are these strange bursts on the left side of the IR signal on Pic1?” And here we naturally move on to the second part of the story — to IR protocols.

The amazing world of IR protocols

There are many different IR protocols in the IR world. I will not be wrong if I say that the most widespread IR protocol is NEC. Almost 100% it can be argued that you have a remote control at home that uses this protocol.

But there are dozens of other protocols popular with home appliance manufacturers.

How to distinguish them?

The preamble helps with this, the initial code that determines which IR protocol is used. Some unique feature of the protocol.

Seeing it, the receiver of the TV, Cable-Box or receiver understands — aha — the signal is most likely addressed to me and starts listening.

For the NEC protocol family, the preamble consists of a period of 9000 µs when the IR-diode is on and then a pause (IR diode is off) of 4500 µs. For a signal from a Samsung TV, such a preamble is the glow of the IR diode with a duration of 4500 μs and then the same pause.

If we begin to describe now all the existing IR protocols, the reader will quickly fall asleep, and I will never finish the story until a ripe old age. So let’s take a quick look at the NEC family to digest the material.

First there was the most canonical NEC IR protocol (now better known as NEC1), and the idea was good: in a 32-bit IR signal, the location was as follows:

Pic 3: IR protocol NEC1 (image from Altium)

That is, the first 8 bits are an address, something like device ID, then the same address in inverted form (for verification)

Bits 16–24 are the command, then it is inverted.

The idea was good and could lead to standardization, Address, for example, could be the type of device — TV, Cable-Box or something else, and the command could be an action, for example, “Increase volume” or “Turn on”. But something went wrong …

At first, 256 possible commands were no longer enough for some manufacturers and the NEC1x protocol appeared

Pic 4: IR protocol NEC1 (image from Altium)

And then the addresses of 256 values were no longer enough and such protocols as NECx2 began to appear (just the same is used in some Samsung TV models with which we began this story).

There are such protocols as Denon, the Sony protocol family (often they have a feature that you need to transmit one signal at least twice with a given pause), Kenwood like NEC1 with add-ons, RC5, RC6 and many many others …

IR codes notations


Since IR transmission is simply “glowing” and “not glowing”, then initially the simplest and most visual recording is a recording in the so-called raw form. Positive numbers — the IR diode is on, negative — not lit.

An example of a raw recording of a signal from pic1:

4570 -4420 620 -1610 590 -1640 620 -1610 620 -490 600 -510 590 -520 620 -490 620 -490 620 -1610 620 -1610 620 -1610 590 -520 620 -490 620 -490 620 -490 620 -490 590 -520 620 -1610 620 -490 600 -510 590 -520 620 -490 620 -490 620 -490 590 -1640 620 -490 620 -1610 620 -1610 620 -1610 620 -1610 620 -1610 600 -1630 620 -45000
4570 -4420 - preamble, protocol identifier
620 -1610 - binary digit 0
590 -1640 - binary digit 1-45000 - a final pause, the end of the transmission.

Each next value changes its sign to the opposite, which is very logical.


But there are also alternative common recording methods, for example, the ProntoHEX format, in which the same signal looks like this:

0000 006D 0022 0000 00AB 00AB 0018 003D 0014 003D 0018 003D 0018 0014 0014 0014 0014 0014 0018 0014 0018 0014 0018 003D 0018 003D 0018 003D 0014 0014 0018 0014 0018 0014 0018 0014 0018 0014 0014 0014 0018 003D 0018 0014 0014 0014 0014 0014 0018 0014 0018 0014 0018 0014 0014 003D 0018 0014 0018 003D 0018 003D 0018 003D 0018 003D 0018 003D 0014 003D 0018 06AE

Everything is a little more interesting here, since the first 4 blocks are service ones:

0000 - Signal characteristic, 0000 - new, 0001 - learned
006D - Carrier frequency of the IR signal (more on this in the next chapter)
0022 - Length of the one time burst (the initial action signal)
0000 - Length of the second burst (the repeat action, when holding down button)

And then, block by block, the initial action signal and the repeat action signal are presented, calculated using a special formula.

Command based notation

An IR command can be recorded just like the command it carries.

As with our example of enabling TV Samsung — 0xE0E040BF.

In this case, be sure to indicate the protocol.

Alternative notations

Some manufacturers of smart remotes come up with their own schemes for recording IR signals, but they are very specific and are not the subject of this article.

IR signal specifications

Infrared Receivers and Transmitters have two very important characteristics:

The carrier frequency

The IR diode does not just glow with a solid light, it constantly turns on and off, just like LED lighting, by the way. It happens very quickly. One of the most common IR frequencies is 38 kHz, which corresponds to 38,000 blinks per second. This feature of operation allows the IR receiver to distinguish the signal from the remote control from external IR noise.

A side effect is that if your remote control operates at a frequency of 40 kHz, and the receiver, for example, at 36 kHz, then everything will work closely, but already at a distance is not a fact. Moreover, if both the receiver and the transmitter are matched — they have the same frequency, then the operating range will be much better.

The most common frequencies are 36 kHz, 38 kHz, 40 kHz. 56 kHz are extremely rare. There are also very rare ones, for example, Bang & Olufsen equipment operates 455 kHz.

Duty cycle

In fact, the duty cycle of the signal means the ratio of the duration of the glow of the IR diode to the pause after that. Remember, after all, that it lights up several tens of thousands of times per second? Here the duty cycle shows how long the pause is after that.

Both of these characteristics are important for your device’s remote to work well with it. When we talk about universal remotes, the duty cycle and signal frequency are not always known, so they almost always work a little worse. For example, they have a shorter operating range compared to the original remotes.

Comparison of IR signals

And now some more magic.

Do you remember our signal from turning on the TV?

4570 -4420 620 -1610 590 -1640 620 -1610 620 -490 600 -510 590 -520 620 -490 620 -490 620 -1610 620 -1610 620 -1610 590 -520 620 -490 620 -490 620 -490 620 -490 590 -520 620 -1610 620 -490 600 -510 590 -520 620 -490 620 -490 620 -490 590 -1640 620 -490 620 -1610 620 -1610 620 -1610 620 -1610 620 -1610 600 -1630 620 -45000

So every time the TV receives it, it will receive it a little differently. Since we are talking about a large number of blinks and a very high frequency, errors are inevitable. Imagine that your friend is blinking a lamp, and you need to keep track of how long it was on with the help of a stopwatch. Each time you do this exercise, the numbers will be slightly different.

For example, the preamble can be taken as:

4570 -44204600 -44004610 -44104580 -4390

And it’s all one IR signal!

Therefore, raw IR signals can never be compared by simple comparison. Digit by digit is sequentially compared, and if the difference between them does not exceed 15–25%, then it is considered that the signal matches.

ProntoHEX partly helps with this, but it also uses rounding and you can’t just take and compare two signals for identity.

However, if the signal has already been decoded and is a ready-made command and protocol, then such a comparison is quite possible.

And what happens if I hold down the button on the remote control and hold it for a long time?

Surprisingly, in most of the protocols that we have encountered, one single command will be sent, and then periodically a short repeat signal. The frequency of sending the repeat signal depends on the protocol

In the NEC protocol discussed above, the repeat signal looks something like this

Pic 5: IR protocol NEC1 repeat signal (image from Altium)

That is, if you pressed the volume up button, then an “initial message” is sent first, and then a short repeat signal every 10 times per second. And as long as you hold the button, the signal will repeat.

The TV can react to this in an appropriate way: first, turn up the volume slightly, and after a few seconds, with higher values.

Repeat signals differ from protocol to protocol, and in some it is not provided in principle, while you keep the button pressed — the “initial message” is simply repeated over and over again.

Air conditioner remotes

And if before that everything was pretty simple:

  • The «Switch on” button on the remote control is pressed and the TV turns on
  • You press the channel switch button — the channel changes to plus or minus
  • You press the HDMI input change button — the input changes

Then in AC units everything is more complicated.

All data is sent in one IR signal at once — temperature, operating mode, shutter position, fan, timers and many other service parameters.

Moreover, quite often the signals from air conditioners are divided into several blocks with fixed pauses, and each block of the IR message is signed using a CRC (again, different for different protocols)

But this is a completely different wonderful world.

If you are interested in this publication, and my written English is not very terrible, later we will release an article on how IR works in Air Conditioners remotes 😊😁

Thank you for attention.

Write in the comments if you liked the article or it was not useful and give tips on what can be improved. Any feedback is appreciated.