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.
| 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 |
| From | To | Wire |
|---|---|---|
board:5V |
x1:VCC |
red |
board:GND |
x1:GND |
black |
board:D2 |
x1:OUT |
green |
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();
}
}
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