How to audit an IR code library before you trust it in a product
Published 2026-11-30 · 5 min read
The Decision You Settle First: What the Product Must Do When a Code Is Wrong
Before anyone opens a datasheet or starts counting entries, the product team has to answer one question: when the appliance doesn't respond to the first transmission, what does the firmware do next? There are three defensible answers, and each one leads to a different audit.
Retransmit is the first. The handset sends the same frame again, usually two or three times, inside a fixed window. Consumer remotes lean on this constantly, because it hides a lot of weakness in the code database. A marginal entry that decodes at 60 per cent on the bench often looks fine once you send it four times. The trade-off: a three-retry policy will keep bad entries in the library forever. Nobody sees the failure, so nobody files a ticket.
The second is fall back to an alternate code. Some platforms ship a secondary entry per device and try it when the primary fails. In hotels and multi-brand environments, where one remote has to drive panels from several generations of a supplier's range, this works well. It also doubles the maintenance surface — every device now has two entries to keep current.
The third is fail loudly. One transmission, no retry, surface the miss. It's the only policy that makes an audit honest, and it ships a worse first-run experience. A buyer who has to press twice on a new remote notices, even when the underlying library is cleaner.
Pick one and write it down. Every pass/fail threshold in the sections below depends on the answer. Audit under a retry policy, then ship under a single-shot policy, and the audit tells you nothing useful.
Scope the Library Against Your Actual Device Set Before Reading a Single Entry

An IR code library is only as good as the device list you measure it against. Most audits go wrong right here, because the team starts reading entries instead of writing down targets.
Build the target device set first. For a hotel group, that means every air-conditioner, television and set-top model in the properties you intend to serve — not the current catalogue, the installed base. A 300-room property built in 2011 and refurbished in 2019 will carry at least two vintages of the same brand. For a brand owner shipping a universal remote, the target set is whatever the packaging claims plus a realistic margin.
Then measure coverage. The executable criterion: the library must cover 100 per cent of the target device set, with no more than 2 per cent of entries needing manual remapping before shipment.
That 2 per cent figure matters. Zero is unrealistic for any library above a few thousand entries, because manufacturers change frame structure between production batches without changing the model number. But once manual remapping passes roughly one entry in fifty, remapping becomes a permanent job rather than a launch task, and the schedule slips.
Do this scoping pass in a spreadsheet, not in the tooling. One row per target device, one column per library entry that claims to serve it. The gaps show up immediately, and they tend to cluster at the oldest and newest equipment — the two ends that get the least attention when an IR code library is being assembled.
Run a Structural Pass: Decode Every Entry and Count What Fails
Structural checking is mechanical and can be largely automated. Don't skip it because it feels like busywork. Timing errors, malformed headers and truncated frames are the most common defects in a large library, and nobody reading the entry list can see them.
The criterion: decode each entry against a reference receiver, and fail the pass if more than 1 in 200 entries produces a timing error above the protocol's stated tolerance. For consumer IR at 38 kHz, that tolerance is typically a few hundred microseconds across a full frame — enough that a sloppy entry still often works at close range and fails at four metres.
- Extract. Pull every entry into a flat format with its carrier frequency, frame structure and raw mark/space durations. A library of 4,000 entries should flatten in under a minute; if it takes longer, the storage format is fighting you and the audit will be slow every quarter.
- Decode. Feed each entry to a reference receiver — a bench capture unit or a known-good demodulator — and record the decoded frame alongside the source entry. Capture at least 3 frames per entry so you can see jitter rather than a single sample.
- Diff against reference. Compare decoded output to the expected protocol frame. Flag any entry where a single mark or space deviates beyond tolerance, and log the deviation in microseconds, not as pass/fail.
- Report. Produce a failure list sorted by deviation size. The worst 200 entries are usually genuine defects; the tail below that is often receiver noise and can be re-tested at 2 metres before being written off.
Budget a day of engineering time per thousand entries for the first pass. Later passes go faster because the extraction step is already scripted.
Test Transmission Tolerance: Distance, Angle and Ambient Light Sweeps

