New library: IR remote send/receive

I've written a new IR remote control library. It handles both sending and receiving codes, and supports the Sony, NEC, RC5, and RC6 protocols. For more details see A Multi-Protocol Infrared Remote Library for the Arduino

Please take a look and let me know if you have any suggestions, bugs, etc.

Anxious to try this. Very nice writeup. :slight_smile: You might want to put it on the Playground.
Thanks!

Great work! Does it support multiple IR receivers on the same arduino board?

It doesn't currently support multiple IR receivers.

The easiest thing would be to AND the receiver outputs together (since the sensors are active-low) and provide this as a single input to the Arduino. This would work if only one receiver is being used at a time, or if they are receiving the same signal. You could also use multiple Arduino inputs and do this AND logic in the interrupt routine, testing if any of the inputs are low.

It would be fairly difficult to support multiple IR receivers that could receive different signals simultaneously, as each one would need to be tracked independently.

I have tried your library and it works great. However when I used the same arduino board for both sending and receiving IR data I noticed the following:

  1. I couldn't receive the data I was sending, but I could receive data from other IR sources. The explanation probably here is that while IR data is sent, arduino is busy and the IR reception subsystem doesn't get a chance to record data.
  2. I was receiving fine up until I sent the first byte via IR. From that point and further reception of IR data from any IR source stopped. Could this be some sort of "API interference" between IRsend and IRrecv?

The program is:

#include <IRremoteInt.h>
#include <IRremote.h>

// IRSendPin fixed to 3 (PWM)
int IRRecvPin = 11;

IRsend irsend;
IRrecv irrecv(IRRecvPin);
decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {
if (Serial.read() != -1) {
for (int i = 0; i < 3; i++) {
irsend.sendSony(0x90, 8); // Sony TV power code
delay(100);
}
}

if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}

You can't use sending and receiving at the same time. When you do a send, the receiving is disabled. To re-enable it after sending you need to call:
irrecv.enableIRIn(); // Start the receiver

Ken

Hi Ken,

I've tried your code and its work. I got this raw code "2FD807F" when I press no 1 button on the remote. I am trying to make a small robot that can be control by remote.
Can you or somebody who read this help me to trnslate this code to light an Led.

I will publish this project in my blog.

Thanks.

Hello all,

does anyone have an idea, who to convert the codes from Adafruits TV-B gone, to be used by this library, for an Arduino based TV-B gone clone.

Alex

I'm really confused. How do you put LIRC data into the library so that it detects it as a protocol and not as raw data?

This is the remote in question:
http://lirc.sourceforge.net/remotes/samsung/BN59-00940A

How would you send RC5 : 820 ? What needs to be replaced in your Sony example to make it work?

Got it. To send RC5 (the magnavox protocol) And code 20 (for turning the channel up) you would use this code:

#include <IRremote.h>
IRsend irsend;

void setup()
{
  Serial.begin(9600);
}

void loop() {
  
    for (int i = 0; i < 3; i++) {
      irsend.sendRC5(0x20, 12); // 20 is the channel up code
      delay(50);
    }
}

Had a bash with this Library myself, looks good and recognises my Sky Remote.

It does seem as 90% of the codes from the remote come through as "Unknown" whilst a few come through as the correct RC6 code.

I've picked up an TV controller (an IR extender basically). Cut the receiver cable, wired that up to the Arduino and stuck the signal cable (which runs back to the blaster) in the "transmit" pin.

ie:
Receiver >>>>>>>>> Blaster >>>>>>>> TV

Now

Receiver >>>> Arduino >>>> Blaster >>>> TV

The return path from the Arduino to blaster isn't working. I've tried the "Replay" feature of this library but no joy.

Hopefully I can figure it out. Does anyone have any tips? I notice the library doesn't technically support RC6.

I made the IR remote controller using the IR remote library and IR record examples... together with a 2x16 LCD on a breadboard.

It seems only NEC & Yamaha codes are working for me...whereas other IR signals once it is recorded, I am not able to produce the recorded IR signal ..

How to I troubleshoot this ?

How to I save those unknown signals to a header files ?

How can I boost or increase the IR signal ? I am using 220R between the Pin 3 to the IR transmitter..

Should I use a lower resistor for this ?

Thank you for reading this ... :slight_smile: