IR NEC Protocol
38 kHz IR
Core Technical Specifications
Real-World Devices & Applications
Consumer Electronics
- TV remotes (Samsung, LG, Vizio, TCL, Hisense)
- Set-top box and cable box remotes
- Air conditioner remotes (extended NEC)
- Soundbar and AV receiver remotes
- LED strip controllers
Reference Circuits & Schematics
IR Receiver Circuit — VS1838B / TSOP1738
The VS1838B is a 38 kHz IR receiver module with built-in bandpass filter, AGC, and demodulator. It outputs a clean digital signal — LOW when carrier is present, HIGH when absent.
| Pin | Description |
|---|---|
VOUT
|
Demodulated digital output (active LOW during carrier burst) |
GND
|
Ground |
VCC
|
2.7–5.5V supply (add 100 nF bypass cap) |
Circuit Walk-Through
The IR receiver filters ambient light and passes only 38 kHz modulated IR. The AGC adjusts gain for varying distances. The demodulator strips the carrier, outputting LOW during bursts and HIGH during gaps. Connect VOUT to an MCU interrupt pin. Use IRremote (Arduino) or LIRC (Linux) to decode the pulse train into address + command bytes.
IR Transmitter Circuit
A simple IR LED driven by an MCU GPIO through a current-limiting resistor and NPN transistor for higher current.
| Pin | Description |
|---|---|
IR LED
|
940 nm IR LED, 20–100 mA peak forward current |
NPN Transistor
|
BC547 or 2N2222 switches LED current via MCU GPIO |
Resistor
|
22–47Ω current limiter (value depends on LED Vf and supply) |
MCU GPIO
|
38 kHz PWM output modulated with data |
Circuit Walk-Through
The MCU generates a 38 kHz PWM carrier on a GPIO pin, gating it on/off according to the NEC timing. The NPN transistor amplifies the current to drive the IR LED at 50–100 mA peak. A 22–47Ω resistor limits current. For extended range, use multiple LEDs in series or a higher-power LED with a lens.
Signal Structure & Waveform Analysis
NEC Protocol Frame Structure
The NEC protocol uses pulse distance encoding: a 562.5 µs carrier burst followed by a gap whose length encodes the bit value.
Analysis & Capture Tips
- Use Arduino + IRremote library to capture and decode NEC frames
- Logic analyser on VOUT pin: trigger on falling edge, measure burst/gap timing
- Oscilloscope: verify 38 kHz carrier frequency and burst width
- For unknown remotes: capture raw timing first, then identify protocol
Bench Troubleshooting & Repair Guide
1. Dead IR LED
Phone camera / Multimeter (diode mode)View the IR LED through a phone camera while pressing buttons — you should see a faint purple/white flash. No flash = dead LED, flat battery, or broken trace. Measure LED forward voltage with multimeter diode test (~1.1–1.3V for IR LED).
2. Wrong Carrier Frequency
Oscilloscope / Frequency counterNEC uses 38 kHz but some devices use 36 or 40 kHz. A 38 kHz receiver has ~2 kHz tolerance. If decoding fails, check carrier with oscilloscope. Replace receiver with correct frequency variant.
3. Range Issues
Multimeter / Phone cameraClean the IR LED and receiver lens. Check IR LED current — should be 20–100 mA peak. Low battery reduces LED brightness. Verify receiver orientation and line-of-sight path.
4. Decode Errors
Arduino + IRremote / Logic AnalyserIf address/command inverses don’t match, suspect noise or weak signal. Check for fluorescent light interference at 38 kHz (ballast frequency). Add 100 nF bypass cap on receiver VCC. Shield receiver from ambient IR.