In this IoT project, I have shown how to make IoT-based Smart Home Automation using ESP32 Blynk with the Fan Speed control, sensor, and IR remote control relay with real-time feedback.

So, you can easily make this home automation project at home just by using an ESP32 and relay module. Or you can also use a custom-designed PCB for this project.

Tutorial Video on IoT Project using ESP32 & Blynk

In the tutorial video, I have shown all the steps to make this Blynk home automation system.

This Blynk ESP32 control smart relay has the following features:

  • Control home appliances with WiFi (Blynk IoT App).
  • Control ceiling fan speed with Blynk, IR Remote, & selector switch.
  • Control home appliances with an IR remote.
  • Control home appliances with manual switches or push buttons.
  • Save the last GPIO state in ESP32 flash memory.
  • Monitor real-time room temperature in the Blynk IoT App
  • Monitor real-time feedback in the Blynk IoT App.
  • Control appliances, and fan speed without WiFi.

Required components for the ESP32 Project

So, you can easily make this home automation project at home just by using an ESP32 and relay module. Or you can also use a custom-designed PCB for this project.

Required components:

  • ESP32 DevKIT V1
  • 4-channel 5V SPDT Relay Module
  • DHT11 Sensor
  • TSOP1838 IR Receiver (with metallic case)
  • Switches or Pushbuttons
  • Any IR Remote
  • 4-step Fan RegulatorOR (2.2uf & 3.3uf 250V Capacitor, 2.2-ohm 1/2W Resistors, 220k 1/4W Resistors, and 4-step selector switch)

Circuit Diagram of the ESP32 IoT Project

The circuit is very simple, I have used the GPIO pins D23, D22, D21 & D19 to control the 4 relays.

And the GPIO pins D13, D12, D14 & D27 are connected with switches, and GPIO D33, D32, D15 & D4 are connected with a 4-step selector switch to control the 4 relays manually.

I used the INPUT_PULLUP function in Arduino IDE instead of the pull-up resistors.

IR remote receiver (TSOP1838) connected with D35. And the DHT11 sensor is connected to RX2 (GPIO-16).

I have used a 5V mobile charger to supply the smart relay module.

Please take proper safety precautions while working with high voltage.

Control Fan Speed With Blynk IoT App

Control the speed of the ceiling fan from anywhere in the world from the Blynk IoT App. If the WiFi is connected, you can also monitor the real-time feedback in the Blynk.

Control Fan Speed With IR Remote and Selector Switch

You can use any IR remote to control the fan speed. I have used 2 buttons to increase and decrease the fan speed from the IR remote.

You can also use a selector switch to control the fan speed manually if the WiFi is not connected.

Control Relays With Blynk, IR Remote and Manual Switch

If the ESP32 is connected to WiFi, you can control the home appliances from Blynk IoT App.

You also use multiple smartphones to control the appliances with Blynk App. For that, you have to log in same Blynk account from all the smartphones.

This way, all smartphones will be in the sink to the Blynk server. You can control, and monitor the real-time status of the relays, room temperature & humidity from anywhere in the world in the Blynk IoT App.

You can always control the relays from the IR remote or switches. For this project, you can use any IR remote.

You can monitor the real-time feedback in the Blynk IoT App if the WiFi is connected.

I have explained how to get the IR codes (HEX codes) from any remote in the following steps.

Please refer to the circuit diagram to connect the switches.

Design the PCB for This Smart Home System

To make the circuit compact and give it a professional look, I designed the PCB after testing all the features of the smart relay module.

You can download the PCB Gerber, BOM, and "pick and place" files of this ESP32 control relay PCB from the following link:...

Read more »