IRMP - Infrared Multi Protocol Decoder + Encoder
Available as Arduino library "IRMP"
- Only 40 protocols can be enabled for receive at the same time, because some of them are quite similar and conflicts with each other.
- 39 protocols are available for send.
- FLASH usage in bytes: 1500 for one protocol, 4300 for 15 main and 8000 for all 40 protocols.
- RAM usage in bytes: 52, 73 and 100.
Nano running AllProtocol example | YouTube Video | Instructable |
---|---|---|
![]() |
![]() |
![]() |
- Sony SIRCS, NEC + APPLE + ONKYO, Samsung + Samsg32, Kaseikyo
- JVC, NEC16, NEC42, Matsushita, DENON, Sharp, RC5, RC6 & RC6A, IR60 (SDA2008) Grundig, Siemens Gigaset, Nokia
- BOSE, Kathrein , NUBERT , FAN (ventilator) , SPEAKER (~NUBERT), Bang & Olufsen , RECS80 (SAA3004) , RECS80EXT (SAA3008), Thomson, NIKON camera , Netbox keyboard, ORTEK (Hama) , Telefunken 1560, FDC3402 keyboard , RC Car , iRobot Roomba, RUWIDO, T-Home , A1 TV BOX, LEGO Power RC, RCMM 12,24, or 32, LG Air Condition , Samsung48, Merlin , Pentax , S100 , ACP24, TECHNICS , PANASONIC Beamer , Mitsubishi Aircond , VINCENT, SAMSUNG AH , IRMP specific, GREE CLIMATE , RCII T+A, RADIO e.g. TEVION, METZ
- NEC, Kaseiko, Denon, RC6, Samsung + Samsg32 were sucessfully tested in interrupt mode.
- You may use every pin for input or output.
- Interrupt mode for major protocols.
- Supports inverted feedback LED for send and receive feedback.
- Supports inverted IR output for LED connected to VCC.
- Compatible with Arduino tone() library.
IR-Receiver connection | Serial LCD connection |
---|---|
![]() |
![]() |
I created this comparison matrix for myself in order to choose a small IR lib for my project and to have a quick overview, when to choose which library.
It is dated from 30.7.2020. If you have complains about the data or request for extensions, please send a PM or open an issue.
Subject | IRMP | IRLremote | IRLib2 mostly unmaintained |
IRremote |
---|---|---|---|---|
Number of protocols | 50 | Nec + Panasonic + Hash * | 12 + Hash * | 16 |
3.Party libs needed | % | PinChangeInterrupt if not pin 2 or 3 | % | % |
Timing method receive | Timer2 or interrupt for pin 2 or 3 | Interrupt | Timer2 or interrupt for pin 2 or 3 | Timer2 |
Timing method send | Timer2 interrupts | Timer2 interrupts | Timer2 and blocking wait | ? |
Send pins | All | All | All ? | ? |
Decode method | OnTheFly | OnTheFly | RAM | RAM |
Encode method | OnTheFly | ? | OnTheFly | ? |
LED feedback | x | % | x | x |
FLASH usage (simple NEC example with 5 prints) | 1500 (4300 for 15 main / 8000 for all 40 protocols) (+200 for callback) |
|||
(+80 for interrupt at pin 2+3) | 1270 (1400 for pin 2+3) |
4830 | 3210 | |
RAM usage | 52 (73 / 100 for 15 (main) / 40 protocols) |
62 | 334 | 227 |
Supported platforms | avr, megaAVR, attiny, Digispark (Pro), esp8266, ESP32, STM32, SAMD 21, Apollo3 (plus arm and pic for non Arduino IDE) |
avr, esp8266 | avr, SAMD 21, SAMD 51 | avr, attiny, esp8266, esp32, SAM, SAMD |
Last library update | 4/2020 | 4/2018 | 9/2019 | 11/2017 |
Remarks | Decodes 40 protocols concurrently. 39 Protocols to send. Work in progress. |
Only one protocol at a time. | Consists of 5 libraries. Project containing bugs - 45 issues, no reaction for at least one year. | Decoding is very basic and easy to extend. 135 open issues and an incredible amount of forks. |
*The Hash protocol gives you a hash as code, which may be sufficient to distinguish your keys on the remote, but may not work with some protocols like Mitsubishi
You may use every pin for input or output, just define it like #define IRMP_INPUT_PIN 3
and #define IRSND_OUTPUT_PIN 4
. The PWM of the output pin is generated by Software.
If you want to use pin numbers for input, output and LED feedback specified at runtime, you must define IRMP_IRSND_ALLOW_DYNAMIC_PINS
. See ReceiveAndSendDynamicPins example.
The irmp_init
and irsnd_init
function then allows up to 3 parameters uint_fast8_t aIrmpInputPin/aIrsndOutputPin, uint_fast8_t aIrmpFeedbackLedPin, bool aIrmpLedFeedbackPinIsActiveLow
.
Be aware, only one pin and enable flag for receive and send feedback LED is supported.
See also the SimpleReceiver example .
#include <IRremote.h>
#define IR_RECEIVER_PIN 3
IRrecv myReceiver(IR_RECEIVER_PIN);
decode_results results;
to
#define IRMP_INPUT_PIN 3
#define IRMP_PROTOCOL_NAMES 1
#include <irmpSelectMain15Protocols.h>
#include <irmp.c.h>
IRMP_DATA irmp_data[1];
myReceiver.enableIRIn();
to irmp_init();
if (myReceiver.decode(&results))
to if (irmp_get_data(&irmp_data[0]))
and
switch (results.value)
to switch (irmp_data[0].command)
.
You do not need myReceiver.resume();
any more, just delete it.
The IR code representation of IRMP is different from that in IRremote. In IRMP (as in IRLremote) it is more standard and simpler. Use the function irmp_result_print(&irmp_data[0])
to print the IR code representation. See SimpleReceiver example.
If you want to distinguish between more than one remote in one sketch, you may also use irmp_data[0].address
like it is done in the Callback example.
The IRMP receive library works by polling the input pin at a rate of 10 to 20 kHz. Default is 15 kHz.
Many protocols can be received without timer usage, just by using interrupts from the input pin by defining IRMP_ENABLE_PIN_CHANGE_INTERRUPT
. See Interrupt example.
The IRMP send library works by bit banging the output pin at a frequency of 38 kHz. This avoids blocking waits and allows to choose an arbitrary pin, you are not restricted to pin 3 or 11. The interrupts for send pin bit banging require 50% CPU time on a 16 MHz AVR.
If both receiving and sending is required, the timer is set up for receiving and reconfigured for the duration of sending data, thus preventing (non interrupt) receiving while sending data.
The tone() library (using timer 2) is still available. You can use it alternating with IR receive and send, see ReceiveAndSend example.
- For AVR timer 2 (Tone timer) is used for receiving and sending. For variants, which have no timer 2 like ATtiny85 or ATtiny167, timer 1 is used.
- For SAMD TC3 is used.
- For Apollo3 Timer 3 segment B is used.
- For ESP8266 and ESP32 timer1 is used.
- For STM32 (BluePill) timer 3 (Servo timer) channel 1 is used as default.
- If you use polling (default) mode with timer 2, the
millis()
function and the corresponding timer is not used by IRMP! - In interrupt mode, the
micros()
function is used as timebase.
AllProtocol example
Serial LCD output | Arduino Serial Monitor output |
---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
http://www.mikrocontroller.net/articles/IRMP_-_english
http://www.mikrocontroller.net/articles/IRSND_-_english
http://www.mikrocontroller.net/articles/IRMP
http://www.mikrocontroller.net/articles/IRSND
- Support of RF (433MHz) remotes. 2 protocols Generic 24 bit format and X10 format added.
- MegaAVR (ATmega4809) support.
- Added
IRMP_IRSND_ALLOW_DYNAMIC_PINS
and extendedirmp_init()
andirsnd_init()
to allow input, output and LED feedback pin selection at runtime. - Support more protocols simultaneously on 32 bit CPUs.
- Use same pin and enable flag for receive and send feedback LED.
- New function
irmp_print_active_protocols()
.
- Improved pin layout.
- Fixed bug with stm32duino 1.9.
- Version number.
- Blink13 -> LEDFeedback.
- Supported Apollo3 platform.
- Fixed DigisparkPro bug.
- Supported SAMD platform.
- IRSND enabled for non AVR platforms.
- Added IR send fuctionality (IRSND).
- Use
TIMER2_COMPB_vect
to be compatible with tone() library. - No longer required to call initPCIInterrupt() manually if IRMP_ENABLE_PIN_CHANGE_INTERRUPT is set.
- Separated code for timer to IRTimer.cpp.h.
- Separated code for Pin change interrupt to irmpPinChangeInterrupt.cpp.h.
- Fixed wrong pin numbers for BluePill.
- Fixed bugs introduced in 1.2.1.
- Bug for AVR architecture fixed.
- ATtiny85 + ATtiny167 support for ATTinyCore and Digistump core.
- Support for "Generic STM32F1 series" from STM32 Boards from STM32 cores of Arduino Board manager.
- Added STM32 M3 (BluePill) support.
- Added functions
irmp_disable_timer_interrupt()
andirmp_enable_timer_interrupt()
. - Added function
irmp_result_print(Stream * aSerial)
. - Improved examples.
- Added ESP8266 + ESP32 support.
Since Travis CI is unreliable and slow (5 times slower), the library examples are now tested with GitHub Actions for the following boards:
- arduino:avr:uno
- arduino:avr:mega
- arduino:samd:arduino_zero_edbg
- digistump:avr:digispark-tiny16
- digistump:avr:digispark-pro (ATtiny167)
- ATTinyCore:avr:attinyx5:chip=85,clock=8internal
- esp8266:esp8266:huzzah:eesz=4M3M,xtal=80
- esp32:esp32:featheresp32:FlashFreq=80
- STM32:stm32:GenF1:pnum=BLUEPILL_F103C8