How do I read the IR hex codes from an arbitrary remote control?

11.1k views Asked by At

I have scoured google and cannot find articles related to this exact subject.

I have several remote controls I need to manually enter in the universal remote app on my phone. However, I cannot find these codes online no matter where I've looked.

Isn't there an IR receiver device that I can point my remote at, press any button on the remote, and it will tell me the corresponding hex code? I don't understand IR technology very well, but it seems that something like this must exist, otherwise how on earth do projects like lirc get all of those codes?

If possible, I would like to know the name of such device if it exists, or if not a general nudge in the direction of how to build one.

Thanks!

2

There are 2 answers

0
Dithermaster On

You can get an IR receiver component and read it with a small microcontroller to get the signal that is being sent, but I don't know how to turn that into a hex code. I have seen projects that instead just play back the signal when needed.

Some references on reading the signal with a sensor:

http://learn.adafruit.com/ir-sensor

http://playground.arduino.cc/Code/InfraredReceivers

There are boxes for receiving and sending IR with your PC, but again, I don't know if they have a way of getting the hex codes that you need for your app.

http://www.intolect.com/irmandetail.htm

0
Robbie On

This can easily be done with an Arduino and an infrared receiver which filters out any background signals for you

I connected the infrared receiver to an analog pin on my Arduino and downloaded the IRremote library for decoding the infra-red signal. I then printed the decoded signal to the Arduino IDE serial monitor

Upload the below code to your Arduino, and open the serial monitor while the Arduino is still connected to see the hex codes received

#include <IRremote.h>

// Create an instance of the object to decode the signal from the IR receiver,
// passing in the value of the analog pin you chose
IRrecv irReceiver(A0);
// Create a container for the decoding result
decode_results result;

void setup()
{
  // Ensure the serial monitor is set to the same frequency you pass into Serial.begin
  // in this case 9600
  Serial.begin(9600);
  irReceiver.enableIRIn();
}

void loop()
{
  if (irReceiver.decode(&result))
  {
      irReceiver.resume();
      Serial.println(result.value, HEX);
  }
}