IR Receiver

arduino uno infrared IR receiver

Use IR receiver TSOP4838 and Arduino to receive remote controller IR codes. Start monitoring the serial console, and then press the remote controller button.

Only supported protocols for the remote controllers can be used. If the protocol is supported, then the serial console’s first line will show the decoded protocol and the hex code values.

Debugging

For error on lto1: internal compiler error: in lto_output_varpool_node, at lto-cgraph.c:624, install version 1.6.21 of the IR Arduino library:

arduino-cli core install arduino:[email protected]

Sample Remote control HEX

For Benq projector remote control

ON
Decoded NEC(1): Value:CF20D

OFF
Decoded NEC(1): Value:C728D

Increase volume
Decoded NEC(1): Value:C41BE

Decrease volume
Decoded NEC(1): Value:CC13E

Eco blank
Decoded NEC(1): Value:CE01F

Code

Download code
#include <IRLibAll.h>

IRrecvPCI myReceiver(2);
IRdecode myDecoder;

void setup() {
  Serial.begin(9600);
  delay(2000); while (!Serial);
  myReceiver.enableIRIn();
  Serial.println("Ready to receive IR signals...");
}

void loop() {
  if (myReceiver.getResults()) {
    myDecoder.decode();
    myDecoder.dumpResults(true);
    myReceiver.enableIRIn();
  }
}

Serial console

Serial output from the firmware.

IR Receiver serial console

Schematic

Wire up the hardware accordingly

IR Receiver schematic

References