Codey Online › Arduino & ESP32 component library › IR Receiver (VS1838B)
IR Receiver (VS1838B)
Sensors

IR Receiver (VS1838B)

The VS1838B is an IR receiver module that detects modulated infrared remote-control signals and outputs a digital signal on OUT. It is typically connected with VCC, GND, and a microcontroller GPIO for reading IR commands.

Width: 8.6 mm

Pinout — IR Receiver (VS1838B)

Pin Signal Description
OUT digital Demodulated IR receiver output — connect to a microcontroller digital input
GND ground Ground reference for the IR receiver module
VCC power Positive supply for the IR receiver, typically 3.3V or 5V

Example wiring diagram — IR Receiver (VS1838B)

From To Wire
board:5V x1:VCC red
board:GND x1:GND black
board:D2 x1:OUT green

Example Arduino code — IR Receiver (VS1838B)

This example was written and compile-checked for the arduino-uno. Codey Online adapts it to any other supported board for you.

// Canonical beginner example for the VS1838B IR Receiver
// Wiring:
// - VCC -> 5V
// - GND -> GND
// - OUT -> D2

#include <IRremote.hpp>

constexpr uint8_t IR_RECEIVE_PIN = 2;

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ;
  }

  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);

  Serial.println(F("VS1838B IR Receiver example"));
  Serial.println(F("Point a TV remote at the receiver and press buttons."));
  Serial.println(F("Decoded IR data will appear here."));
}

void loop() {
  if (IrReceiver.decode()) {
    IrReceiver.printIRResultShort(&Serial);
    Serial.println();
    IrReceiver.resume();
  }
}

Related components

PIR Sensor HC-SR501

PIR Sensor HC-SR501

HW-201 Infrared Obstacle Avoidance Module

HW-201 Infrared Obstacle Avoidance Module

GPS NEO-6M

GPS NEO-6M

HC-SR501 PIR Motion Sensor

HC-SR501 PIR Motion Sensor

Build your Arduino or ESP32 project with AI

Describe what you want to build. Codey Online writes the code, draws the wiring diagram, compiles it and flashes your board straight from the browser.

Start for free