ESP32 Home Automation Project Using IR Remote Control and Blynk IoT Platform (2023)

Introduction: ESP32 Home Automation Project Using IR Remote Control and Blynk IoT Platform

Home automation is becoming increasingly popular, and with good reason. With the use of technology, you can easily control your home appliances with the touch of a button or even with your voice. In this blog post, we will discuss a home automation project that can be controlled using an IR remote control and the Blynk IoT platform. Additionally, we will talk about the custom PCB designed for this project and how to register a new remote control.

Features of the Project.

  1. Register any IR Remote withou coding
  2. Control relays with switch buttons
  3. Control relays with IR Remote
  4. Project works with or without the internet
  5. Monitor realtime status on Blynk App
  6. Monitor temperature and humidity data on Blynk App
  7. Control upto 4 appliances


To build this project on a breadboard, you will need the following main components:

  1. ESP32 Espressif
  2. Relay Module 4 channel
  3. 38kHz VS1838 IR Receiver
  4. Switch Buttons
  5. DHT11 Sensor

To build this project on a breadboard, you will need the following main components:

  1. 3mm LED X 4
  2. Secrew Terminal 3 pins X 4
  3. 5v relay X 4
  4. DHT11 Sensor
  5. 38kHz VS1838 IR Receiver
  6. 3mm LDR
  7. 10K Resistor X 1
  8. 1K Resistor X 8
  9. BC547 Transistor X 4
  10. Diode 1N4007 X 4
  11. ESP32
  12. Switch Buttons X 4
  13. 5v Supply

Step 1: Modes of the Project

This project works on two modes.

  1. Normal Mode
  2. Config Mode

Normal Mode: In normal mode, you can control your appliances manually using IR remote, and switch buttons without the internet. Additionally, this project supports blynk IoT platform, so you can control your home appliances from anywhere in the world, while connected to the internet. You can also monitor the real time room temperature and humidity using Blynk App.

Config Mode: In config mode, you can register a new remote control without making any change in the code. To enter the Config Mode, press and hold the boot button for more than 2 seconds and then release the button. The blue LED will start blinking very fast, indicating that the project is now in Config Mode.

Step 2: Wiring the Components

Above is the wiring diagram for this project.

Safety Precautions:

The AC bulbs are connected to the relays, which involves high voltages. Take proper precautions and ensure your safety before working with high voltages.

Step 3: PCBWay PCB Prototyping

In order to make my project more compact and professional-looking, I utilized the EasyEDA free online circuit design software to create a custom PCB. The PCB was designed to be 95mm x 70mm in size, and the resulting design is both sleek and functional. I chose to utilize PCBWay's prototyping services to fabricate the PCB due to their excellent reputation as a high-quality PCB manufacturer.

PCBWay is a company that specializes in providing high-quality printed circuit board (PCB) manufacturing and assembly services. With more than a decade of experience in the industry, PCBWay offers a wide range of services including PCB prototyping, PCB assembly, and PCB design. The company prides itself on its advanced production capabilities, state-of-the-art equipment, and highly skilled workforce that allows it to produce top-quality PCBs for various industries such as automotive, medical, consumer electronics, and aerospace. PCBWay is also committed to providing excellent customer service and support, ensuring that each customer's unique needs are met with professionalism and efficiency.

Step 4: Ordering PCB on PCBWay

Ordering a custom PCB from them is a breeze

First go to the PCBWay webiste:

On the website input your PCB's dimensions, select your desired quantity and color on their website, and then upload the gerber file. and you're good to go. You can acquire five to ten pieces of two-layer high-quality PCBs for as little as $5, with fast delivery times of 3 to 5 days, depending on your location and shipping preferences.

Download Gerber File

Step 5: Register a New Remote Control

You can follow these steps to register a new remote control with the project.

  1. Press and hold the boot button on the project for more than 2 seconds.
  2. Release the button. The blue LED will start blinking very fast, indicating that the project is now in config mode and ready to register the remote control.
  3. Press the button on your remote that you want to register with the project.
  4. Look at the blue LED, which is now turned OFF. This means the first key has been registered.
  5. Wait for 2 seconds, and the LED will start blinking very fast again, indicating that you can now register the second key of your remote control.
  6. Repeat steps 3-5 until you have registered all six keys of your remote control.
  7. Once all keys are registered, the project will automatically enter into normal mode, and you can use your new remote control to operate your relays.
  8. If you want to register more than six keys, you can easily modify the code. More details on this will be discussed in the coding section later on.