A code that decodes perfectly on the bench can still fail in a room. The tolerance sweep is where you find out whether the library works in a hotel corridor or only in a lab.
The criterion: sweep 0.5 m to 8 m and 0 to 60 degrees off-axis, and fail the pass if any code drops below the agreed hit rate at the stated range. Agree the hit rate before you start — 95 per cent over 20 attempts is a reasonable floor for a consumer product, and the number belongs in the acceptance criteria, not in a negotiation after the results arrive.
Run the sweep at the handset's realistic output. A remote driven at half its rated current will fail codes that are perfectly sound. Overdriving the emitter to make the sweep pass is the other common shortcut, and it shortens battery life in the shipped product.
Ambient light deserves its own pass. Direct sunlight on the receiver floods a standard photodiode, and codes that pass at 8 m in a dim room can fail at 2 m in a south-facing window. Test at least one position with a bright source aimed at the receiver. You don't need a calibrated light box; a desk lamp at close range will expose the worst offenders.
Angle matters more than most teams expect. Codes that use a wide mark/space ratio often hold up better off-axis, because the receiver's automatic gain control recovers faster between frames. Note the angle at which each failing code drops below the hit rate — that single number tells you more about the entry than a pass/fail verdict.
Check Provenance, Licensing and Maintenance Load Per Code
Structural and tolerance testing tell you whether a code works. Provenance tells you whether you're allowed to ship it, and maintenance load tells you what it will cost every quarter.
Flag any entry with no recorded source, and flag any entry whose licence terms conflict with redistribution in your product. This isn't legal theatre. A library assembled from captures, manufacturer publications and third-party lists will contain entries whose origin nobody can reconstruct, and those are exactly the entries that cause trouble when a buyer asks for an indemnity or a platform team asks for a compliance statement.
Then cap the maintenance load. Set a stated maximum for the manual-maintenance backlog — 50 entries per quarter, say — and treat any quarter that exceeds it as a signal that the library is growing faster than the team can keep it clean. Ten thousand entries with a 200-per-quarter backlog isn't a maintained asset; it's a liability with a version number.
Ask each supplier or internal owner three questions, in writing: where did this entry come from, what licence applies, and who fixes it when it breaks. If any answer is "the previous team", the entry goes on the backlog list regardless of how well it decodes.
Where Audits Fail in Practice: Clean Decodes, Dirty Assumptions
The most common failure is an audit that passes cleanly and ships a product that doesn't work. It happens for predictable reasons.
First, a reference receiver that's too forgiving. If the bench unit has a wider acceptance window than the receivers in the field, the structural pass will wave through entries that fail on real hardware. Check the reference unit against a known-good entry before you trust it, and use more than one receiver model if your product ships into varied environments.
Second, a target device set written from the catalogue rather than from the installed base. The library covers every model the manufacturer currently lists and misses the two vintages that make up most of the rooms. This is the single most expensive mistake in the whole process, because it surfaces after deployment, in guest complaints rather than in test reports.
Third, an audit run under a retry policy and shipped under a single-shot policy. The test script retries three times, so a 70 per cent hit rate passes. The firmware retries once, so the same code fails in the field. If the policies differ, the numbers are meaningless.
And watch for a library that has been cleaned entry by entry without a coverage check afterwards. It's easy to remove 300 defective entries and accidentally remove the only entry for a device that 40 rooms depend on. Re-measure coverage after any cleanup; don't assume it.
Verifying the Audit Worked: A Re-audit Signal You Can Measure
An audit is a change to the library, so it needs a before-and-after measurement. Re-run the same harness after the fixes and compare two numbers.
The first is the failure count from the structural pass. The second is the retry rate on a fixed 200-command test script — same script, same devices, same distances, run before and after. The audit has worked when the failure count is at or below the agreed threshold and the retry rate hasn't risen by more than the margin you set in advance. Two percentage points is a common margin.
That second condition is the one people forget. A cleanup that removes difficult entries will improve the failure count and push the retry rate up at the same time, because what's left no longer covers the awkward devices at all. The pair of numbers catches this. Either number alone doesn't.
Keep the harness. The same 200-command script, run quarterly, gives you a trend line for the library's health. If the retry rate creeps up by a point per quarter, you know the library is drifting before a buyer tells you. If the failure count stays flat while the entry count grows, the maintenance process is keeping pace. If it doesn't, you have a concrete number to take to whoever owns the IR code library budget — a far easier conversation than "the remote feels unreliable".
Questions on scoping a library against a specific device set can go to peter.sun@serow-tech.com; replies come back within one working day.
More from the newsroom
Keep reading.
Three other notes from the same team.
Start a project
Send the control target, not a catalogue request.
Tell us what the remote has to control, which radio the installed base uses, and where it ships. We will reply with the questions that decide the architecture.