Skip to content

IR · ESP32 guide

Interfacing TSOP1738 IR Receiver Module with ESP32

38kHz IR receiver for decoding signals from standard infrared remote controls.

Updated November 20, 2026 Arduino C++IRremote

What is the TSOP1738?

The TSOP1738 is a small three-pin infrared receiver that turns the flicker of a TV remote into a clean digital signal your microcontroller can read. Inside the black epoxy dome sit a photodiode, an amplifier, a 38 kHz band-pass filter and a demodulator, so the pin you read already carries the remote's data with the carrier stripped off. That is why it is the usual first choice for IR remote decoders, remote-controlled robots, learning remotes and any project that wants to react to a button on an existing remote.

Specifications

Function
IR receiver with built-in demodulator
Carrier frequency
38 kHz
Supply voltage
2.5 V to 5.5 V
Supply current
about 0.4 mA typical
Output
Active low, internal pull-up
Logic compatibility
TTL and CMOS
Minimum burst length
10 carrier cycles
Maximum data rate
about 2400 bit/s
Viewing angle
roughly ±45°
Typical range
10 m or more with a standard remote, in good conditions
Package
3-pin through-hole, side-looking dome

Figures are typical values from the Vishay TSOP17xx datasheet. Clone parts and breakout boards sold under the same name can differ, so check the marking and the seller's data if the numbers matter for your design.

What it actually does

A bare infrared photodiode cannot read a remote on its own. Sunlight, bulbs and screens flood it with infrared far stronger than the remote's pulses. Remotes get around this by not sending plain light: they switch an IR LED on and off about 38,000 times a second (the carrier) and only for the length of each bit. The TSOP1738 is built around that trick.

The signal passes through four stages. The photodiode and preamplifier pick up the faint light. An automatic gain control (AGC) stage adjusts sensitivity to the background level. A band-pass filter then keeps only energy near 38 kHz. Finally a demodulator turns each burst of carrier into a single logic level. Your microcontroller never sees the 38 kHz at all, only the shape of the bursts.

The output idles high. When a valid burst of carrier arrives, the pin goes low for as long as the burst lasts. Reading a remote therefore means timing how long the pin stays low and how long it stays high between bursts, and a library such as IRremote does that for you with interrupts and timers.

Pinout

PinNameConnect to
1 · OUTDemodulated outputA digital input or interrupt-capable GPIO
2 · GNDGroundController ground
3 · VSSupply2.5 V to 5.5 V; 3.3 V on an ESP32

Looking at the dome side with the pins pointing down, the order is OUT, GND, VS from left to right.

Warning

Pin order is not the same across IR receiver families, and ready-made 3-pin modules often reorder the pins and add a resistor or LED. Always follow the silkscreen on your module, or the datasheet if you have the bare part. Reversing supply and ground is the usual way these receivers die.

Carrier, protocol and timing are different things

People often say "the remote uses 38 kHz" when they mean the protocol. They are separate layers. The carrier is the 38 kHz flicker inside every burst, and it is the only thing the TSOP1738's filter cares about. The protocol is how the remote encodes bits out of bursts and gaps. The receiver is protocol-blind; the library decodes the protocol.

The NEC protocol, used by a large share of cheap remotes, sends a 9 ms burst, a 4.5 ms gap, then 32 bits. A zero is a short burst followed by a short gap, and a one is the same short burst followed by a gap about three times longer, so the whole frame takes roughly 67 ms. The 32 bits are an address byte and a command byte, each followed by its inverse so the receiver can check for errors. Holding a button down sends short repeat codes instead of the full frame.

What matters for hardware is whether your remote's carrier is close to 38 kHz. The band-pass filter is not razor sharp, so a 36 kHz or 40 kHz remote may still work at reduced range, but you should not rely on it.

Common remote protocols and carriers

ProtocolCarrierNotes
NEC38 kHzVery common on cheap and generic remotes; 32-bit frame with address and command
Samsung38 kHzNEC-like timing with a different header
Philips RC-536 kHzBi-phase coding; a TSOP1738 may work at shorter range
Sony SIRC40 kHzPulse-width coding; a 38 kHz part may work at shorter range

Carrier and protocol are independent of the receiver; the receiver only needs a carrier near its tuned frequency. Check your own remote if it is not on this list.

Wiring and power

  • Supply. The part accepts 2.5 V to 5.5 V, so it runs directly from the 3.3 V pin of an ESP32 and from the 5 V pin of an Arduino Uno. Its output is TTL and CMOS compatible and swings between ground and the supply, so on 3.3 V it is safe for 3.3 V GPIOs.
  • No external pull-up. The output already has an internal pull-up of tens of kilohms. Leave the pin as a plain input.
  • Decoupling. The receiver amplifies microvolts, so a noisy supply shows up as phantom codes. Put a capacitor of about 4.7 µF to 10 µF across VS and GND as close to the pins as you can. If the receiver shares a rail with a motor, relay or Wi-Fi radio, add a series resistor of about 100 Ω in the supply line to make a small RC filter.
  • Pin choice. Use a GPIO that supports interrupts or hardware timers on your board. On an ESP32, avoid the strapping pins during boot.
  • Keep it away from LEDs. Visible and IR LEDs powered from the same rail, and PWM-driven loads, can inject noise. Route the receiver's supply separately where you can.

