ESP32IOT Projects

ESP32 Home Automation Project, ESPRESSIF Home Automation

ESP32 Home Automation Description:

ESP32 Home Automation

ESP32 Home Automation Project- in this tutorial, you will learn how to make an IoT internet of things based Home automation system using ESP32 Wifi + Bluetooth Module by the ESPRESSIF systems. For the demonstration purposes, I have connected 220Vac light bulbs which can be controlled using the Blynk application from anywhere around the world so far the internet connection is available.  If you have never used the ESP32 module then I highly recommend first watch my previous two tutorials on the ESP32 Wifi + Bluetooth Module by the ESPRESSIF Systems.

In my first getting started tutorial on the ESP32 module, I covered the extreme basics including the ESP32 Pinout, Soldering, ESP32 Arduino IDE Board Manager Installation, and how to write a very basic program using the Arduino IDE to control an LED using the Blynk application.

Download ESP32 Board Manager URL link, Programming, ESP32 Eagle library, ESP32 Datasheet:

While in my 2nd tutorial, I designed my own 5v regulated power supply board for the ESP32 Wifi + Bluetooth Module.

In this tutorial, we will cover,

  1. Esp32 home automation complete Circuit Diagram explanation
  2. Esp32 home automation Blynk Application designing
  3. Esp32 home automation Programming using the Arduino IDE and Finally
  4. Testing

Without any further delay let’s get started!!!

Amazon Links:

ESP32 Wifi + Bluetooth Module:

LM7805 Voltage Regulator:

470uf capacitor:

DC Female Power Jack:

Female Headers:

Male Headers:

1n4007 diode:

10k Resistor:

2n2222 NPN transistor

12V SPDT Relay:

12v SPDT type 4-channel relay Module:

8 channel Relay Module

Other Tools and Components:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Esp32 home automation Circuit Diagram:

ESP32 Home Automation

ESP32 home automation circuit diagram is very simple. Let’s first start with the regulated 5v power supply based on the LM7805 voltage regulator. This is the same 5v regulated power supply I have been using for the Nodemcu ESP8266 Wifi module.

J1 is the female power jack and this is where we connect a 12v adaptor, battery or a solar panel. Two 470uf capacitors are connected at the input and output sides of the voltage regulator. A 330-ohm resistor is connected in series with a 2.5v led. This is a current limiting resistor. The output of the voltage regulator is connected with the 5v pin of the ESP32 module and the ground of the power supply is connected with the ground of the ESP32 module.

 Currently, I have connected a 4-channel relay module. You can use a readymade relay module or you can follow the same exact connections and build a one by yourself. All the relays used in this project are of the type SPDT “Single Pole and double throw”. As you can see the connections of all the relays are exactly the same. This relay has a total of 5 pins, two relay coil pins, common, Normally Closed, and Normally Open.

These are 12v relays and cannot be directly controlled using the ESP32 Module, So, that’s why we need a driver to control these relays. You can use a relay driver IC or you can use a 2n2222 NPN transistor and a 10k resistor. One pin of the relay coil is connected with the collector of the 2n2222 NPN transistor while the other pin of the relay coil is connected with the 12 volts. The emitter of the transistor is connected with the ground while the base is connected with the 10k ohm resistor.

Now to control these relays you simply need to connect these 10k resistors with the ESP32 I/O pins. In this project, I am using the GPIO pins 13, 12, 14, and 27. I will be using the same pins in the programming.

A Neutral wire from the 110/220Vac is connected directly with the neutral point of the Light Bulbs while the Live wire is connected with the Bulbs through the relays.

About the PCB boards:

ESP32 Home Automation

This is a 4-channel relay module which I will use for controlling the light bulbs.

ESP32 Home Automation
ESP32 Power Supply PCB board, ESPRESSIF ESP32 Devkit WROOM

This is the ESP32 power supply board which I designed in my previous tutorial. As you can see

The PCB quality is really great. The silkscreen is quite clear and the Black Solder mask looks amazing, I am 100% satisfied with their work. The Gerber files of this PCB board can be downloaded from the PCBWay official website.

Download: ESP32 Power Supply Gerber files 

High quality & Only 24 Hours Build time

ESP32 Home Automation

Finally, I connected everything as per the circuit diagram already explained. Now let’s start with the Blynk application. Watch the video or follow the same exact steps given below.

Note: this old version of the Blynk app is no more functional. For the blynk mobile App setup and dashboard setup ready my article on the New Blynk V2.0. In this article I have explained how to migrate your projects from Blynk 1.0 to the new Blynk V2.0. You can also watch the video.

Esp32 home automation Blynk Application:

  • First of all, open the Blynk application.
  • Click on the new project and enter the project name as “Home Automation”.
  • Click on the choose device and select ESP32 Dev Board.
  • Make sure the connection type is set to WIFI.
  • Finally, click on the create button, an authentication token will be sent on your email id, which later will be used in the ESP32 Home Automation
  • Click anywhere on the screen and add 4 buttons. Drag and drop, if you want to adjust the size.
  • Click on the first button, Set the name as Device1, select GP13, Set mode to SWITCH, and change the font size if you want.
  • Click on the second button, Set the name as Device2, select GP12, Set mode to SWITCH, and change the font size if you want.
  • Click on the third button, Set the name as Device3, select GP14, Set mode to SWITCH, and change the font size if you want.
  • Click on the fourth button, Set the name as Device4, select GP27, Set mode to SWITCH, and change the font size if you want.

That’s it our Home Automation Blynk application is ready.

ESP32 Home Automation

Esp32 home automation Programming:

ESP32 Home Automation Code Explanation:

Before, you start the programming, first of all, make sure that you download the Blynk library.

Download Library

char auth[] = “FSj1Its0o7leTm1JqX1KQW358tBxpnzH”;

This is the authentication code which was sent via email, I simply copied and paste it over here.

// Your WiFi credentials.

// Set password to “” for open networks.

char ssid[] = “AndroidAP7DF8”;

char pass[] = “jamshaid”;

This is the name of the Wifi router and this is the password.

int device1 = 13; // gpio 13

int device2 = 12; // gpio 12

int device3 = 14; // gpio 14

int device4 = 27; // gpio 27

Next, I defined pins for the relays. 4 relays are connected with the ESP32 GPIO pins 13, 12, 14, and 27.

Inside the void setup() function, I activated the Serial communication using the Serial.begin() function which is used for the debugging purposes, while 9600 is the baud rate.

pinMode(device1, OUTPUT);

pinMode(device2, OUTPUT);

pinMode(device3, OUTPUT);

pinMode(device4, OUTPUT);

I set all the devices as output using the pinMode() function.

Inside the void loop() function, we have only function which is the So, that’s all about the ESP32 Home automation programming.

ESP32 Home Automation Project Testing:

After uploading the program, I powered up the relay module, ESP32 Module, and also plugged in the 220Vac wires.

Note: Never touch the PCB board after supplying the 220VAC, this can be really dangerous. Wear protective gloves. Make this project at your own risk.

Next, I opened my designed Home Automation application, clicked the play button, and it was connected just in a few seconds.

ESP32 Home Automation

I successfully controlled the Light bulbs. For the practical demonstration watch video given below.

ESP32 Home Automation

I checked this smart home automation system based on the ESP32 Wifi + Bluetooth Module, and it worked perfectly. There was no false triggering. You can replace these light bulbs with other types of 110/220Vac loads.

Watch Video Tutorial:


Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

One Comment

  1. People are installing home automation systems because of their immense benefits. In an automated home, every appliance/gadget such as thermostats, lights, cameras is linked with a controllable network.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button