This is the code for this YouTube video: https://youtu.be/gADIb1Xw8PE
- Download this repository (Code → Download ZIP)
- Extract the ZIP file
- Copy the ESP32-IRremote folder to your Arduino libraries folder:
- 🪟 Windows:
Documents\Arduino\libraries\ - 🍎 macOS:
~/Documents/Arduino/libraries/ - 🐧 Linux:
~/Arduino/libraries/
- 🪟 Windows:
- Restart the Arduino IDE
- Open the example sketch from File → Examples → IRremote
⚠️ Important: You need to copy theESP32-IRremotefolder itself, not the entire repository folder.
| Platform | Status | Library to Use |
|---|---|---|
| ESP32 | ✅ Supported | ESP32-IRremote (this repo) |
| ESP8266 | IRremoteESP8266 |
❌ Do NOT use IRremoteESP8266 on ESP32 with this project! It may cause crashes when sending IR signals. Use the
ESP32-IRremotelibrary from this repository instead.
The IRMQTT_ESP32 folder contains an MQTT-enabled IR transceiver sketch that allows you to:
- Receive IR codes and publish them to an MQTT broker
- Send IR codes by subscribing to MQTT commands
| Function | GPIO Pin |
|---|---|
| IR Receiver | GPIO 14 |
| IR Sender | GPIO 5 |
| Status LED | GPIO 2 |
| Topic | Direction | Description |
|---|---|---|
IR/key |
Publish | Received IR codes are published here |
IR/command |
Subscribe | Send IR codes by publishing here |
IR/service |
Publish | Status messages |
{"type":"3", "value":"1303526340", "length":"32"}| Field | Description |
|---|---|
type |
IR protocol (1=RC5, 2=RC6, 3=NEC, 4=Sony, 5=Panasonic, 6=JVC) |
value |
The IR code value |
length |
Bit length of the code |
NEC, Sony, Panasonic, JVC, RC5, RC6
Please comment out the credentials.h include if you have no such file in your library folder.
The credentials.h file contains your WiFi credentials:
#define CREDENTIALS 1
// WLAN
#define mySSID "your-wifi-name"
#define myPASSWORD "your-wifi-password"Set your MQTT broker IP in the sketch:
IPAddress server(192, 168, 0, 203);