Arduino: 10 common pitfalls with Infrared Remote Control

Arduino: 10 common pitfalls with Infrared Remote Control
Arduino: 10 common pitfalls with Infrared Remote Control

Over the last few months we have been regular contributors to the Arduino and other forums, answering questions about Infrared remote control projects. It became apparent that beginners typically trip up on many common ‘pitfalls’. So we decided to list off our ‘Top 10’.


(Note a PDF of this article can be downloaded here)

  1. Use an existing library
    • There are 2 existing & well established IR libraries for Arduino
    • IRremote is the original and there are many examples online
    • IRLib is a more modern re-write of IRremote, with several enhancements.
  2. Read the data sheets first – always a good idea with any electronics project
    • Download and check the data sheet for your IR receiver & IR Led
    • Confirm the pin-out for the IR receiver, as it varies quite a bit – even within the same manufacturer’s range
    • Make sure you know how to wire up the IR Led and which pin is ‘+ve’ vs ‘-ve’
  3. Use a good quality IR receiver
    • A common mistake is to use the cheapest IR receiver available
    • We always use IR components from Vishay (no connection, just good experiences)
    • If the vendor does not provide a link to a data sheet, there is a good chance it is poor quality.
  4. Avoid driving the IR Led/emitter directly from the Arduino pin
    • Best practice dictates that you avoid connecting the IR Led without a current limiting resistor. You should find out the max current provided by an Arduino pin and calculate the resistor value using Ohm’s law, taking account of the forward voltage across the IR Led.
    • Without using a transistor to drive more current through the IR LED you are unlikely to get a reasonable range with your signal.
    • You can confirm the operation of an IR Led using a digital camera on your phone, tablet or webcam. (details via Google/YouTube)
  5. Get it working standalone first
    • Make sure to get the IR part of your circuit working before complicating things with other devices that may interfere with the IR part.
    • Both of the libraries above, come with a set of example sketches. Work through each example first and before you know it, you will understand a lot about IR remote control.
    • Of course, if you are already an expert, feel free to jump in the ‘deep end’.
  6. Make sure you are close to the device when testing
    • It makes no sense trying to test your set-up with a device that is more than 2 or 3 metres away.
    • Once you have verified that your circuit is operating as expected, then try it in the final position.
    • If your target device is fixed, then set up your test circuit close to the fixed device.
  7. Re-configure your library for Air-conditioner signals
    • Air conditioners typically send the full configuration every time a key on the remote is pressed. This results in much longer signals compared to TVs.
    • AC signals can be as long as 128+ bits vs 32 for typical TVs. (or 256 vs 64 pulses)
    • Redefine the RAWBUF value in the IRremote library, if you are controlling Air conditioners.
  8. Beware of limitations in Arduino Libraries (Note: Since original publication, both libraries has been significantly enhanced and most of these limitations are no longer valid)
    • IRremote has several limitations
    • The maximum length of any mark or space is just over 16,000 microseconds.
    • This means that some protocols cannot be sent using the library, as is.
    • One pulse definition in the NEC protocol is set at 1600 vs the correct 1690.
    • Luckily, IRLib has improved things a bit and corrected the above issues.
    • You must enable receiving after every send (irrecv.enableIRIn(); or My_Receiver.enableIRIn();)
  9. Avoid conflicts with other libraries
    1. IRremote & IRLib both use certain pins & timers on the Arduino.
    2. Some of these settings can be configured within the library
    3. If you experience problems with multiple libraries, then find out for yourself which resources are being used and plan a work around.
  10. Interference – Don’t forget the Sun block!
    • The Sun is a very powerful source of IR radiation.
    • Sunshine coming in through windows can play havoc with your IR signals.
    • Other devices such as LED or Plasma TVs, halogen lights can also add to interference
    • The simplest thing is to isolate each of the potential interference sources first until you can identify and then eliminate the source.
    • Finally, a quick check of the data sheet for the IR receiver will show some optional circuitry to reduce interference.

Some Useful IR remote control Links:
Get your copy of AnalysIR here –
IRremote –
IRLib –
All about IR –
Review of IR receivers for Air Conditioners –
Further help can be found via the Arduino forum:

One thought on “Arduino: 10 common pitfalls with Infrared Remote Control

  1. Thanks so much for the tips! The other infrared library, IRLib, seems really useful! As someone who has had a school project for several months on analyzing an AT&T U-verse remote, I can say that everything you all do is extremely helpful! 🙂