An ESP-IDF component for Physical Computing
Purpose
A Remote Controller for a YAMAHA Audio Receiver, a PANASONIC Television, a Pioneer DVD Player and an Apple TV.
How it is done
This repository contains an ESP-IDF component for an IR transmitter using different remote control protocols. It runs on a ESP32 processor connected to an IR transmitter and is built using the ESP-IDF build system in version 5.5+.
It uses component elrebo-de/rmt_ir, where three protocols are implemented:
- NEC protocol (used by YAMAHA audio receiver)
- Panasonic protocol (used by PANASONIC VIERA TV)
- Pioneer protocol (used by Pioneer DVD player)
The component is implemented as C++ class AvRmt.
Where to find it
av_rmt is published on the ESP Registry at https://components.espressif.com/components/elrebo-de/av_rmt.
The source code can be found at https://github.com/elrebo-de/esp_rav_mt.
How to use it
As an ESP-IDF component av_rmt must be included into idf_component.yml as a dependency. As usual this can be done by executing this command:
idf.py add-dependency "elrebo-de/av_rmt^1.0.6"
You need to include av_rmt.hpp.
Then you have to initialize the RmtIr class, which does the actual IR communication with the Audio/Video devices, and the AvRmt class, which uses RmtIr to control :
ESP_LOGI(tag, "Initialize RmtIr class");
RmtIr* rmtIr = &rmtIr->getInstance(); // get the Singleton instance
rmtIr->setGpioPins(32,0); // set the GPIO pins for M5 ATOM LITE
//rmtIr->setGpioPins(4,0); // set the GPIO pins for ESP32C3 Supermini
rmtIr->initialize(); // initialize RMT IR
ESP_LOGI(tag, "Initialize AvRmt class");
AvRmt* avRmt = &avRmt->getInstance(); // get the Singleton instance
avRmt->initialize(rmtIr);
Now you can control the Audio/Video system with these methods:
// Methods to control Audio/Video devices
void switchAllOff();
void switchOnTv();
void switchOnAppleTv();
void switchOnDvd();
void switchOnRadio();
Let's have a look atswitchAllOff. This method switches off the YAMAHA receiver, the Panasonic TV and the Pioneer DVD player. It looks like this:

Besides setting some state variables it retrieves the pointer to the RmtIr instance and uses this class to transmit command frames to the different devices:
To the YAMAHA receiver a NEC command frame is sent:
// YAMAHA Receiver
rmtIr->transmitNecCommandFrame((uint8_t)0x7a, (uint8_t)0x1e); // "STANDBY"
This is the STANDBY command for the YAMAHA receiver.
To the Panasonic TV a Panasonic command frame is sent:
// Panasonic TV
rmtIr->transmitPanasonicCommandFrame(0x4004, 0x01, 0x00, 0xfc); // "Power Off"
This is the “Power Off” command for a Panasonic TV.
To the Pioneer DVD player a Pioneer command frame is sent:
// Pioneer DVD Player
rmtIr->transmitPioneerCommandFrame((uint8_t)0xa3, (uint8_t)0x99, (uint8_t)0xaf, (uint8_t)0xbb); // "Shift + OFF"
This is a two-command frame consisting of the “Shift” and “Off” commands.
The technical details of these command frames and how they are transmitted are hidden inside the RmtIr class.
Between the transmitXyzCommandFrame calls the system waits for 500 msec.
((tbc))

Leave a Reply