IR signals consists of a series of modulated pulses called "marks" separated by intervals called "spaces". Typically there is a long mark and space at the beginning of each signal that serves as a header. Then by varying the timing of marks and spaces, a sequence of bits is transmitted. If you had to store the precise timing of the entire signal it would take an array of up to 100 16 bit integers. In order to compare the data received to see if it was what you wanted, you would similarly need to store large arrays of data.

Fortunately the signals are sent according to very specific protocols that allow you to take this received timing data and turn it into a single binary number of up to 32 bits. The IR library collects the timing information in a buffer and then turns it into a single 32 bit value. You can then easily compare that value to the one you want.

Similarly if you want to transmit IR signals, all you need to do is pass 32 bit value to the library and tell it what protocol you want to use. It converts that value into a stream of marks and spaces with the proper headers, bit encodings and timings.

The gold standard of IR libraries is "LIRC" or Linux Infrared Remote Control which can be found at It consists of drivers and a large database of information on hundreds of various remote controls. If we are using a Linux based system it's definitely the way to go. We will not be discussing that library here as we intend to focus on Arduino based systems.

In August 2009 Ken Shirrff published "IRremote" on his blog and released it on GitHub. Then in January 2013 I released IRLib based on Ken's earlier work. This revision reorganize the code making it easier to add new protocols using object-oriented programming design in C++.

Detailed information about  IRLib can be found on my blog at It includes an extensive user manual which is also available in the "manuals" folder of the library.. We'll use IRLib in this tutorial to help you get started.

In September 2016 we released a major rewrite of IRLib called IRLib 2.0. It was not fully backward-compatible with the original IRLib. This tutorial has been updated to use IRLib 2.0. The previous IRLib 1.x will no longer be supported. Recently IRLib 2.03 was released which added support for 32-bit SAMD 21 processors such as those used in Arduino Zero, Adafruit Feather M0, and the upcoming Circuit Playground Express.

This guide was first published on Feb 26, 2015. It was last updated on Mar 08, 2024.

This page (About IR libraries) was last updated on Feb 14, 2015.

Text editor powered by tinymce.