Microcontrollers

IR Remote Protocols Explained: NEC, RC-5 and IrDA for Makers

IR Remote Protocols Explained: NEC, RC-5 and IrDA for Makers

Pointing a remote at a TV just works, with no pairing screen and no password. That is the quiet advantage of infrared: the beam is directional and walls block it, so a neighbor’s phone cannot snoop on your gadget the way a Bluetooth radio might.

What Hackaday’s IR deep dive covers

Hackaday’s write-up on IrDA and other infrared protocols walks from the humble TV remote to full data links. Consumer remotes ride on a roughly 38 kHz carrier. NEC uses pulse-distance encoding, while Philips RC-5 uses Manchester encoding, and each protocol defines address and command bit fields so a receiver knows whether the message is meant for it. The cheap 24-key RGB light strip remotes almost all speak NEC, which makes them easy targets for microcontroller projects.

IrDA goes further. It is a full standard from the Infrared Data Association, once used to move files between laptops such as the ThinkPad T40 and T42, and it shows that light can carry real data, not only button codes.

Technical details that matter on the bench

A bare IR LED cannot decode anything by itself. Receivers like the TSOP38238 demodulate the 38 kHz carrier and hand your MCU a clean digital signal on one data pin, so the GPIO only measures pulse lengths. A few gotchas:

  • Drive the transmit LED through a transistor, since a GPIO pin on an ESP32 or Arduino Uno tops out around 20 to 40 mA.
  • Power the receiver at 3.3V or 5V, and add a 100 nF capacitor close to its supply pin to keep noise out.
  • Sunlight and LED bulbs flood the sensor with infrared, so test indoors first.

Build it yourself

Wire a 38 kHz IR receiver to one GPIO pin on an Arduino or ESP32, install the IRremote library, and print the raw NEC codes from the remote lying on your desk. Then map each code to a relay or an RGB strip. For thesis or classroom work, that is a clean demo of encoding, timing and decoding. Grab the receiver and IR LEDs at circuit.rocks, and read the TI MSP430 application note linked in the Hackaday article for the modulation details.

Frequently Asked Questions

What carrier frequency do most IR remotes use?

Most consumer remotes modulate their signal on a carrier of about 38 kHz. NEC uses pulse-distance encoding and Philips RC-5 uses Manchester encoding on top of it.

What parts do I need to read an IR remote with a microcontroller?

A 38 kHz IR receiver module such as the TSOP38238, an Arduino or ESP32, a few jumper wires and the IRremote library. Add an IR LED and a transistor if you also want to transmit.

What will I learn if I build this?

You will practice reading timing-based digital signals on a GPIO pin, learn how modulation and encoding work, decode protocol frames in code, and control relays or LED strips from the codes.

This article was inspired by reporting from Hackaday. Find the parts and modules to build it at Circuitrocks.

// written by Ann Arandia

Ann Arandia covers community projects and maker events for the Circuitrocks blog. She writes about local workshops, kid-friendly electronics, and the Philippine maker scene — the people, the meet-ups, the projects that come out of them.