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()

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

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

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.

  • \$\begingroup\$ 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? \$\endgroup\$
    – AndrejaKo
    Commented Feb 25, 2013 at 19:48
  • \$\begingroup\$ 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. \$\endgroup\$
    – mpflaga
    Commented Feb 25, 2013 at 19:58
  • \$\begingroup\$ 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. \$\endgroup\$
    – mpflaga
    Commented Feb 25, 2013 at 20:02
  • \$\begingroup\$ @mpflaga: This was one in a series of desperate attempts in varying both parameters, I started with 2-3 repeats with 50ms apart. \$\endgroup\$ Commented Feb 26, 2013 at 7:30

1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.