Backing up IR remote codes - IR Receiver

I made an IR receiver to back up the codes from my surround system's dying remote.
Nov 24, 2023 — 4 mins read — Remote Control

Backing up IR remote codes - IR Receiver

I got my surround system, used, about 13 years ago and I must say that I'm very pleased with it and I have been using it ever since.

However, the remote started showing its age, and some of the rubber on the buttons disintegrated, so before losing the whole remote, I decided to do something about it preventatively and make sure that I had a backup of the codes that it sent.

All of the infrared remote controllers work by blasting a data sequence through IR, and that sequence is then picked up by the receiver and turned into action depending on what was pressed. Since the IR does not care about the source of that IR transmission, we can create our own receiver with an IR receiver diode and a NodeMCU to be able to capture and store these codes.

For decoding the signal, I used the IRremote Arduino library, which is already capable of decoding most of the IR protocols used by the different manufacturers of devices. Mine turned out to use the NEC protocol and once I had the sketch ready I was even able to add two LEDs to control through the remote as a proof of concept.


The final version of the code I used to get the IR remote codes is available below.

#define DECODE_NEC
#include <IRremote.hpp>

const int IR_RECEIVE_PIN = D5;

void setup() {
  Serial.begin(115200);
  IrReceiver.begin(IR_RECEIVE_PIN, true, LED_BUILTIN);

  pinMode(D2, OUTPUT);
  digitalWrite(D2, LOW);
  pinMode(D3, OUTPUT);
  digitalWrite(D3, LOW);
}

void loop() {
  if (IrReceiver.decode()) {
    //Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);
    IrReceiver.printIRResultShort(&Serial);
    switch (IrReceiver.decodedIRData.decodedRawData) {
      case 0xF8077F80:
        digitalWrite(D2, HIGH);
        break;
      case 0xF40B7F80:
        digitalWrite(D2, LOW);
        break;
      case 0xF9067F80:
        digitalWrite(D3, HIGH);
        break;
      case 0xF50A7F80:
        digitalWrite(D3, LOW);
        break;
    }
    IrReceiver.resume();
  }
}


Here is the codes table for my remote.

ButtonCommandFull Output
Power0xFD027F80Protocol=NEC Address=0x80 Command=0x2 Raw-Data=0xFD027F80 32 bits LSB first
Mute0xFC037F80Protocol=NEC Address=0x80 Command=0x3 Raw-Data=0xFC037F80 32 bits LSB first
Front+0xF8077F80Protocol=NEC Address=0x80 Command=0x7 Raw-Data=0xF8077F80 32 bits LSB first
Front-0xF40B7F80Protocol=NEC Address=0x80 Command=0xB Raw-Data=0xF40B7F80 32 bits LSB first
Cen+0xFA057F80Protocol=NEC Address=0x80 Command=0x5 Raw-Data=0xFA057F80 32 bits LSB first
Cen-0xF6097F80Protocol=NEC Address=0x80 Command=0x9 Raw-Data=0xF6097F80 32 bits LSB first
Surr+0xF9067F80Protocol=NEC Address=0x80 Command=0x6 Raw-Data=0xF9067F80 32 bits LSB first
Surr-0xF50A7F80Protocol=NEC Address=0x80 Command=0xA Raw-Data=0xF50A7F80 32 bits LSB first
Tre+0xF00F7F80Protocol=NEC Address=0x80 Command=0xF Raw-Data=0xF00F7F80 32 bits LSB first
Tre-0xEC137F80Protocol=NEC Address=0x80 Command=0x13 Raw-Data=0xEC137F80 32 bits LSB first
Bass+0xF20D7F80Protocol=NEC Address=0x80 Command=0xD Raw-Data=0xF20D7F80 32 bits LSB first
Bass-0xEE117F80Protocol=NEC Address=0x80 Command=0x11 Raw-Data=0xEE117F80 32 bits LSB first
Sub+0xF10E7F80Protocol=NEC Address=0x80 Command=0xE Raw-Data=0xF10E7F80 32 bits LSB first
Sub-0xED127F80Protocol=NEC Address=0x80 Command=0x12 Raw-Data=0xED127F80 32 bits LSB first
5.1CH0xE8177F80Protocol=NEC Address=0x80 Command=0x17 Raw-Data=0xE8177F80 32 bits LSB first
AUX0xEA157F80Protocol=NEC Address=0x80 Command=0x15 Raw-Data=0xEA157F80 32 bits LSB first
2.1CH/6CH0xE9167F80Protocol=NEC Address=0x80 Command=0x16 Raw-Data=0xE9167F80 32 bits LSB first
AM0xE7187F80Protocol=NEC Address=0x80 Command=0x18 Raw-Data=0xE7187F80 32 bits LSB first
FM0xEB147F80Protocol=NEC Address=0x80 Command=0x14 Raw-Data=0xEB147F80 32 bits LSB first
RESET0xFB047F80Protocol=NEC Address=0x80 Command=0x4 Raw-Data=0xFB047F80 32 bits LSB first
Vol+0xF7087F80Protocol=NEC Address=0x80 Command=0x8 Raw-Data=0xF7087F80 32 bits LSB first
Vol-0xEF107F80Protocol=NEC Address=0x80 Command=0x10 Raw-Data=0xEF107F80 32 bits LSB first
Tuner+0xFF007F80Protocol=NEC Address=0x80 Command=0x0 Raw-Data=0xFF007F80 32 bits LSB first
Tuner-0xE31C7F80Protocol=NEC Address=0x80 Command=0x1C Raw-Data=0xE31C7F80 32 bits LSB first


You can support me and the channel by buying from the links below at no additional cost to you!


IR arduino remote nodemcu
Read next

Making a jig for programming Sonoff basic switches

Sonoff switches are a great way to start automating your home and adding them to existing circuits. However, what I don't like about them is...

You might also enojy this

Garage remote battery replacement

One of the first reasons why a remote stop working is an empty battery. These things are small and do not hold a lot of charge. When the rem...