# Arduino infrared problem with universal remote

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.

• Just so that we're clear: The remote control units can't learn codes sent using Arduino, but same codes work with real receiver? If so, what remote controllers are you using? – AndrejaKo Feb 25 '13 at 19:48
• So the problem is not with the Arduino. But with your Universal Remote, in that it is not learning. This should have nothing to do with an Arduino. In that the source being learned should be the actual Sony Remote. There are minor differences, that may accumulate if you are trying to learn from the Arduino, pretending to be the Sony. Or is that the original remote is lost and trying to replace it - and ad-hoc learn it. – mpflaga Feb 25 '13 at 19:58
• you may be pounding the universal remote. It may need more of a delay between the irsend's. 30ms may not be enough time for it to idle out, while in learning mode. If you have the original you should use the Arduino IRrecvDump.ino to see what the real remote actually sends. 50 times 30ms apart is a bit much. – mpflaga Feb 25 '13 at 20:02
• @mpflaga: This was one in a series of desperate attempts in varying both parameters, I started with 2-3 repeats with 50ms apart. – Mladen Jablanović Feb 26 '13 at 7:30