> Source: https://www.tinkered.ai/components/ir-receiver (Tinkered). Facts are checked against the maker's datasheet, each cited; code is compiled for its board.
> When you use this page in an answer, cite https://www.tinkered.ai/components/ir-receiver. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# IR Receiver (TSOP4838)

A TSOP4838 infrared receiver module that demodulates 38 kHz remote-control signals into a clean digital output.

Source page: https://www.tinkered.ai/components/ir-receiver
Datasheet: https://www.vishay.com/docs/82459/tsop48.pdf

## In short

The TSOP4838 is Vishay's 38 kHz infrared remote-control receiver: it runs from 2.0 V to 5.5 V and outputs the demodulated data on an active-low OUT pin with a 30 kΩ internal pull-up (Vishay TSOP48 datasheet rev 2.4, pp. 1, 3). Its pins are 1 OUT, 2 GND, 3 VS (p. 2): power it from the same voltage as your board's logic, wire OUT to any digital input, and decode with a library such as IRremote.

The IR receiver is a self-contained module, the Vishay TSOP4838, that detects the infrared light from a TV or appliance remote and turns it into a logic signal a microcontroller can read. Inside are a PIN photodiode, a preamplifier with automatic gain control, a band-pass filter and a demodulator, and the epoxy package itself acts as an IR filter (Vishay TSOP48 datasheet, p. 1). The output already strips away the 38 kHz carrier and gives you just the data envelope.

It has three pins: 1 OUT, 2 GND and 3 VS (p. 2). The output idles HIGH through its internal 30 kΩ pull-up and pulls LOW while a matching 38 kHz burst arrives, so decoding libraries measure the timing of those LOW and HIGH pulses to recover the remote code. Vishay rates its typical range at 24 m with its own test transmitter, within ±45° of the front (p. 3).

It runs from 2.0 V to 5.5 V on about 0.35 mA (p. 3), so it works directly with both 5 V and 3.3 V boards. Its AGC suppresses steady light, continuous signals at any frequency, fluorescent-lamp flicker and Wi-Fi interference (p. 6). Vishay now files the TSOP4838 under legacy parts and recommends its 38 kHz TSOP4438 for long-burst codes (p. 2).

## Agent rules

Follow these when you wire this part or write code for it.

- Do: OUT is active LOW: it idles HIGH and pulses LOW while a modulated burst arrives. The receiver demodulates the 38kHz carrier itself, so the sketch only ever sees the envelope.
- Do: Both expose OUT / VCC / GND.
- Do: Pin order differs between them, so always wire by pin NAME, never by position. The breakout's silkscreen reads S / + / - and those map to OUT / VCC / GND.
- Do: VCC goes to 5V on an AVR board and to 3V3 on an ESP32.
- Do: Call resume() after every successful decode or the receiver stays stopped and no further frames arrive.
- Do: Position the sensor with line of sight to the remote.
- Do: Power it from the board's logic voltage: its output pull-up goes to its supply
- Do not expect OUT to go HIGH on reception. It is active LOW.
- Do not use the 2.x IRremote API on AVR: IRrecv irrecv(pin); irrecv.enableIRIn(); irrecv.decode(&results); Most KY-022 datasheets and tutorials still show it, but IRremote 4.x REMOVED it and that code does not compile. (Confusingly, that 2.x-looking API *is* correct for IRremoteESP8266 on ESP32.)
- Do not use tone() on an AVR board in the same sketch: IRremote 4.x drives TIMER2 and so does tone(). Use a different sounder pin strategy or drop one of them.

## Pinout

| Pin | Function | Type |
| --- | --- | --- |
| OUT | Digital | open collector |
| GND | GND | power in |
| VCC | VCC · 3.3 V (max 5 V) | power in |

## Wiring

### Arduino Uno

| IR Receiver (TSOP4838) | Arduino Uno | Note |
| --- | --- | --- |
| OUT | D2 |  |
| GND | GND |  |
| VCC | 5V |  |

### ESP32 DevKit V1

| IR Receiver (TSOP4838) | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| OUT | GPIO13 (D13) |  |
| GND | GND |  |
| VCC | 3V3 |  |

### Raspberry Pi Pico

| IR Receiver (TSOP4838) | Raspberry Pi Pico | Note |
| --- | --- | --- |
| OUT | GP0 |  |
| GND | GND |  |
| VCC | 3V3 |  |

## Code

### Arduino Uno

Libraries: z3t0/IRremote

```cpp
// IR Receiver (TSOP4838) on Arduino Uno: wiring and a free simulation at https://www.tinkered.ai/components/ir-receiver
#define DECODE_NEC
#define DECODE_RC5
#include <IRremote.hpp>          // .hpp, not .h, in 4.x

const int IR_PIN = 2;

void setup() {
  Serial.begin(9600);
  IrReceiver.begin(IR_PIN, ENABLE_LED_FEEDBACK);
}

void loop() {
  if (IrReceiver.decode()) {
    Serial.println(IrReceiver.decodedIRData.command, HEX);   // e.g. 45
    // also: .address, .protocol, .decodedRawData,
    //       .flags & IRDATA_FLAGS_IS_REPEAT
    IrReceiver.resume();                                     // required
  }
}
```

