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.

Device assembly

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.

Device scheme

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.

IR Transmitter

IR Transmitter

IR Receiver

IR Receiver

Firmware writing

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:

  • On/Off,
  • Volume +,
  • Volume  -,
  • Channel +,
  • Channel  -.

NEC values

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.

2Smart Cloud mobile app

Connecting to the free IoT cloud platform

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:

  1. Register on the platform: https://cloud.2smart.com/register.
  2. Go to the “Products” tab and click “Add Product”.
    Products page
  3. Select the microcontroller – ESP32.
    MCU selection
  4. Click “Add Firmware” and select the Custom option.
    “Add Firmware” button Selecting the base for the firmware
  5. Click the “Connection Info” link and leave the window with the product connection parameters open.
    Connection info window
  6. Download the 2Smart TV Control project from the repository. Open it in the terminal, and make the necessary changes in a text editor.
    • Replace product_id in src/main.h file with your own Product ID from the “Connection info” modal.
    • in the IRControl node, specify the topics and their values for your managed household appliances.
  7. Connect the remote control to the computer with a USB cable and flash it.
  8. Connect to the device’s hotspot – “2Smart IR Remote”. Log in to the web interface by following the link: http://192.168.4.1/.
    The device's web interface
  9. Go to the Wi-Fi tab and click Scan. Then select your Wi-Fi network from the list and enter a password to access it. This is required for your device to connect to the platform.
  10. If all the settings are correct, the device will connect to the platform, and its status will change to Ready.
  11. Customize the mobile app interface for IR remote control.
  12. Publish the product on the platform.
  13. Install the 2Smart Cloud mobile application on your smartphone and pair the device to it.
  14. Control your home appliances from your smartphone using the ESP32-based IR remote control.

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.

Testing

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.

IR transmitter and receiver

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.

Using all available device control methods

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:

  • set up “turn on the TV” and “change the channel” voice commands in Google Assistant to control the TV hands-free;
  • shared access to the device with family members who use iPhones, and they also set up Siri voice commands;
  • shared access to the device via the URL link and pinned it to the favorites of the home tablet’s browser; now, all family members can control the TV from the tablet, even without installing a mobile application on it;
  • tested device control using Telegram bot.

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.

What’s next

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.

Don't forget to share this post!

Connect to innovations

Turn your unique smart device ideas into professional IoT products without coding. Bring them to market, improve and update quickly and easily. Enjoy an innovative digital suite for creativity and business. Get support and custom services from
the professional development team.

    Thanks for contacting us!

    We will get in touch soon.

    This site is protected by Google reCAPTCHA and the following Privacy policy and Terms of use apply

    Send us a message

    This site is protected by Google reCAPTCHA and the following Privacy policy and Terms of use apply