How to read codes from (many) IR remote controls with as little code as possible
A developer builds a minimalist, zero-dependency NEC infrared protocol decoder on an nRF52840 microcontroller to control Mac media playback using cheap remotes.
summary is enough The article offers a lightweight approach to IR decoding, but the code snippets are brief and the value lies mainly in avoiding bloated libraries.
summary
The author wanted an inexpensive way to control a Mac media player using an ordinary IR remote, avoiding heavy libraries like LIRC or Arduino IRremote. By studying the NEC infrared protocol standard, they wrote custom code for an nRF52840 microcontroller. The project uses a cheap VS1838B IR demodulator receiver and leverages hardware-level CPU counters for precise timing. Ultimately, it exposes custom key mappings as a USB HID keyboard.
key points
- The project avoids bloated libraries like Arduino's IRremote or LIRC by implementing a custom, minimalist NEC protocol decoder.
- Precise timing relies on the nRF52840 hardware counter rather than standard microcontroller micros functions, which often lack necessary resolution.
- Inexpensive VS1838B demodulators filter out the 38KHz carrier wave, outputting active-low signals that can be read directly by microcontrollers.
who should read it
Embedded systems hobbyists and developers looking to integrate inexpensive IR remotes into custom hardware projects without heavy dependencies.
discussion positive
consensus
Commenters discuss the quirks of different IR protocols, noting that A/C remotes transmit entire device states rather than incremental commands to keep remote and unit screens synchronized.
pushback
Some express frustration over the loss of comprehensive legacy IR code databases like Logitech Harmony's, which made universal control much easier.
I actually did this too, with a lot of different remotes, in micropython on a plain pi pico -- quite fast enough.
Different remotes use different formats, a lot of them repeat the actual data twice. Most interesting were the remotes for our minisplits, which tranmit the whole state for the minisplit, followed by a second message indicating half degrees -- presumably, older minisplits could only do whole degrees so they added a second message.
Transmitting the words is more challenging, the IR LED needs to be pulsed (modulated) around around 38 khz, and there are potentially different …
It adds practical insight from another developer who built a similar setup, highlighting how A/C minisplit remotes transmit full state rather than single commands.
Generated by an LLM from the article and thread. Check the sources before relying on it.