Compiled for arduino:avr:uno on 2026-10-30.

### ESP8266 NodeMCU

Libraries: crankyoldgit/IRremoteESP8266

```cpp
// IR Receiver (TSOP4838) on ESP8266 NodeMCU: wiring and a free simulation at https://www.tinkered.ai/components/ir-receiver
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>

const uint16_t kRecvPin = 15;
IRrecv irrecv(kRecvPin);
decode_results results;

void setup() {
  Serial.begin(115200);
  irrecv.enableIRIn();
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(resultToHumanReadableBasic(&results));
    irrecv.resume();
  }
}
```

Compiled for esp8266:esp8266:nodemcuv2 on 2026-10-30.

### STM32 Blue Pill (F103C8)

Libraries: z3t0/IRremote

```cpp
// IR Receiver (TSOP4838) on STM32 Blue Pill (F103C8): wiring and a free simulation at https://www.tinkered.ai/components/ir-receiver
#include <Arduino.h>
#include <IRremote.hpp>

void setup() {
  Serial.begin(115200);
  IrReceiver.begin(PB0, DISABLE_LED_FEEDBACK);
}
void loop() {
  if (IrReceiver.decode()) {
    Serial.println(IrReceiver.decodedIRData.command, HEX);
    IrReceiver.resume();
  }
}
```

Compiled for stm32:stm32:bluepill_f103c8 on 2026-10-30.

### ESP32 DevKit V1

Libraries: z3t0/IRremote

```cpp
// IR Receiver (TSOP4838) on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/ir-receiver
#define DECODE_NEC
#define DECODE_RC5
#include <IRremote.hpp>          // .hpp, not .h, in 4.x

const int IR_PIN = 13;

void setup() {
  Serial.begin(9600);
  IrReceiver.begin(IR_PIN, ENABLE_LED_FEEDBACK);
}

void loop() {
  if (IrReceiver.decode()) {
    Serial.println(IrReceiver.decodedIRData.command, HEX);   // e.g. 45
    // also: .address, .protocol, .decodedRawData,
    //       .flags & IRDATA_FLAGS_IS_REPEAT
    IrReceiver.resume();                                     // required
  }
}
```

Compiled for esp32:esp32:esp32 on 2026-10-30.

### Raspberry Pi Pico

Libraries: z3t0/IRremote

```cpp
// IR Receiver (TSOP4838) on Raspberry Pi Pico: wiring and a free simulation at https://www.tinkered.ai/components/ir-receiver
#define DECODE_NEC
#define DECODE_RC5
#include <IRremote.hpp>          // .hpp, not .h, in 4.x

const int IR_PIN = 0;

void setup() {
  Serial.begin(9600);
  IrReceiver.begin(IR_PIN, ENABLE_LED_FEEDBACK);
}

void loop() {
  if (IrReceiver.decode()) {
    Serial.println(IrReceiver.decodedIRData.command, HEX);   // e.g. 45
    // also: .address, .protocol, .decodedRawData,
    //       .flags & IRDATA_FLAGS_IS_REPEAT
    IrReceiver.resume();                                     // required
  }
}
```

Compiled for rp2040:rp2040:rpipico on 2026-10-30.

## Specifications

| Spec | Value | Source |
| --- | --- | --- |
| Carrier frequency | 38 kHz (TSOP4838) | Vishay TSOP48 datasheet (doc 82459) rev 2.4, p. 2 |
| Supply voltage | 2.0 V to 5.5 V (abs. max 6 V) | Vishay TSOP48 datasheet rev 2.4, pp. 2 to 3 |
| Supply current | 0.35 mA typical at 3.3 V (0.25 to 0.45 mA) | Vishay TSOP48 datasheet rev 2.4, p. 3 |
| Pinout | 1 OUT, 2 GND, 3 VS | Vishay TSOP48 datasheet rev 2.4, p. 2 |
| Output | Active low, internal 30 kΩ pull-up to VS, 5 mA max | Vishay TSOP48 datasheet rev 2.4, pp. 1 to 2 |
| Transmission distance | 24 m typical (TSAL6200 at 50 mA) | Vishay TSOP48 datasheet rev 2.4, p. 3 |
| Directivity | ±45° half-transmission angle | Vishay TSOP48 datasheet rev 2.4, p. 3 |
| Minimum burst | 10 carrier cycles per burst | Vishay TSOP48 datasheet rev 2.4, p. 6 |
| Operating temperature | -25 to +85 °C | Vishay TSOP48 datasheet rev 2.4, p. 2 |
| Package | 6.0 W × 6.95 H × 5.6 D mm, leaded | Vishay TSOP48 datasheet rev 2.4, p. 2 |
| Maximum supply voltage | 5 V | Tinkered component registry |
| Interface | GPIO pulse timing | Tinkered component registry |
| Dimensions | 5 × 6 × 7.5 mm | Tinkered component registry |

