MCPcopy Create free account
hub / github.com/IRMP-org/IRMP

github.com/IRMP-org/IRMP @v3.6.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.6.4 ↗ · + Follow
145 symbols 224 edges 49 files 63 documented · 43% updated 59d agov3.6.4 · 2024-10-08★ 320

Browse by type

Functions 136 Types & classes 9
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

IRMP - Infrared Multi Protocol Decoder + Encoder

A library enabling the sending & receiving of infra-red signals with a low memory footprint.

Supports 50 different protocols.

Badge License: GPLv3     Badge Version     Badge Commits since latest     Badge Build Status     Badge Hit Counter

Stand With Ukraine

Available as Arduino library "IRMP".

Button Install     Button Changelog

If you find this library useful, please give it a star.

🌎 Google Translate

Features

  • Total of 50 IR protocols supported.
  • Up to 39 protocols can be enabled for receive at the same time, because some of the 50 protocols are quite similar and conflicts with each other.
  • 39 protocols are available for send.
  • Low memory footprint. FLASH usage in bytes: 1500 for one protocol, 4300 for 15 main and 8000 for all 39 protocols.
  • RAM usage in bytes: 52, 73 and 100.
Nano running AllProtocol example YouTube Video Instructable
Nano running AllProtocol example YouTube Video Instructable

List of protocols

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     GREE CLIMATE     RCII T+A

    RADIO e.g. TEVION     METZ

NEC     Kaseiko     Denon     RC6     Samsung + Samsg32   were successfully tested in interrupt mode, but there are many protocols which in principle cannot be decoded in this mode.

Features

  • You may use every pin for input or output.
  • Interrupt mode for major protocols.
  • Callback after successful receive of a command.
  • Support for inverted feedback LED (for send and receive feedback).
  • Support for inverted IR output for LED connected to VCC.
  • Unmodulated IR signal output enables direct replacment of an IR receiver circuit.
  • Compatible with Arduino tone library.
  • Send can also also wait for trailing space/gap.

Restrictions

  • Send IR frequency is fixed at 38 kHz.

Minimal version

For applications only requiring NEC protocol, there is a receiver which has very small codesize of 500 bytes and does NOT require any timer. See the MinimalReceiver and IRDispatcherDemo example how to use it. Mapping of pins to interrupts can be found here.

Schematic for Arduino Uno

The VS1838B is used as receiver for all examples and tests. This module has a 120 µs on/low and a 100 µs off/high delay between received signal and output. So it shortens the mark and extends the space by 20 µs. | IR-Receiver connection | Serial LCD connection | |---|---| Fritzing schematic for Arduino Uno | Fritzing schematic for Arduino Uno + LCD

Supported Arduino architectures / CPU's / boards

For ESP8266/ESP32, this library supports an impressive set of protocols and a lot of air conditioners

ATtiny and Digispark boards are tested with the recommended ATTinyCore using New Style pin mapping for the pro board. | Architecture | CPU | Board | |-|-:|-:| | avr | ATmega16, ATmega328P, ATmega32U4, ATtinyX5, ATtinyX7 | Uno, Nano, Leonardo, Sparkfun Pro Micro, Digispark etc. | | megaavr | ATmega4809 | Uno WiFi Rev 2, Nano Every | | samd | SAMD21G18A | Zero, MKR, etc. but not DUE, which is sam architecture* | | esp8266 | All protocols does not fit in IRAM | all | | esp32 | % | all | | stm32 | STM32F1xx | BluePill | | STM32F1 | STM32F1xx | BluePill | | apollo3 | Ambiq Apollo3 | Sparkfun Apollo3 + Artemis | | mbed | nRF528x | Nano 33 BLE | | Teensiduino | all - but limited support | >= Teensy 3 |

Quick comparison of 5 Arduino IR receiving libraries

This is a short comparison and may not be complete or correct.

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 24.06.2022 and updated 10/2023. If you have complains about the data or request for extensions, please send a PM or open a discussion.

Here you find an ESP8266/ESP32 version of IRremote with an impressive list of supported protocols.

| Subject | IRMP | IRLremote | IRLib2

mostly unmaintained | IRremote | TinyIR | IRsmallDecoder |-|-|-|-|-|-|-| | Number of protocols | 50 | Nec + Panasonic + Hash * | 12 + Hash * | 17 + PulseDistance + Hash * | NEC + FAST | NEC + RC5 + Sony + Samsung | | Timing method receive | Timer2 or interrupt for pin 2 or 3 | Interrupt | Timer2 or interrupt for pin 2 or 3 | Timer2 | Interrupt | Interrupt | | Timing method send | PWM and timing with Timer2 interrupts | Timer2 interrupts | Timer2 and blocking wait | PWM with Timer2 and/or blocking wait with delay

Microseconds() | blocking wait with delay

