Skip to main content

ir

Send and receive infrared signals for controlling TVs, air conditioners, and other IR-enabled appliances.

Overview

The ir node sends and receives infrared signals for controlling TVs, air conditioners, set-top boxes, and other IR-enabled appliances. Learn remote codes, replay signals, and build universal remote control systems using standard IR protocols like NEC, RC5, and Sony.

38kHz
Carrier
NEC/RC5
Protocols
10m
Range
TX & RX
Direction

Properties

Property Type Required Default Description
txPin number No - GPIO pin connected to IR LED for transmitting
rxPin number No - GPIO pin connected to IR receiver module
protocol string No "nec" "nec" | "rc5" | "sony" | "raw" protocol
code string No - IR code to transmit (hex string)
repeat number No 1 Number of times to repeat the signal
learnMode boolean No false Enable learning mode to capture remote codes
rawTiming array No - Raw timing array in microseconds for custom signals

Inputs

Send IR Code
{
  "payload": {
    "command": "send",
    "protocol": "nec",
    "address": "0x04",
    "code": "0x08",
    "repeat": 2
  }
}
Send Raw Timing
{
  "payload": {
    "command": "sendRaw",
    "timing": [9000, 4500, 560, 560,
      560, 1690, 560, 560, 560, 1690],
    "frequency": 38
  }
}

Outputs

Received IR Signal
{
  "payload": {
    "protocol": "NEC",
    "address": "0x04",
    "command": "0x08",
    "raw": [9000, 4500, 560, 560],
    "repeat": false
  }
}
Learn Mode Capture
{
  "payload": {
    "mode": "learned",
    "protocol": "NEC",
    "address": "0x04",
    "command": "0x08",
    "rawLength": 68,
    "timestamp": "2024-01-15T10:30:45Z"
  }
}

Use Case Examples

AC Control

Automate air conditioner temperature, fan speed, and mode control based on room temperature and schedules.

TV Automation

Control TV power, volume, input switching, and channel selection as part of home automation scenes.

Home Theater

Orchestrate projectors, receivers, screens, and lighting with a single command using multi-device IR sequences.

IR Blaster

Build a network-connected IR blaster to control any IR device from anywhere via MQTT or HTTP commands.

Tips & Best Practices

Use learn mode to capture codes from existing remotes, then store and replay them. This works for any IR device.

Drive the IR LED through a transistor (NPN like 2N2222) for much higher current and improved range beyond 5 meters.

AC units use long, complex IR codes. Use raw timing capture for AC remotes as they often use proprietary protocols.

Position the IR LED with line of sight to the target device. Use multiple LEDs pointing in different directions for wider coverage.

Related Nodes