Step 6: Blynk 2.0 Account Setup

Here is the step-by-step procedure on setting up the Blynk Account on your computer or laptop:

  1. Log in to your Blynk account and go to the template section.
  2. Click on the "Create New Template" button to open the template window.
  3. Give your template a name, such as "esp home".
  4. Select the hardware as ESP32 and set the connection type to WIFI.
  5. Click on the "Done" button to create the template.
  6. Navigate to the "Datastream" tab in the template.
  7. Create one datastream, even though it won't be used in the project. This datastream is necessary to simplify the configuration of the Blynk app.
  8. Click on save button to save the template.

Step 7: Setting Up Blynk App

You can follow the step-by-step instructions to create a mobile dashboard for the Blynk app:

  1. Open the Blynk app on your phone and select "Developer Mode" option.
  2. Select the template "esp home" that we created earlier to create the mobile dashboard.
  3. Click on the Plus icon to add a new widget and select the "Button" widget.
  4. Tap on the newly added button to open its properties.
  5. Choose "Choose Datastream" option to create a new data stream and tap on "Create New".
  6. Set the virtual pin to V1, data type to integer, and the maximum value to 1. Then, click on the "Done" button.
  7. Set the mode from "Push" to "Switch" for the button.
  8. Repeat the same steps to add three more buttons to control the remaining three relays. Remember to change the virtual pins for each button accordingly, which are V1, V2, V3 and V4.
  9. Add two gauge widgets to display the temperature and humidity data.
  10. Tap on the first gauge widget to access its properties.
  11. Choose "Choose Datastream" option and create a new data stream with virtual pin V5, data type integer, and maximum value 100. Then, click on the "Done" button.
  12. Set the properties of the second gauge widget to display the humidity data.
  13. The mobile dashboard is now ready. To add a device to the template, go back to the main screen and tap on "Add New Device".
  14. Select "Manually from Template" and choose the template "esp home". Then, click on the "Create" button to create the new device.
  15. You can now use the button widgets on the mobile dashboard to turn ON and off the relays connected to the esp32.

Step 8: Programming Using Arduino IDE

Install Required Libraries:

For this project you need following libraries:

  1. Blynk Library - version 1.2.0
  2. AceButton Library version 1.9.2
  3. IRremote Library Version 4.1.2

You can install the above libraries directly from the Arduino IDE using Tools > Manage Libraries

Install EP32 Core:

URL: Preferences--> Aditional boards Manager URLs

  1. Paste the above URL in File > Preferences > Aditional boards Manager URLs
  2. Then install the ESP32 core from Tools > Boards > Board Manager
  3. Install the version 2.0.4

Step 9: Add Blynk Credentials in the Code

Here you need to add your Blynk account credential in the code.


Here is the step by step procedure to get the Blynk credentials.

  1. Go to your Blynk account and navigate to the devices section.
  2. Find the device that you have previously created using the Blynk App and click on it.
  3. Click on the Device Info tab to access your Blynk credentials.
  4. Copy the Blynk credentials from the Device Info tab.
  5. Open the Arduino IDE and open the sketch that you are working on.
  6. Look for the section of the sketch where Blynk credentials are required.
  7. Paste the copied Blynk credentials into the above fields in the sketch.
  8. Save your changes to the sketch.
  9. Upload the modified sketch to your ESP32 device.
  10. You are now ready to use Blynk to communicate with your ESP32 device.
#define BLYNK_AUTH_TOKEN "yOD3Hyfsz34R6um4Ah5vvpI1PPzTyr7k"

Step 10: Enter WiFi Credentials

Here you need to enter your WiFi credentials

// Your WiFi credentials.
char ssid[] = "ENTER_YOUR_WIFI_SSID";
char pass[] = "ENTER_YOUR_WIFI_PASS";

Step 11: Upload the Code

Before uploading the code, make sure you have already installed the esp32 core. Also, ensure that you have selected the correct board and the com port. Finally, click on the upload button, to upload the code onto your esp32.

You can download the complete code by clicking below


  • esp32-reg-remote.ino


Step 12: Demo

Step 13: Video Tutorial

Step 14: Download Code and Related Files

You can download the code and related files for this project by clicking on the link below


Top Articles
Latest Posts
Article information

Author: Ms. Lucile Johns

Last Updated: 05/11/2023

Views: 6349

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.