Introducing Infrared Remote Control Protocols

The host stands in his electronics lab with the image of four remote controls overlaid.

Over on his YouTube channel [Electronic Wizard] has released a video that explains how infrared (IR) remote controllers work: IR Remote Controllers protocol: 101 to advanced.

This diagram indicates how the 38 kHz carrier wave is used to encode a binary signal.This video covers the NEC family of protocols, which are widely used in typical consumer IR remote control devices, and explains how the 38 kHz carrier wave is used to encode a binary signal.  [Electronic Wizard] uses his Rigol DS1102 oscilloscope and a breadboard jig to sniff the signal from an example IR controller.

There is also an honorable mention of the HS0038 integrated-circuit which can interpret the light waves and output a digital signal. Of course if you’re a tough guy you don’t need no stinkin’ integrated-circuit IR receiver implementation because you can build your own!

Before the video concludes there is a brief discussion about how to interpret the binary signal using a combination of long and short pulses. If this looks similar to Morse Code to you that’s because it is similar to Morse Code! But not entirely the same, as you will learn if you watch the video!

23 thoughts on “Introducing Infrared Remote Control Protocols

  1. My current phone (Xiaomi 12 Lite) has IR port and IR Remote App “MI Remote”. It has a very good database of TV and other devices. Not sure if you can download open source of it.

    1. My HTC One M7 had an IR port hidden in the power button. Only used it once, with a DVD player so cheap it didn’t have a play button on the front, and the remote was nowhere to be found. It took a while to find a compatible remote profile, but I only needed to press the one button.

  2. It still amazes me that nearly every TV remote control is infrared and has to be pointed towards the television while a lot of them also have a bluetooth connection for voice commands, which is still not used for the infrared functions.

    1. I live in a room about 14×14 feet and can testify that it doesn’t matter if you point the controller at the TV or not, it reflects; pulp can move, Baby! This can be defeated by holding the remote pointed at the floor from a few inches above it. A few feet above the floor and it works fine. This can be tested by covering the LED directly at the TV but covering the LED with your palm. When I’m dozing or snoozing I just point the remote in any direction, including directly away from the TV. Experimentum mater studiorum est.

  3. A few years ago, I integrated an Arduino Nano into a JVC CD player in my hi-fi system so that it could read the Yamaha RC protocol for the receiver—the remote control of which includes buttons for a CD player.

    It’s very easy with an Arduino + RC library : I first analyzed which type of protocol is used on a particular device. Then, I simply used the original IR sensor to feed the Arduino which then control the required buttons with a few transistors. No need to remove the original remote control system.

    1. Did something similar once, except protip you can avoid the transistors completely by wiring the micro pins directly to the sense side of the buttons and abusing the fact the gpio can go high impedance when set to input with pullups disabled. So initially configure the output that way and when you want it to “press” a button just set it to output low and back to input w/o pullups when you want it to release the button. I did exactly this when I wanted to wire up a bluetooth controller to a gameboy to control it wirelessly and it worked fantastically.

  4. I would like to learn more about the IRdA protocol. Millions of devices use(d) it although I’m not sure how prevalent it is now. I still ports on various public interfacing devices which makes me curious about possible vulnerabilities (I believe there is a CVE). It’s an interesting infrared protocol that doesn’t seem to get as much attention.

    1. IrDA is even simpler: light on = ‘0’, light off = ‘1’. OK, I’m over-simplifying; let me clarify:

      IrDA has a basic form called ‘Serial Infrared’ (SIR) which is little more than hooking an LED to a UART. ‘little more’ == ‘the light is on only for 1/16 of the bit period, not the whole bit period’. The reason for ‘light on = 0’ is because UART is normally in the ‘1’ state when quiescent. The reason for the 1/16 bit period is because IrDA was intended for battery devices, and power draw is a concern.
      IrDA SIR goes up to 115,200 bps. There are fancier things like ‘Fast Infrared’ (FIR) and others which use a different signaling scheme and cannot be directly connected to a UART.
      most microcontrollers that have a UART have an IrDA option that basically turns on stuff to deal with the 1/16 bit timing and also inhibits RX while there is data in TX. (to avoid receiving your own transmitted signal)

      That alone will get you basic UART-esque connectivity between devices. Beyond that it’s all software. IrDA specifies a layered communications stack reminiscent of OSI and TCP/IP of 80’s era fame. Some consider it overengineered. In the day you had to pay to have access to the specs, but you can easily find them from a web search. Use terms like “irlap”, “irlmp”, “tinytp” and you’ll find details.

      An amusing thing is that although IrDA is largely dead now (except for niches like scuba equipment, apparently), a part of it ‘obex’ lived on in BlueTooth.

  5. the history of IR remotes is interesting because it is a circuitous route of:

    a Zenith exec wanted to mute commercials, and developed a scheme where you pointed a flashlight at the TV to do things. no carrier, obviously susceptible to ambient interference. q.v. “Smart-matic”
    this led to a fancier scheme involving striking ultrasonic tuning forks, called “Space Command”. They made sharp sound when the hammer hit the rod, giving rise to the ‘clicker’ epithet
    IR came about and re-used the ultrasonic frequencies simply for manufacturing economics — why redesign what’s already in production?
    similarly, the common (but by no means only) frequency of 38 KHz was specifically chosen for manufacturing economics — you could take a mass market 455 KHz IF ceramic resonator commonly used for AM radios and divide it by 12.

    So what was born in light ended in light, but passed through ultrasonics, picking up some physical design artifacts along the way.

  6. I have always wondered what would happen if few watt Ir laser was modulated with remote signals what could happen over on the other side of town where all the high rises are? TV begone over a large area? With all the big screens and a telescope one could monitor the results.

    1. transmit all the codes; should be able to observe a dimming of the building at night as TVs turn off.
      in the 80’s one could get a radar gun for cheap at a police auction. it didn’t matter if it worked — if you turned it on at night, you would see a christmas tree of break lights down the road ahead as folks’ radar detectors went off. the things we thought were fun…
      some cheap ‘universal’ remotes worked that way: to program it, you turned on your TV, then you held down the power button. After a few seconds it would sequentially start through all known protocols. When your TV turned off, you released the button, and the control assumed that was the protocol for you. Then the other buttons worked as expected.

  7. Since a number of us have a bunch of old IR remotes lying around, and likely have a bunch of scrap electronics with IR receivers that demodulate the 38khz, IR is quite a handy way to control projects with a single GPIO pin. (Recent project: I have my TV hooked up to old 2.1 computer speakers, but they only have a wired remote; using various scrap items and a bit of 3D printing I cobbled together a setup that physically turns the volume knob, controlled by unused buttons on my Blu-Ray player IR remote. There was some trial and error in figuring which pin of the receiver was which. I have some digitally controled solid state potentiometers I could use instead, but it’s more fun to hear the motor whirr and turn the knob.)

  8. I wish I would have found this article sooner! I built a timed trigger to turn on my space heater 30 mins before I got up in the morning. I could have used an RTC module but decided it would be fun to dissect a $2 alarm clock from the thrift store. I salvaged some IR leds from old remotes too. The heater had a remote but it was pretty useless. I scoped that remote to understand the Tx protocol and what signal was “ON” for the heater. A lot more scoping, MCU programing, and soldering later, it worked! Still proud of my Frankenstein heater timer.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.