Skip to content
← All projects
Embedded · Embedded Systems, UTA · 2025

IR Remote Control Replacement

TM4C123GXL (ARM Cortex-M4)

A bare-metal universal IR remote that records and replays signals from any consumer remote via a UART command shell — every driver written at the register level, with no vendor HAL.

  • C
  • ARM Cortex-M4
  • TI Code Composer Studio
Captured IR mark/space waveform with a 38 kHz carrier inset
Captured IR mark/space waveform with a 38 kHz carrier inset
Carrier
38 kHz
Timestamp
32-bit
Resolution
µs
Vendor HAL
None
  • 01

    Wrote all drivers — clock, UART0, timers, NVIC — directly against the datasheet with no vendor HAL.

  • 02

    Chose raw mark/space timing capture over protocol decoding, making the system remote-agnostic.

  • 03

    Generated the 38 kHz carrier with Timer0B PWM, gated at runtime by switching a pin between GPIO and alternate function.

Remote-agnostic by design

Rather than decoding a fixed set of protocols (NEC, RC5, Sony), the system captures raw mark/space timing. That one decision removes the protocol table entirely — anything that transmits on a 38 kHz carrier can be recorded and replayed, including remotes whose encoding I'd never seen.

Microsecond capture

Edges are captured with dual-edge input capture on Timer0A, timestamped against a free-running 32-bit counter. The free-running counter is what buys microsecond resolution without drift across a long frame — each edge is an absolute timestamp, not an accumulated delta, so error doesn't compound down the burst.

Carrier generation and gating

Timer0B drives a 38 kHz PWM carrier. Gating it at runtime is done by reconfiguring the pin between GPIO and alternate-function mode — the timer keeps running while the pin decides whether the world hears it. SysTick-based gap detection marks IR frame boundaries so a burst is correctly segmented into a replayable frame.

Analog front end

The IR emitter is driven through a 2N3904 transistor, since the GPIO pin alone can't source the LED current needed for usable range. Reception uses a demodulating IR receiver, which strips the carrier and hands back clean logic-level mark/space edges.