IR Remote Signal Repeater Using ESP32: Old School, New Tricks

by kghrlabo in Circuits > Arduino

535 Views, 10 Favorites, 0 Comments

IR Remote Signal Repeater Using ESP32: Old School, New Tricks

ESPRepeater_overview.jpg

I wanted to create a portable TV setup that would not be limited in its placement by cables and tuner equipment. To achieve this, I placed the tuner near the cable TV antenna and connected it to a Wireless HDMI Transmitter. The video and audio signals were then transmitted wirelessly to the display. However, I couldn't control the tuner with its remote from the location of my portable TV. To solve this, I created an IR remote signal repeater using ESP32. The ESP32 placed near the Display is equipped with an IR receiver module. It receives the IR signals from the remote and transmits them to another ESP32 near the tuner using ESP-NOW. The second ESP32 then sends the received signals to the tuner using an IR transmitter module. This setup allows me to enjoy a portable TV experience.

Supplies

ESPRepeater_Supplies.jpg

ESP32 boards x 2

I used the MH ET LIVE ESP32Minikit. This project should be compatible with other ESP32 boards.

IR Receiver and Transmitter module

Digital 38khz Ir Receiver Ir Transmitter sensor Module Kit. I believe that the VS1838B or HX1838 is better than the HS0038 or TL1838 when it comes to receiving infrared signals with less noise and higher sensitivity.

Various wires

While some wiring is necessary to connect the ESP32 and IR module, the process is relatively straightforward.

Setting Up the Display Side

ESPRepeater_Master.jpg

The display side ESP32 receives infrared remote signals and transmits them over ESP-NOW to a slave device, which controls an IR emitter.

Hardware Connections:

The IR receiver module was connected to GPIO16, with GND connected to the ESP32's GND and VCC to the ESP32's VCC(5V).

Sketch:

This sketch combines the ESP_NOW sample sketch (ESP_NOW_Broadcast_Master.ino) and the IRremoteESP8266 sample sketch (IRrecvDumpV2.ino). To accommodate the 250-byte limitation of ESP-NOW data packets, IR remote signals larger than 250 bytes are divided into 250-byte chunks before transmission.

If you wish to use a different GPIO pin, simply modify the kRecvPin value at the beginning of the sketch.

const uint16_t kRecvPin = 16;

Setting Up the Tuner Side

ESPRepeater_Slave.jpg

This slave device receives ESP-NOW messages from a master device and sends the corresponding infrared signals to an IR emitter.

Hardware Connections:

The IR transmitter module was connected to GPIO16, with GND connected to the ESP32's GND and VCC to the ESP32's VCC(5V).

Sketch:

The slave sketch combines the ESP_NOW sample sketch (ESP_NOW_Broadcast_Slave.ino) and the IRremoteESP8266 sample sketch (IRsendDemo.ino). If the received IR remote signal is divided into multiple 250-byte packets, the data is reconstructed before being sent to the IR emitter.

If you wish to use a different GPIO pin, simply modify the kIrLed value at the beginning of the sketch.

const uint16_t kIrLed = 16;

Downloads

Improvements and Considerations

IR rawdata for Compatibility:

Using raw IR data means we can control a wide variety of remote-controlled devices without needing special settings for each one.

Broadcast ESP-NOW:

ESP-NOW is configured to use broadcast for easier setup and to avoid the need for manual MAC address pairing. Channel 6 has been selected for this communication. To ensure successful data transmission, it is crucial that both the transmitting and receiving ESP32 devices are configured to use the same channel. ESP-NOW supports channels up to 14, allowing for flexibility in avoiding interference from other wireless devices. However, if multiple IR Repeaters are used in very close proximity, it is better to separate the channels by three or more channels.

#define ESPNOW_WIFI_CHANNEL 6


IRremoteESP8266 library:

Until a version of the IRremoteESP8266 library is released that is compatible with Espressif IDF version 3, the latest version (v2.8.6) might cause compilation errors when using the ESP32 board package. To successfully compile this sketch, you have two options:

1) Use an older version (2.0.17) of the ESP32 board package

However, be aware that you might miss out on bug fixes and other improvements available in newer versions.

2) Use a version of the IRremoteESP8266 library compatible with Espressif IDF version 3.

For this project, I've used a modified version of the IRremoteESP8266 library to ensure compatibility with Espressif IDF version 3. This modified library has been adapted to address specific compatibility issues and is available on GitHub at the following repository: https://github.com/BorisKofman/IRremoteESP8266/tree/Espressif-version-3

Note on GPIO Pin:

Please ensure that you adjust the GPIO pin numbers in the sketch according to your hardware setup. The specific GPIO pins used for the IR modules can vary depending on the ESP32 board and your circuit design. For example, GPIO 14 won't work on the ESP32-C3 as it causes the board to reboot.