An infrared (IR) receiver is an integrated optoelectronic module that detects modulated infrared light—typically pulsing at 38kHz—and converts it into a clean, demodulated digital logic signal. In a real circuit, it changes a noisy, ambient-light-flooded analog optical environment into a crisp 3.3V or 5V digital square wave that a microcontroller GPIO pin can read directly without external op-amps or comparators. Beginners commonly confuse IR receivers with Passive Infrared (PIR) motion sensors (which detect broad-spectrum thermal radiation from human bodies) and raw IR photodiodes (which output a continuous analog voltage proportional to light intensity and require external filtering circuitry).
The Core Function and Common Confusions
Raw infrared light is everywhere. The sun, incandescent bulbs, and even fluorescent tubes emit massive amounts of broadband IR radiation. If you connect a raw IR photodiode to an oscilloscope, the output is a chaotic mess of analog noise. An IR receiver solves this by looking for a very specific frequency of light, ignoring everything else.
Inside the black epoxy dome of a standard receiver (like the ubiquitous TSOP series), there are three distinct stages:
- Photodiode: Converts incoming 940nm IR photons into a tiny analog current.
- Bandpass Filter & Amplifier: Amplifies only the signal pulsing at the target carrier frequency (usually 38kHz) and aggressively attenuates DC light (sunlight) and other frequencies (like 100/120Hz flicker from LED room lights).
- Envelope Detector & Comparator: Strips away the 38kHz carrier wave, leaving only the "shape" of the pulses, and outputs a clean digital LOW when a burst is detected, and a digital HIGH when the light is off.
How Demodulation Works: A Numeric Example
To understand the receiver, you have to look at the math of the signal it expects. Let’s use the industry-standard NEC IR protocol and the TSOP38238 receiver as our worked example.
Time per Cycle: 1 / 38,000 = 26.315 µs (microseconds)
When you press the "Power" button on a remote, it doesn't just flash the IR LED on and off. It blinks the LED on and off 38,000 times per second. This is the carrier wave. To send a logical 0 in the NEC protocol, the remote sends a burst of this 38kHz carrier for exactly 562.5 µs, followed by a dark "space" of 562.5 µs.
Here is what happens inside the TSOP38238 during that logical 0:
- The photodiode sees 562.5 µs of light. At 26.315 µs per cycle, this equals exactly 21.37 cycles of 38kHz light.
- The internal bandpass filter recognizes the 38kHz frequency. (If a nearby CFL bulb was emitting 40kHz IR noise, the filter would attenuate it by roughly 20dB, or 90% amplitude loss, ignoring it).
- The envelope detector integrates the 21 cycles and pulls the
OUTpin from HIGH (3.3V/5V) down to LOW (0V) for exactly 562.5 µs. - The microcontroller's interrupt or timer reads a 562.5 µs LOW pulse, followed by a 562.5 µs HIGH pulse, and registers a binary
0.
Where You Meet This in Practice
You will encounter integrated IR receivers in both consumer teardowns and bench prototyping. Common applications include:
- Consumer AV & HVAC: Televisions, soundbars, and mini-split air conditioners use 38kHz receivers to decode remote control commands.
- IR Break-Beam Tachometers: In robotics and 3D printers, a modulated IR emitter paired with an IR receiver creates a highly noise-immune beam. When a spinning slotted wheel breaks the beam, the receiver outputs a clean pulse train for RPM calculation, completely ignoring ambient room lighting.
- Proximity & Obstacle Avoidance: Low-cost robots bounce 38kHz IR off walls. The receiver only triggers when the specific modulated reflection returns, preventing false triggers from sunlight.
- Smart Home Bridges: Devices like the BroadLink RM4 or custom ESP32 MQTT-IR bridges use these receivers to "learn" and replicate legacy remote codes for home automation.
Decision Tree: Picking the Right IR Receiver
Not all black domes are identical. The two most critical parameters are Carrier Frequency (must match your remote/emitter) and Supply Voltage / Logic Level (must match your microcontroller). Use this decision matrix to select your part.
| If Your Project Needs... | Choose This Series / Part | Why? |
|---|---|---|
| Standard 5V Arduino/AVR + Standard TV Remote | Vishay TSOP38238 or Generic VS1838B | 38kHz center frequency, 5V VCC tolerance, AGC2 for standard noise. |
| 3.3V Logic (ESP32, Raspberry Pi Pico, STM32) | Vishay TSOP34238 or OSRAM SFH5110-38 | Designed for 3.3V VCC; outputs a clean 3.3V HIGH without frying 3.3V GPIOs. |
| High Ambient Noise (Near LED drivers, CFLs, or direct sunlight) | Vishay TSOP57238 (AGC3) | AGC3 algorithm aggressively suppresses continuous optical noise and power supply ripple. |
| Non-Standard Legacy Remote (e.g., older Sony SIRC) | TSOP38240 (40kHz) or TSOP38236 (36kHz) | Matches the specific carrier frequency of older or proprietary protocols. |
The AGC Failure Mode and Decoupling Rules
The most common reason an IR receiver "doesn't work" or outputs random ghost pulses on the workbench is a misunderstanding of the internal Automatic Gain Control (AGC).
The AGC dynamically adjusts the amplifier's sensitivity. If the receiver sees a lot of ambient IR noise, it lowers the gain to prevent saturation. If the environment is dark, it cranks the gain up to maximum to catch weak remote signals from across the room.
The Failure Mode: If your 5V power rail has ripple—for example, if an ESP32 is transmitting on WiFi, or a servo motor is drawing current—the VCC pin on the IR receiver dips slightly. The receiver's internal circuitry interprets this power supply noise as optical noise. The AGC gets confused, cranks the gain to maximum, and suddenly the thermal noise of the photodiode itself triggers false LOW pulses on the output pin. You will see your microcontroller register random, invalid IR codes.
The Fix (Mandatory Decoupling): According to Vishay's application notes, you must isolate the receiver from power supply noise.
- Place a 4.7µF electrolytic capacitor and a 0.1µF (100nF) ceramic capacitor in parallel between the VCC and GND pins.
- These capacitors must be physically located within 5mm of the receiver's pins.
- For extreme noise environments, add a 100Ω series resistor between your main 5V rail and the receiver's VCC pin, placing the capacitors on the receiver side of the resistor. This creates an RC low-pass filter that completely blocks power rail ripple.
FAQ: Infrared Receiver Troubleshooting
Q: Can I use a 38kHz receiver with a 40kHz remote control?
A: Yes, but with a severe range penalty. The receiver's internal bandpass filter is tuned to 38kHz. A 40kHz signal falls on the "roll-off" shoulder of the filter curve. It will be attenuated by roughly 20dB. In practice, this means a remote that normally works from 10 meters away will only work from 2 to 3 meters away. Always match the receiver frequency to the emitter frequency for reliable operation.
Q: Why does my IR receiver stop working when I turn on the LED lights in my room?
A: Modern dimmable LED bulbs and CFLs use high-frequency switching drivers that often leak broadband optical noise, sometimes peaking near 30-40kHz. This noise saturates the receiver's AGC, forcing it to lower its gain so much that it can no longer "see" your remote. The fix is to either use an AGC3-equipped receiver (like the TSOP57238), shield the receiver with a physical tube to limit its viewing angle, or move the receiver away from the light source.
Q: My microcontroller is reading the IR signal, but the timing is slightly off. Why?
A: IR receivers have an inherent propagation delay and pulse width distortion. When the receiver detects the 38kHz burst, it takes a few microseconds for the internal envelope detector to cross the comparator threshold and pull the output pin LOW. For the TSOP38238, the leading edge of the output pulse is typically delayed by about 10µs to 15µs relative to the actual optical burst. High-quality IR decoding libraries (like IRremote for Arduino) automatically compensate for this distortion, but if you are writing raw timer-interrupt code, you must add ~12µs to your measured LOW pulses to get the true protocol timing.






