Why we built it
Recreate a dependable infrared remote receiver on a resource-constrained PIC while comparing the register-first workflow of 2007 with an AI-assisted workflow in 2026.
Capture demodulated IR pulse widths with a timer, classify marks and spaces within tolerant ranges, and use AI as a reviewer and drafting partner—not a substitute for datasheet checks.
From sketch to prototype
The original workflow involved reading the datasheet, calculating timer values by hand, and repeatedly flashing the device to inspect one signal at a time. That discipline still supplies the ground truth.
The 2026 workflow can generate a decoder outline, tests, and explanations quickly. The meaningful comparison is whether faster drafting still produces measured, understandable firmware.
“The best version wasn’t the one with the most features—it was the one people understood fastest.”
Hardware & tools
Software
Make it step by step

Observe before decoding
Capture several remote keys with a logic analyser and record the leader pulse, bit timing, and repeat frame.

Configure a stable timer
Choose a prescaler with useful microsecond resolution and verify the calculated tick against the captured waveform.

Decode with tolerant ranges
Classify pulses using upper and lower bounds. Reject incomplete frames and update the command only after all bits arrive.
The core logic
if (edge_detected) {
uint16_t ticks = timer_read_and_reset();
if (within(ticks, ZERO_MIN, ZERO_MAX)) append_bit(0);
else if (within(ticks, ONE_MIN, ONE_MAX)) append_bit(1);
else reset_frame();
}What we learned
- AI shortens the first draft, but the analyser and datasheet remain authoritative.
- Timing tolerances matter because remotes and clocks vary.
- A small state machine is clearer than deeply nested delay-based code.
Watch preview
Watch preview
Watch preview