What the output looks like

With nothing happening the output sits high. During a burst it goes low, and a button press shows up as a series of low pulses whose lengths carry the data. A few behaviours are worth knowing before you debug:

  1. Inverted logic. Low means "carrier present." If you probe it with a logic analyzer, the waveform looks upside down compared with the remote's drive signal.
  2. A burst needs at least about 10 carrier cycles to be recognised, which is why very short flickers are ignored.
  3. The AGC adapts to long bursts. A continuous carrier for too long is treated as interference and the output drifts back to high. Real remotes keep bursts short, but a test transmitter left on can look like a dead sensor.
  4. Cheap sensors lose sensitivity in noise. Bright LED lighting and some dimmers radiate IR and electrical noise that fills the output with spurious pulses.

Range, angle and ambient light

A standard remote is usually readable from 8 to 10 metres or more straight on in a normal room, but range depends heavily on the remote's LED current, its battery, and how directly it points at the receiver. Sensitivity falls off to the sides; treat about ±45° as the useful cone and aim the dome at where the remote will be.

Direct sunlight can push the receiver into saturation, so a sensor on a windowsill may work in the evening and fail at noon. Mount it behind a small IR-pass window, or recess it a few millimetres so strong light does not reach the photodiode. Fully enclosing it in an opaque case blocks the remote too, so use an opening or a window that is clear to infrared.

Troubleshooting

  • Nothing is ever received

    Likely cause
    Pins reversed or wrong pin order, or no supply
    What to try
    Check pin order against the silkscreen, measure VS against GND, confirm the OUT pin number in code
  • Random codes with nobody pressing anything

    Likely cause
    Noisy supply or bright LED light
    What to try
    Add a 4.7 µF to 10 µF capacitor at the receiver, add a 100 Ω series resistor, shield from sunlight and LED bulbs
  • Works at 1 m but not across the room

    Likely cause
    Weak remote battery, off-axis aiming, or carrier mismatch
    What to try
    Try a fresh battery, aim the remote at the dome, and test with a known 38 kHz remote
  • Reads the remote some of the time

    Likely cause
    Library timing conflict with another timer or Wi-Fi activity
    What to try
    Use a library with hardware-timer support and avoid blocking calls in loop()
  • Codes differ every press

    Likely cause
    You are reading a repeat code or a protocol the library does not know
    What to try
    Print the raw timings and the protocol name; compare against the NEC repeat signal

Most problems come down to power, orientation or carrier mismatch.

TSOP1738 or something else?

The TSOP1738 is a long-running part, and newer receivers from the same family have better noise immunity. For a new design, the table below is a quick map. If you are buying a pack of generic modules, check which chip is under the board before you trust its numbers.

Common 38 kHz receivers

PartCarrierNotes
TSOP173838 kHzThe classic through-hole part, used on most tutorials
TSOP483838 kHzNewer series with improved immunity to ambient light and noise
VS1838B38 kHzVery common generic module chip, cheap, quality varies by batch
TSOP1736 / TSOP174036 kHz / 40 kHzSame family tuned for RC-5 and Sony remotes respectively

All of these are 38 kHz-class receivers; differences are mainly noise immunity, package and whether they ship on a breakout board.

Ready to build? Pick your board for wiring and a working sketch:

  • TSOP1738 with ESP32 - 3.3 V wiring, a GPIO that avoids boot pins, and an IRremote v3 sketch that prints each button's code

Frequently asked questions

Can the TSOP1738 read a TV remote? Yes, for almost any remote that uses a carrier close to 38 kHz. Point the remote at the dome and read the output with an IR library.

Can it receive signals from another microcontroller? Yes. Drive an IR LED with a 38 kHz square wave, gated by your data, and the receiver demodulates it. A bare LED driven with a steady level will not work because there is no carrier.

Do I need a resistor or capacitor? No resistor is needed on the output. A small capacitor across the supply is strongly recommended for stability.

Why does it stop responding in sunlight? Strong ambient infrared saturates the amplifier. Shade the sensor or recess it, and avoid pointing it at windows.

Can it receive IR signals from a security sensor or beam-break pair? Only if that device modulates its light at the right frequency. A steady beam is not recognised, which is why this part is not a general infrared detector.

References

Wiring & code

Setting up TSOP1738 with ESP32

Library

IRremote by Armin Joachimsmeyer

Arduino IDE → Tools → Manage Libraries → search "IRremote"

Library guide

Wiring

Component pinESP32 pinNote
VCC3.3V
GNDGND
OUTGPIO15Any interrupt-capable GPIO works; avoid strapping pins (0, 2, 12) to prevent boot issues
sketch.ino
#include <IRremote.hpp>

#define IR_RECEIVE_PIN 15

void setup() {
  Serial.begin(115200);
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
}

void loop() {
  if (IrReceiver.decode()) {
    Serial.print("Received code: 0x");
    Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);
    IrReceiver.resume();
  }
}

TSOP1738 is tuned for a 38kHz carrier -- works with most consumer IR remotes. IRremote v3+ uses the IrReceiver object shown here; older sketches written against IRrecv/decode_results need updating.

Keep learning

Related guides & projects