Projects / TV remote code reader

TV remote code reader

Beginner35 minGuided buildReviewed

Build it step by step

0 of 4 done
  1. UNOVS1838B

    Check the pinout

    With the dome facing you, VS1838B pins are OUT, GND, VCC from left to right. Some modules differ: check the print.

  2. UNO19.6 mA

    Wire it

    OUT to D2, GND, VCC to 5V. Add the three LEDs on D9, D10, D11.

  3. UNO

    Read your remote

    Upload, open the serial monitor and press buttons. Note the Command value of three buttons.

  4. UNO19.6 mA

    Map buttons

    Put those three numbers in KEYS, upload again, and use the buttons to toggle the LEDs.

In short

How do you build a TV remote code reader?

Point any TV or AC remote at a VS1838B receiver and the serial monitor prints its protocol, address and command for each button. You need Arduino Uno R3, IR receiver VS1838B, LED 5 mm red, LED 5 mm green, LED 5 mm yellow, Resistor 220 Ω × 3, Breadboard 400 points (half size) and Jumper wires male to male (40 pcs, 20 cm). It takes 4 steps and about 35 minutes.

Level
Beginner
Time
About 35 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
VS1838B OUT (left pin, facing the dome)Uno D2Demodulated signal
VS1838B GND (middle)Uno GNDGround
VS1838B VCC (right)Uno 5VPower
Uno D9 / D10 / D11220 Ω, red / green / yellow LED, GNDLights for three buttons

Code

Arduino IDE, board "Arduino Uno". Install "IRremote" (version 4 or newer) by shirriff, z3t0 and ArminJo.

Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <IRremote.hpp>

const int LEDS[3] = {9, 10, 11};
// After reading your remote, put the command numbers of three buttons here:
const uint8_t KEYS[3] = {0x0C, 0x18, 0x5E};

void setup() {
  Serial.begin(9600);
  for (int p : LEDS) pinMode(p, OUTPUT);
  IrReceiver.begin(2, ENABLE_LED_FEEDBACK);   // the Uno's built-in LED flashes on each signal
  Serial.println("Press buttons on any remote");
}

void loop() {
  if (!IrReceiver.decode()) return;
  IrReceiver.printIRResultShort(&Serial);      // protocol, address, command
  if (!(IrReceiver.decodedIRData.flags & IRDATA_FLAGS_IS_REPEAT)) {
    for (int i = 0; i < 3; i++)
      if (IrReceiver.decodedIRData.command == KEYS[i]) digitalWrite(LEDS[i], !digitalRead(LEDS[i]));
  }
  IrReceiver.resume();
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Uno with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

Press buttons on any remote

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Any button pressedA line like "Protocol=NEC Address=0x4 Command=0x8"
Holding a buttonRepeat lines marked as repeats
Mapped buttonsEach toggles its LED once per press

If it does not work

Nothing printed

Check the receiver's pin order and that OUT is on D2. Try another remote.

Protocol=UNKNOWN

Some AC remotes send long frames. Use printIRResultRawFormatted to see them.

Gets warm

VCC and GND are swapped. Unplug at once.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the TV remote code reader?

Arduino Uno R3, IR receiver VS1838B, LED 5 mm red, LED 5 mm green, LED 5 mm yellow, Resistor 220 Ω × 3, Breadboard 400 points (half size) and Jumper wires male to male (40 pcs, 20 cm).

How long does the TV remote code reader take to build?

About 35 minutes for a beginner maker, in 4 steps.

How do I know the TV remote code reader works?

Any button pressed: A line like "Protocol=NEC Address=0x4 Command=0x8". Holding a button: Repeat lines marked as repeats. Mapped buttons: Each toggles its LED once per press.

Nothing printed: what should I check?

Check the receiver's pin order and that OUT is on D2. Try another remote.

Protocol=UNKNOWN: what should I check?

Some AC remotes send long frames. Use printIRResultRawFormatted to see them.

Gets warm: what should I check?

VCC and GND are swapped. Unplug at once.