Electronic – Arduino infrared problem with universal remote

arduinoinfraredremote control

I am playing with Arduino and Ken Shirriff's IR library. I am trying to control Sony audio receiver using codes I found on the net.

Everything works OK, I am able to control the device by sending IR signal from Arduino, using sendSony function. However, I have problems learning that same codes onto a universal remote control device (I have tried two so far). It just doesn't recognize the codes which, I repeat, work perfectly with the actual Sony device.

Anyone got an idea where things could go wrong, and what parameters should I play with. I have tried varying modulation frequency (36-38-40 kHz), and the frequency of sending individual codes (by altering the pause between successive emissions).

Here's the code which I'm using:

#include <IRremote.h>
IRsend irsend;

void setup()
{
  Serial.begin(9600);
  irsend.enableIROut(40);
}

void sonySend(int code) {
    for (int i = 0; i < 50; i++) {
      irsend.sendSony(code, 12); // Sony TV power code
      delay(30);
    }
}

void loop() {
  sonySend(0x841); // tuner
//  sonySend(0xc41); // tape 1
  delay(1000);
}

Edit: I have one original Sony remote (with some common codes which work on my device). The universal remotes have no problem learning from that Sony remote. Just from Arduino.

The universal remotes I'm using are kind-of noname, Chinese ones, however they worked flawlessly learning from other remotes.

Best Answer

A simple way to debug would be to use an oscilloscpe to compare the difference between the real remote and your Arduino signal.

Either use an IR receiver and scope the results of both Arduino and remote with the same data sent. Or open the remote and scope the lines directly and compare with the Arduino data driving lines. Then adjust your code to make the two identical. As @mpflaga says, the timing between sends is a likely suspect.