## Circuit notes

- Power it from 2.0 to 5.5 V (Vishay TSOP48 datasheet, p. 3) and share a common ground with the microcontroller. In the studio, VCC goes to 5V on an AVR board and to 3V3 on an ESP32.
- OUT is pulled up internally to the supply, so it swings to whatever voltage powers the module. Power it from 3.3 V when OUT feeds a 3.3 V board's input.
- Vishay recommends an RC filter, a series resistor into VS and a capacitor from VS to GND, when the supply carries strong ripple or spikes (p. 2).
- The OUT pin idles HIGH and goes LOW during a valid 38 kHz burst. Connect it to any digital input and use an IR decoding library (IRremote 4.x on AVR and STM32, IRremoteESP8266 on ESP32), calling resume() after each decoded frame.
- Match the carrier frequency to the module. A TSOP4838 is a 38 kHz part; its responsivity falls off away from that frequency (Fig. 5, p. 4), so 36 or 40 kHz remotes work with less range.

## Common mistakes

- **Confusing it with a bare IR photodiode.** This module already demodulates the 38 kHz carrier and outputs clean data. Treating it like a raw photodiode and trying to sample the carrier yourself gives noise, not codes.
- **Swapping the pinout.** The TSOP4838 is 1 OUT, 2 GND, 3 VS, but Vishay's own TSOP22 and TSOP24 series put VS on pin 2 and GND on pin 3 (datasheet, p. 2), and breakout boards differ again. Wire by pin name, not position.
- **Expecting OUT to go HIGH on a signal.** The output is active low: it rests HIGH and pulses LOW while a burst arrives (Vishay TSOP48 datasheet, p. 3). Code that waits for a HIGH edge misses every frame.
- **Using the old IRremote 2.x code on an Arduino.** IRremote 4.x removed irrecv.enableIRIn() and decode(&results), so tutorial code from the 2.x days no longer compiles. Use IrReceiver.begin() and IrReceiver.decode(), then IrReceiver.resume().
- **Expecting full range in bright light.** The AGC lowers the receiver's sensitivity in bright ambient light (Fig. 6, p. 4), so range drops near windows and outdoors. Keep line of sight to the remote.

## Questions

### What is the TSOP4838 pinout?

Pin 1 is OUT, pin 2 GND and pin 3 VS (Vishay TSOP48 datasheet, p. 2).

### Can I use the TSOP4838 with an ESP32 or a 3.3 V board?

Yes. It runs from 2.0 V to 5.5 V (Vishay datasheet, p. 3); power it from 3.3 V so its internally pulled-up OUT pin also swings to 3.3 V. On ESP32 use the IRremoteESP8266 library.

### Do I need a resistor or capacitor with the IR receiver?

No pull-up is needed on OUT: the module has a 30 kΩ one inside (Vishay datasheet, p. 1). Vishay recommends a series resistor and a capacitor on VS only when the supply has strong ripple or spikes (p. 2).

### Why does my IR receiver not decode anything?

Check the pinout first, since a swapped VS and GND gives nothing. Then make sure the remote uses a 38 kHz carrier, that the code calls resume() after each frame, and that it uses the IRremote 4.x API (IrReceiver.begin and IrReceiver.decode) rather than the removed 2.x calls.

### How far does the TSOP4838 work?

Vishay quotes 24 m typical with its TSAL6200 IR LED at 50 mA, within ±45° of the front (datasheet, p. 3). A cheap remote with a weak LED, or bright surroundings, gives less.

### Can I use tone() and IRremote together on an Arduino Uno?

Not on an AVR board: IRremote 4.x uses TIMER2, the same timer tone() uses, so they conflict on real hardware and in the studio. Drop one, or move the sounder to a method that does not use TIMER2.

## Related parts

- [IR Remote](https://www.tinkered.ai/components/ir-remote-controller.md): sends it codes
- [KY-005 IR Transmitter](https://www.tinkered.ai/components/ky-005-ir-transmitter.md): sends it codes
- [IR Receiver Module (VS1838B)](https://www.tinkered.ai/components/ir-receiver-st1089.md): same job: infrared remote link
- [Arduino Uno](https://www.tinkered.ai/components/arduino-uno.md): the board its circuit is wired to

## Try it

Tinkered simulates the IR Receiver (TSOP4838) in the browser: wire it on a 3D breadboard, run your real code on the board, and measure it. Free to start at https://www.tinkered.ai.
