<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-read-codes-from-many-ir-remote-controls-with-as-little-code-as-possible-zja0hkr1m" -->

---
title: How to read codes from (many) IR remote controls with as...
description: A developer built a minimal-code decoder for NEC-protocol IR remote signals to restore media playback controls on a MacBook. The project uses a Seeed Xiao...
canonical: https://daily.dev/posts/how-to-read-codes-from-many-ir-remote-controls-with-as-little-code-as-possible-zja0hkr1m
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to read codes from (many) IR remote controls with as little code as possible | daily.dev
og:description: A developer built a minimal-code decoder for NEC-protocol IR remote signals to restore media playback controls on a MacBook. The project uses a Seeed Xiao...
og:url: https://daily.dev/posts/how-to-read-codes-from-many-ir-remote-controls-with-as-little-code-as-possible-zja0hkr1m
og:image: https://api.daily.dev/og/posts/zJa0Hkr1m.png
og:image:alt: How to read codes from (many) IR remote controls with as little code as possible
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to read codes from (many) IR remote controls with as little code as possible

**[Hacker News](https://daily.dev/sources/hn)** · 8 min read · 1 upvotes · 0 comments

## Summary

A developer built a minimal-code decoder for NEC-protocol IR remote signals to restore media playback controls on a MacBook. The project uses a Seeed Xiao nRF52840 board with a VS1838B IR demodulator soldered directly to header pins. NEC encodes bits with pulse distance modulation: a logical '0' is a 562.5µs mark plus 562.5µs space, a '1' has a 1687.5µs space. The author found real remotes send a 3+3ms start burst instead of the spec's 9+4.5ms, and simplified timing math by dividing by 512 instead of 562.5. The finished device acts as a USB HID keyboard, sending keys like space for play/pause and arrow keys for seeking.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://bitbanksoftware.blogspot.com/2026/11/how-to-read-codes-from-many-ir-remote.html>

## Questions this post answers

### How are logical 0 and 1 bits encoded in the NEC infrared remote control protocol?

NEC protocol uses pulse distance encoding. A logical '0' is a 562.5 microsecond mark followed by a 562.5 microsecond space, totaling 1.125ms. A logical '1' is a 562.5 microsecond mark followed by a 1687.5 microsecond space, totaling 2.25ms. After the start phase, 32 data bits follow: an 8-bit address, its inverted value, an 8-bit command, and its inverted value.

_Building an IR receiver on daily.dev-tracked embedded platforms? Keep NEC timing specs like these on hand._

### Why does my nRF52840 Arduino micros() function return inaccurate timing for IR signal decoding?

The Arduino micros() implementation on nRF52840 can default to a low-resolution, interrupt-driven RTOS tick counter instead of the hardware cycle counter. The nRF52840 has a DWT (Data Watchpoint and Trace) cycle count register that increments at CPU clock rate, but it must be explicitly enabled; without it, timing-sensitive IR decoding produces random or invalid values.

_Developers debugging MCU timing quirks can compare notes on nRF52840 firmware behavior via daily.dev._

### What hardware do I need to build a DIY IR remote receiver for a microcontroller project?

A Vishay IR demodulator such as the TSOP1836 or VS1838B pairs with a 5mm IR LED, costing about $5 for 10 pairs of receivers and LEDs. The demodulator strips the 36-40KHz carrier wave and outputs an active-low open collector signal, drawing only a few microamps, and can coexist on an I2C bus alongside other IoT devices with a QWIIC socket.

_Hobbyists sourcing cheap IR hardware for MCU builds can track component guides like this on daily.dev._

## Community take

How the wider developer community reacted, aggregated from 1 discussion and 16 comments across hackernews (as of 2026-11-15).

**TL;DR:** Commenters mostly share related experience and extensions to IR remote decoding—like minisplit remotes transmitting full state and sync issues—with appreciation for the write-up, plus a notable tangent about a now-defunct Harmony IR code database.

**Sentiment:** 55% positive · 40% mixed · 5% skeptical

**The case for**

- Several people shared their own successful similar projects decoding IR remotes with microcontrollers.
- One commenter noted the write-up's approach could help identify obscure remotes using a separately archived IR code database.

**The pushback**

- One commenter couldn't get their minisplit to accept a transmitted code, suspecting the IR LED wavelength was wrong.

**By community**

- hackernews (positive): Discussion is largely appreciative, focused on sharing related IR remote experiences and a tangent about a defunct universal remote IR database.

**Open questions**

- Does a publicly available, comprehensive database of consumer electronics IR codes exist now that Harmony's has been discontinued?
- Why does transmitting a code back to a minisplit sometimes fail (e.g. due to LED wavelength mismatch)?

**Highlights**

> 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 wavelengths.  So far have not been able to get our mini splits to accept a code I send to them, I suspect my LED wavelength is wrong.
> — [MatthiasWandel on hackernews · 1 comments](https://news.ycombinator.com/item?id=50507330)

> I was a happy user of Harmony IR all-in-one remotes for many years, but alas some time after the takeover by Logitech they gave warning that they would end their IR remote control product line. Open source projects like Concordance and Congruity that had popped up soon died off. https://members.harmonyremote.com/EasyZapper/ I implored Harmony/Logitech many times over to open source their vast database of IR codes, or at least make it available. Now it seems to have been squandered, meaning that a project like this OP one has to use a learning-mode per device and cannot select from almost every known consumer electronic IR code that Harmony enjoyed. Does such a publicly available database exist? Many cheap all-in-one IR remote controls came with printed tables of numeric codes, but those were not the actual IR codes themselves and were not universally applied across brands. Nowadays a Sofa Baton (IR & Bluetooth) remote does the job.
> — [cf100clunk on hackernews · 1 comments](https://news.ycombinator.com/item?id=50508867)

> I archived their IR database: https://github.com/pickysysadmin/logitech-harmony-ir-archive The last device I pulled was a TCL 75Q77K which might have been released around March 2025 which was 2 months before Logitech announced the discontinuation of Logitech Harmony Remote Software so they might be done adding new devices. I dunno.
> — [fizi on hackernews · 1 comments](https://news.ycombinator.com/item?id=50509238)

> True! Used to have an A/C unit with this problem. Covering the IR emitter with a finger would desync the remote's state and that of the actual unit. Temperature was the easiest to sync back: just keep lowering it until both systems reach the temperature floor. This problem still shows up today in limited forms. I have several A/C units of the same model and the same remote. Sometimes the remotes get mixed up and I end up trying to use a remote in the A/C off state to control an A/C that's on, and it does nothing because the remote ignores most button inputs if it thinks the A/C is off. I have cover the IR emitter and "turn it on" first.
> — [matheusmoreira on hackernews · 1 comments](https://news.ycombinator.com/item?id=50507939)

**Source threads**

- [hackernews](https://news.ycombinator.com/item?id=50457979) · 49 points · 16 comments

## Similar posts on daily.dev

- [The Fascinating World Of IrDA And Other Infrared Protocols](https://daily.dev/posts/the-fascinating-world-of-irda-and-other-infrared-protocols-xl7bnzc41) · Hackaday · 0 upvotes · 0 comments
- [Convert old IR remote controls into presentation clickers using an RP2040 USB board and open-source TTVKTR firmware](https://daily.dev/posts/convert-old-ir-remote-controls-into-presentation-clickers-using-an-rp2040-usb-board-and-open-source--gdyplywaf) · CNX Software · 0 upvotes · 0 comments
- [Simple, Reliable RF Remote Control](https://daily.dev/posts/simple-reliable-rf-remote-control-wx0vwhgpx) · Hackaday · 0 upvotes · 0 comments
- [Someone made an Arduino-powered NFC scanner that treats physical movies like cartridges](https://daily.dev/posts/someone-made-an-arduino-powered-nfc-scanner-that-treats-physical-movies-like-cartridges-blzsod2hj) · XDA Developers · 0 upvotes · 0 comments
- [IRis Learning Remote Has Five Buttons, Supports Thousands Of Devices](https://daily.dev/posts/iris-learning-remote-has-five-buttons-supports-thousands-of-devices-wvumb6zgs) · Hackaday · 1 upvotes · 0 comments

---

Tags: [#iot](https://daily.dev/tags/iot), [#embedded](https://daily.dev/tags/embedded)

[View this post on daily.dev](https://daily.dev/posts/how-to-read-codes-from-many-ir-remote-controls-with-as-little-code-as-possible-zja0hkr1m)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to read codes from (many) IR remote controls with as little code as possible","url":"https://daily.dev/posts/how-to-read-codes-from-many-ir-remote-controls-with-as-little-code-as-possible-zja0hkr1m","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-read-codes-from-many-ir-remote-controls-with-as-little-code-as-possible-zja0hkr1m"},"datePublished":"2026-11-15T20:44:46.280Z","dateModified":"2026-11-15T20:55:47.797Z","description":"A developer built a minimal-code decoder for NEC-protocol IR remote signals to restore media playback controls on a MacBook. The project uses a Seeed Xiao...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/250e9bea49f3f9798d04aef6959435b1?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/250e9bea49f3f9798d04aef6959435b1?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-read-codes-from-many-ir-remote-controls-with-as-little-code-as-possible-zja0hkr1m","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"iot,embedded","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"How to read codes from (many) IR remote controls with as little code as possible"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-read-codes-from-many-ir-remote-controls-with-as-little-code-as-possible-zja0hkr1m#faq","mainEntity":[{"@type":"Question","name":"How are logical 0 and 1 bits encoded in the NEC infrared remote control protocol?","acceptedAnswer":{"@type":"Answer","text":"NEC protocol uses pulse distance encoding. A logical '0' is a 562.5 microsecond mark followed by a 562.5 microsecond space, totaling 1.125ms. A logical '1' is a 562.5 microsecond mark followed by a 1687.5 microsecond space, totaling 2.25ms. After the start phase, 32 data bits follow: an 8-bit address, its inverted value, an 8-bit command, and its inverted value. Building an IR receiver on daily.dev-tracked embedded platforms? Keep NEC timing specs like these on hand."}},{"@type":"Question","name":"Why does my nRF52840 Arduino micros() function return inaccurate timing for IR signal decoding?","acceptedAnswer":{"@type":"Answer","text":"The Arduino micros() implementation on nRF52840 can default to a low-resolution, interrupt-driven RTOS tick counter instead of the hardware cycle counter. The nRF52840 has a DWT (Data Watchpoint and Trace) cycle count register that increments at CPU clock rate, but it must be explicitly enabled; without it, timing-sensitive IR decoding produces random or invalid values. Developers debugging MCU timing quirks can compare notes on nRF52840 firmware behavior via daily.dev."}},{"@type":"Question","name":"What hardware do I need to build a DIY IR remote receiver for a microcontroller project?","acceptedAnswer":{"@type":"Answer","text":"A Vishay IR demodulator such as the TSOP1836 or VS1838B pairs with a 5mm IR LED, costing about $5 for 10 pairs of receivers and LEDs. The demodulator strips the 36-40KHz carrier wave and outputs an active-low open collector signal, drawing only a few microamps, and can coexist on an I2C bus alongside other IoT devices with a QWIIC socket. Hobbyists sourcing cheap IR hardware for MCU builds can track component guides like this on daily.dev."}}]}
```

