Problem with using an IR Transmitter and a RF Receiver on the same Arduino


I am trying to setup a Home Automation project involving an Arduino (Leonardo) and a Raspberry Pi. I have the RasPi acting as a web server which I can control from the Internet or via SSH. The RasPi has an RF Transmitter which I use to send signals to an Arduino (in a different room) which has an RF Receiver. The setup works fine when I have just a relay attached to the Arduino and I switch it on or off from the RaspPi

The problem is when I try to attach an IR LED to the Arduino in order to control my room AC.

I have verified that the following works just as expected:

  1. Arduino is just connected to a relay and RasPi sends On and Off signals via RF. → Relay turn on and off

  2. Arduino is connected to the relay and the IR Led, but not the RF Receiver. → I can control both the relay and the IR LED by passing commands through Serial

  3. Use Two Arduino’s: One with the RF Receiver and another with the Relay and IR LED. Communicate using digital pins → I can control both the IR LED and the Relay from the RasPi, but it adds an extra Arduino to the setup which I would like to avoid.

Which leads me to believe that there might be something which messes up when I have both the IR and the RF part of the code running on the Arduino.

I have attached the sketch I am using for controlling both the IR LED and the Relay via the RF Receiver. It compiles fine but doesn’t seem to be doing anything at all. It is supposed to print to the Serial every-time it gets an input, but it doesn’t print anything at all. Which means the RF receiver is not able to catch the signal.

Also in the sketch if I comment out all the lines which transmit an IR signal (anything beginning with “irsend.sendRaw”) it works fine. (The relay turn on and off as expected)

Any thoughts?


  1. I am using RCSwitch ( for the RF Module
  2. and Ken Shirriff’s IR Remote library (A Multi-Protocol Infrared Remote Library for the Arduino)

RF_Recieve_All.ino (5.92 KB)

INT0 is on pin3 on the Leonardo, not pin 2, which is different from the UNO etc


If that is not the problem, then do some research/searching on timer conflicts.

I checked that and it doesn't seem to be the issue. I'll look more into timer conflicts. I had a feeling that might be the issue.

I'll post an update if I find an answer.

Thanks for you help!