This project intends to provide a tool that we consider might be useful for ESP32 hackers and developers: a Command Language Interface (CLI) application built for ESP32 using the Arduino(c) IDE, using the ESP32 RMT peripheral to transmit and decode Radio Control codes on ISM radio bands (433Mhz, 315Mhz, ...) . It is based on a FreeRTOS+CLI(c) "unofficial port" for ESP32, which is also provided.
RMT Radio Code is an interactive Arduino Sketch built for ESP32, that provides 2 different methods to receive and decode 24 bits PWM encoded Radio Code Words, compatible with the 2262/72 and EV1527 ICs, usually used in the ISM RF bands (433Mhz, 315Mhz) for radio remote controls.
One method is based in the use of the RC-Switch(c) library, and the second is based in the RMT peripheral.
The RC-Switch(c) library we understand could be considered as the "de facto" standard in the field of radio remote controls in the Arduino world, so an interactive tool to use the library without any extra coding could be benefitial for hackers trying to exercise and prototype with radio remote controls that use PWM encoded bits.
Regarding the RMT peripheral, we could not find until now an application using it for radio remote controls. It is positioned only for Infrared Remotes, and all the code examples provided by the manufacturer point in that direction. In fact, its use in the radio environment is quite tricky. The RMT receiver has all the advantages of being based in a hardware peripheral: timing capture is very precise, and the API is simple to use. The end of reception is triggered by a configurable threshold. The main design challenge for this use case (radio) is at what point the RMT is to be "fired" to start receiving the RF signal: if you start the receiver at any point, it just keeps grabbing noise. To avoid that, RMT Radio Code relies on the PulseIn Arduino function to identify when a Radio Code starts (the "SYN" code, see the data sheets of the manufacturers). So this may be a starting point trying to take advange of the RMT peripheral for other use cases.
The cli (based on FreeRTOS+CLI(c)) provides commands to enable the transmission of 24 bits Code Words using 2 different methods, one based in the RC-Switch library, the second based in the RMT peripheral. In this way, a complete “workbench” is provided to test and prototype with remote radio controls.
RMT Radio Code relies in the functionalities provided by FreeRTOS and FreeRTOS+CLI. It provides 2 independent tasks to simultaneously receive and decode 24 bits Radio Code Words. It receives commands and sends the outputs of the decoders via the Arduino Serial Monitor console. The FreeRTOS+CLI(c) library provides all the structure for the CLI. It provides a very good platform to create an extensible interface, with support for "help", parameter control and command execution. Since FreeRTOS+CLI(c) is actually not supported by Espressif's FreeRTOS, minor modifications are needed to be able to compile the library (indicated in the sources). RMT Radio Code provides 2 outputs for transmission: one based on the RMT Transmit peripheral of the ESP32 chip, and the other based on the RC-Switch(c) library. There is one command to transmit with RMT ("rmtxmit") and another one to transmit using RC-Switch(c) ("rcsxmit"). Both methods can also be configured using commands ("rcscfg" and "rmtcfg"). Use the “help” oommands for instructions on its use.
RMT Radio Code provides 2 independent inputs and methods to receive and decode the Radio Codes; each method is handled...Read more »