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.
You can support me and the channel by buying from the links below at no additional cost to you!
- IR Receiver - https://s.click.aliexpress.com/e/_okRpDcQ
- IR Emitting diode - https://s.click.aliexpress.com/e/_EwDXLHx
- Infra red emitter/receiver diodes - https://s.click.aliexpress.com/e/_EH4SwcV
- NodeMCU - https://s.click.aliexpress.com/e/_EIzr5st
- ESP32 - https://s.click.aliexpress.com/e/_m0g9Qre
- Breadboard and jumpers - https://s.click.aliexpress.com/e/_oCpPU7g
- Bench power supply - https://s.click.aliexpress.com/e/_oolrr0m
- Multimeter - https://s.click.aliexpress.com/e/_mNhvG1i
- Assorted LEDs - https://s.click.aliexpress.com/e/_mtGIvau
- IR Blaster - https://s.click.aliexpress.com/e/_opCPSPo