The universal infrared remote control is an example of a helpful device for daily use. You can remotely control household appliances from the smartphone screen by turning such a remote control into an Internet of Things device. For example, turn on the air conditioner in advance when returning home on a hot summer day.
The ESP32-based IR remote control is a simple device, examples of which are easy to find on the Internet. We used this scheme from the instructables.com website, making minimal edits to it (in our case, a transistor on a transmitter diode is not used).
The advantage of the scheme is that it contains a pinout for the ESP32 microcontroller. You can assemble such a device using a breadboard.
The VS1838b receiver is used to read the IR signal. The transmitter is a simple IR diode, the same as in conventional remote controls for any TV, air conditioner, stereo, humidifier, and even curtains.
Since the ESP32-based IR remote control was created as a 2Smart Cloud Internet of Things device, the platform’s SDK was used when writing the firmware. The SDK has already described the logic of interaction of any ESP32-based device with the cloud platform. For the device to start working, it is enough to describe the logic of its operation in the firmware.
When writing the firmware, we used the IRremoteESP8266 library for Arduino. Namely, a sketch for reading the IR signal. The sketch allows you to read raw-data and NEC signal format. There is no difference between which of these to use; for us, it was more convenient to work with the NEC format.
We didn’t use ready-made IR signal bases for remotes from different manufacturers designed to control household appliances. Initially, we decided to manually copy the commands of a specific remote using an IR receiver installed on the board. This experience makes it possible to clone any remote control, even from an old device of a little-known manufacturer.
First, we considered the commands of the five main buttons on the TV remote control:
Having received an array of values in the NEC format, we created a custom IRControl node, where we tied these values to the corresponding topics.
Then we added the related properties to the main file. These properties are displayed in the 2Smart Cloud mobile application with Push buttons.
But we are getting ahead of ourselves a bit. To link a remote control to a mobile app, you first need to connect it to the IoT cloud platform.
It’s easy, and in 2Smart Cloud, you can use the free plan for DIY developers. So let’s get started:
Read more about connecting a device to the 2Smart Cloud platform in the following illustrated article: Connecting an IoT device to the platform: step-by-step instructions.
To make sure that the device with the firmware we wrote works correctly, we decided to check it objectively. Another similar device was assembled, and its microcontroller was flashed with a sketch of receiving a signal from the IRremoteESP8266 library. By sending commands from the first device via the mobile application, we ensured that the second device received the same NEC signal that we sent.
Testing in actual conditions confirmed that the TV is correctly controlled using an IR remote control on the breadboard. It responds to commands from the mobile application instantly – the delay is no longer than when using a conventional remote control.
The mobile application is just one of the methods to control devices in 2Smart Cloud. To get the most out of the universal IR remote, we have used the following features:
This set of free methods to control the device is an excellent feature of 2Smart Cloud. A DIY device turns into a fabulous modern product.
After adding a few more TV remote control buttons to the firmware and mobile application, we ensured that over-the-air updates worked correctly. The device flashed imperceptibly for us, and the application interface was updated after restarting.
Having received a working device, it remains to scale it to personal needs.
Firstly, we can add all the commands of all the IR remotes in the house to the firmware. In this case, the IoT remote control will become a universal device for controlling any household appliances for which remote control is provided.
Secondly, it makes sense to modify the scheme slightly and add additional IR diodes. If we tie two or three diodes to one ESP32 output and direct them in different directions, this will help increase the signal coverage of the room so that it reaches all devices controlled from the universal remote control.
Moreover, we can hide several diodes in different places in the room. In this case, a do-it-yourself universal remote control outperforms ready-made solutions.
Finally, another direction for developing the idea of a universal remote control is the use of a Bluetooth module. Remotes of modern household devices combine IR and Bluetooth, and it would be helpful to add this feature to a universal remote control.