Microseconds() | % | | Send pins| All | All | All ? | Timer dependent | All | % | | Decode method | OnTheFly | OnTheFly | RAM | RAM | OnTheFly | OnTheFly | | Encode method | OnTheFly | OnTheFly | OnTheFly | OnTheFly or RAM | OnTheFly | % | | Callback suppport | x | % | % | x | x | % | | Repeat handling | Receive + Send (partially) | % | ? | Receive + Send | Receive + Send | Receive | | LED feedback | x | % | x | x | Receive | % | | FLASH usage (simple NEC example with 5 prints) | 1820

(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 | 1770 | 900 | ?1100? | | RAM usage | 52

(73 / 100 for 15 (main) / 40 protocols) | 62 | 334 | 227 | 19 | 29 | | 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 | All platforms with attach

Interrupt() | All platforms with attach

Interrupt()** | | Last library update | 5/2023 | 4/2018 | 11/2022 | 9/2023 | 5/2023 | 2/2022 | | 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 - 63 issues, 10 pull requests. | Universal decoder and encoder.

Supports Pronto codes and sending of raw timing values. | Requires no timer. | Requires no timer. |

* 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

Pin usage

You may use every pin for input or output, just define it like #define IRMP_INPUT_PIN 2 and #define IRSND_OUTPUT_PIN 3. The PWM of the output pin is generated by software bit banging.

Dynamic pins numbers

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.

Receiving and sending simultaneously

Receiving and sending is possible with this library, but since we use only 1 timer, receiving is inhibited while sending the IR signal.

Sending the IR signal starts with saving current timer configuration, setting the timer to the send configuration / frequency, sending the signal (and waiting for the gap after the signal) and then automatically reset the timer to its previous (receiving) configuration.

API

IRMP

// Init functions
void irmp_init (void);
void irmp_init(uint_fast8_t aIrmpInputPin);
void irmp_init(uint_fast8_t aIrmpInputPin, uint_fast8_t aIrmpFeedbackLedPin);
void irmp_init(uint_fast8_t aIrmpInputPin, uint_fast8_t aIrmpFeedbackLedPin, bool aIrmpLedFeedbackPinIsActiveLow);
void irmp_register_complete_callback_function(void (*aCompleteCallbackFunction)(void));

// Info function
bool irmp_IsBusy();
void irmp_print_active_protocols(Print *aSerial);

// Main check for result function used in loop()
bool irmp_get_data (IRMP_DATA *)

// Result print functions
void irmp_result_print(Print *aSerial, IRMP_DATA * aIRMPDataPtr);
void irmp_result_print(IRMP_DATA *aIRMPDataPtr);

IRSND

// Init functions
void irsnd_init (void);
// 3 additional init functions if IRMP_IRSND_ALLOW_DYNAMIC_PINS is defined
void irsnd_init(uint_fast8_t aIrsndOutputPin);
void irsnd_init(uint_fast8_t aIrsndOutputPin, uint_fast8_t aIrmpFeedbackLedPin);
void irsnd_init(uint_fast8_t aIrsndOutputPin, uint_fast8_t aIrmpFeedbackLedPin, bool aIrmpLedFeedbackPinIsActiveLow);

// Send function - sends frame AND trailing space
bool irsnd_send_data (IRMP_DATA *, uint8_t);

// Info functions
bool irsnd_is_busy (void);

void irsnd_stop (void);

IRMP and IRSND

// LED feedback function
void irmp_irsnd_LEDFeedback(bool aEnableBlinkLed);

// Timer management functions for 
void disableIRTimerInterrupt(void);
void enableIRTimerInterrupt(void);
void storeIRTimer(void);
void restoreIRTimer(void);

Examples

In order to fit the examples to the 8K flash of ATtiny85 and ATtiny88, the Arduino library ATtinySerialOut is required for this CPU's.

AllProtocols

Receives up to 40 protocols concurrently and displays the short result on a 1602 LCD. The LCD can be connected parallel or serial (I2C).

SimpleReceiver + SimpleSender

This examples are a good starting point.

SimpleReceiver can be tested online with WOKWI. Click on the receiver while simulation is running to specify individual IR codes.

MinimalReceiver + MinimalSender

If code size matters, look at these examples.

The MinimalReceiver example uses the TinyReceiver library which can only receive NEC and FAST codes, but does not require any timer.

MinimalReceiver can be tested online with [WOKWI](https://wokwi.com/arduino/projec

Core symbols most depended-on inside this repo

Shape

Function 128
Class 9
Method 8

Languages

C++100%

Modules by API surface

examples/AllProtocols/ADCUtils.hpp38 symbols
src/irmp.hpp13 symbols
src/irsnd.hpp11 symbols
examples/IRDispatcherDemo/IRCommandDispatcher.hpp11 symbols
src/TinyIRReceiver.hpp8 symbols
src/irsndArduinoExt.hpp6 symbols
src/irmpArduinoExt.hpp6 symbols
src/TinyIRSender.hpp6 symbols
src/IRTimer.hpp6 symbols
src/irmpPinChangeInterrupt.hpp4 symbols
examples/IRDispatcherDemo/IRCommandDispatcher.h4 symbols
src/TinyIR.h2 symbols

For agents

$ claude mcp add IRMP \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page