Home Automation using ESP32 & Blynk 2.0 with Real-Time Feedback
Internet & Manual Control Home Automation System Project with Real-Time Feedback using ESP32 & New Blynk 2.0 IoT App with Code & Program
- Suitable forB.Tech/Diploma ESP32/IoT students
- Build time1-2 weeks
- LevelBeginner
- Available atAjvika Labs, Kakinada
About this project
Overview
In this
IoT project
, we will learn how to make an IoT-based
Home Automation project
using
ESP32
and the new
Blynk 2.0 IoT app
to control a
4-channel relay
module from the manual switch & smartphone. The project has
Real-Time Feedback System
. We can use the Blynk IoT app from anywhere in the world & using Internet Connectivity we can monitor the real-time feedback in
Blynk 2.0 IoT App
or Blynk cloud web dashboard.
This tutorial is all about
Controlling Peripherals
like AC Appliances or bulbs via
Relay
from Blynk 2.0 IoT App or Blynk cloud web dashboard using ESP32 WiFi Module. We would basically call it a Home Automation Project. Home automation is the automatic control of electronic devices in your home. These devices are connected to the
Internet
, which allows them to be controlled remotely. Earlier we made so many
Home Automation projects
which are as follows:
Home Automation with Arduino IoT Cloud & ESP32
Home Automation using Google Firebase & ESP8266
Home Automation using Blynk & ESP8266
Home Automation using ESP8266 WebServer
Home Automation using Android & ESP8266
Home Automation using ESP8266 & Alexa
Home Automation using ESP32 & AWS IoT Core
Home Automation using ESP32 & Alexa
Home Automation using ESP32 WebServer
Bill of Materials
For this project, we will need an ESP32 Board, 4 channel relay, and a few jumper wires. For the demo, we can use 4 bulbs with 4 holders or any other electrical appliances.
All the components can be easily purchased from Amazon through the below Amazon purchase links.
S.N.
Components
Quantity
Purchase Links
ESP32 WiFi Module
Amazon
AliExpress
5V Relay
Amazon
AliExpress
Push Button Switches
Amazon
AliExpress
7805 Voltage Regulator IC
Amazon
AliExpress
DC Power Jack DCJ0202
Amazon
AliExpress
Diode 1N4007
Amazon
AliExpress
Resistor 330-ohm
Amazon
AliExpress
NPN Transistor BC547
Amazon
AliExpress
Terminal Block 5mm
Amazon
AliExpress
LED 5mm Any Color
Amazon
AliExpress
Female Header
2 Set
Amazon
AliExpress
Circuit Diagram & Hardware
The circuit for
Home Automation
using
Blynk 2.0 & ESP32
with Real-Time Feedback is very simple. I used
Fritzing
software to draw the schematic. The below circuit diagram is the circuit that you need to Assemble.
The ESP32 Board has so many GPIOs Pins. In this project, we will be using
GPIO19
GPIO18
GPIO5
&
GPIO17
for controlling the Relay. Across the output of the relay, we will use bulbs for testing and demo. You can use a
9V DC Adapter
to power the circuit as the output of
7805 Voltage Regulator IC
connects to
Vin
of ESP32.
As a feedback system, there are 4 button switches connected directly to the ESP32 GPIO Pins. The ESP32 Pins used are
GPIO27, GPIO14, GPIO12
&
GPIO13
Project PCB Gerber File & PCB Ordering Online
If you don’t want to assemble the circuit on a breadboard and you want
PCB
for the project, then here is the PCB for you. I used EasyEDA to design the Schematic & PCB. The Schematic & PCB Board for
ESP32 Home Automation using Blynk 2.0
looks something like the below.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from
ALLPCB
at
1$
only.
Download Gerber File:
Home Automation PCB
You can use this Gerber file to order high quality PCB for this project. To do that visit the
ALLPCB
official website by clicking here:
https://www.allpcb.com/
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
Blynk 2.0 Web & Mobile Dashboard Setup
Now let’s set up the Blynk Web Dashboard first. To do that visit
blynk.io
and sign up using the email ID.
First Add a
New Device
Select the first option, i.e.
From Template
Give Any Name to
Template
and
Device
and Click on Create.
A New Device will be created. A snip of the code header file will appear on the Dashboard. Copy and save this code as it will be used in the Arduino IDE.
Click on the Template logo and select the Template that you just created.
A template page will open. From this template Select the Web Dashboard.
From this page click on edit. Now we need to add the widget to the Dashboard.
Drag the widget called
Switch
from the left side and place it on the dashboard.
Create such 4 widgets as we have 4 relays to control.
Click on
Setting Icon
on Widget 1. The following page will open.
Give
Title
Name anything. For example Light1 or Realy1. And under the Datastream part, select Virtual Pin.
Under Datastream Section, Select Virtual Pin
V0
. Then Click on
Create
and then on
Save
Similarly, do the same for the remaining 3 widgets. Give them the names Light2, Light3, and Light4, and Select Virtual Pin as V1, V2, and V3 respectively. Click on Save and Apply to make changes to what setup has been made so far.
Now your Web Dashboard is Finally Ready.
Using this Web Dashboard, you can control your Home Appliances.
Apart from the Web Dashboard, you can also set up your Mobile App Dashboard. For that download the Blynk from Playstore or AppStore. And you can follow the video below to set up the Dashboard. The Mobile App Dashboard looks something like this.
Code/Program: ESP32 Blynk 2.0 Home Automation with Feedback
The source code or program for Home Automation using ESP32 & Blynk 2.0 with Real-Time Feedback System is written in Arduino IDE.
1. Blynk Library
:
https://github.com/blynkkk/blynk-library
2. AceButton Library
:
https://github.com/bxparks/AceButton
Now copy the following code and paste it on your Arduino IDE Sketch. But before that, you need to make modifications to the following lines.
#define BLYNK_TEMPLATE_ID "TMPLiEm_ytX0"
#define BLYNK_DEVICE_NAME "APP"
#define BLYNK_AUTH_TOKEN "a16wQs9JID48MryB6TdLaONpFgRw5ymo"
You can get these details from the Web Dashboard Setup.
Apart from these, modify the WiFi SSID and Password from the following lines.
char
ssid
[
]
=
"*****************"
;
char
pass
[
]
=
"*****************"
;
Now copy the following code and upload it to the ESP32 Board.
#define BLYNK_TEMPLATE_ID "TMPLiEm_ytX0"
#define BLYNK_DEVICE_NAME "APP"
#define BLYNK_AUTH_TOKEN "a16wQs9JID48MryB6TdLaONpFgRw5ymo"
// Your WiFi credentials.
// Set password to "" for open networks.
char
ssid
[
]
=
"*****************"
;
char
pass
[
]
=
"*****************"
;
bool
fetch_blynk_state
=
true
;
//true or false
//#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <AceButton.h>
using
namespace
ace_button
;
// define the GPIO connected with Relays and switches
#define RelayPin1 19 //D19
#define RelayPin2 18 //D18
#define RelayPin3 5 //D5
#define RelayPin4 17 //D17
#define SwitchPin1 27 //D27
#define SwitchPin2 14 //D14
#define SwitchPin3 12 //D12
#define SwitchPin4 13 //D13
#define wifiLed 2 //D2
//Change the virtual pins according the rooms
#define VPIN_BUTTON_1 V1
#define VP
In this
IoT project
, we will learn how to make an IoT-based
Home Automation project
using
ESP32
and the new
Blynk 2.0 IoT app
to control a
4-channel relay
module from the manual switch & smartphone. The project has
Real-Time Feedback System
. We can use the Blynk IoT app from anywhere in the world & using Internet Connectivity we can monitor the real-time feedback in
Blynk 2.0 IoT App
or Blynk cloud web dashboard.
This tutorial is all about
Controlling Peripherals
like AC Appliances or bulbs via
Relay
from Blynk 2.0 IoT App or Blynk cloud web dashboard using ESP32 WiFi Module. We would basically call it a Home Automation Project. Home automation is the automatic control of electronic devices in your home. These devices are connected to the
Internet
, which allows them to be controlled remotely. Earlier we made so many
Home Automation projects
which are as follows:
Home Automation with Arduino IoT Cloud & ESP32
Home Automation using Google Firebase & ESP8266
Home Automation using Blynk & ESP8266
Home Automation using ESP8266 WebServer
Home Automation using Android & ESP8266
Home Automation using ESP8266 & Alexa
Home Automation using ESP32 & AWS IoT Core
Home Automation using ESP32 & Alexa
Home Automation using ESP32 WebServer
Bill of Materials
For this project, we will need an ESP32 Board, 4 channel relay, and a few jumper wires. For the demo, we can use 4 bulbs with 4 holders or any other electrical appliances.
All the components can be easily purchased from Amazon through the below Amazon purchase links.
S.N.
Components
Quantity
Purchase Links
ESP32 WiFi Module
Amazon
AliExpress
5V Relay
Amazon
AliExpress
Push Button Switches
Amazon
AliExpress
7805 Voltage Regulator IC
Amazon
AliExpress
DC Power Jack DCJ0202
Amazon
AliExpress
Diode 1N4007
Amazon
AliExpress
Resistor 330-ohm
Amazon
AliExpress
NPN Transistor BC547
Amazon
AliExpress
Terminal Block 5mm
Amazon
AliExpress
LED 5mm Any Color
Amazon
AliExpress
Female Header
2 Set
Amazon
AliExpress
Circuit Diagram & Hardware
The circuit for
Home Automation
using
Blynk 2.0 & ESP32
with Real-Time Feedback is very simple. I used
Fritzing
software to draw the schematic. The below circuit diagram is the circuit that you need to Assemble.
The ESP32 Board has so many GPIOs Pins. In this project, we will be using
GPIO19
GPIO18
GPIO5
&
GPIO17
for controlling the Relay. Across the output of the relay, we will use bulbs for testing and demo. You can use a
9V DC Adapter
to power the circuit as the output of
7805 Voltage Regulator IC
connects to
Vin
of ESP32.
As a feedback system, there are 4 button switches connected directly to the ESP32 GPIO Pins. The ESP32 Pins used are
GPIO27, GPIO14, GPIO12
&
GPIO13
Project PCB Gerber File & PCB Ordering Online
If you don’t want to assemble the circuit on a breadboard and you want
PCB
for the project, then here is the PCB for you. I used EasyEDA to design the Schematic & PCB. The Schematic & PCB Board for
ESP32 Home Automation using Blynk 2.0
looks something like the below.
The Gerber File for the PCB is given below. You can simply download the Gerber File and order the PCB from
ALLPCB
at
1$
only.
Download Gerber File:
Home Automation PCB
You can use this Gerber file to order high quality PCB for this project. To do that visit the
ALLPCB
official website by clicking here:
https://www.allpcb.com/
You can now upload the Gerber File by choosing the Quote Now option. From these options, you can choose the Material Type, Dimensions, Quantity, Thickness, Solder Mask Color and other required parameters.
After filling all details, select your country and shipping method. Finally you can place the order.
Blynk 2.0 Web & Mobile Dashboard Setup
Now let’s set up the Blynk Web Dashboard first. To do that visit
blynk.io
and sign up using the email ID.
First Add a
New Device
Select the first option, i.e.
From Template
Give Any Name to
Template
and
Device
and Click on Create.
A New Device will be created. A snip of the code header file will appear on the Dashboard. Copy and save this code as it will be used in the Arduino IDE.
Click on the Template logo and select the Template that you just created.
A template page will open. From this template Select the Web Dashboard.
From this page click on edit. Now we need to add the widget to the Dashboard.
Drag the widget called
Switch
from the left side and place it on the dashboard.
Create such 4 widgets as we have 4 relays to control.
Click on
Setting Icon
on Widget 1. The following page will open.
Give
Title
Name anything. For example Light1 or Realy1. And under the Datastream part, select Virtual Pin.
Under Datastream Section, Select Virtual Pin
V0
. Then Click on
Create
and then on
Save
Similarly, do the same for the remaining 3 widgets. Give them the names Light2, Light3, and Light4, and Select Virtual Pin as V1, V2, and V3 respectively. Click on Save and Apply to make changes to what setup has been made so far.
Now your Web Dashboard is Finally Ready.
Using this Web Dashboard, you can control your Home Appliances.
Apart from the Web Dashboard, you can also set up your Mobile App Dashboard. For that download the Blynk from Playstore or AppStore. And you can follow the video below to set up the Dashboard. The Mobile App Dashboard looks something like this.
Code/Program: ESP32 Blynk 2.0 Home Automation with Feedback
The source code or program for Home Automation using ESP32 & Blynk 2.0 with Real-Time Feedback System is written in Arduino IDE.
1. Blynk Library
:
https://github.com/blynkkk/blynk-library
2. AceButton Library
:
https://github.com/bxparks/AceButton
Now copy the following code and paste it on your Arduino IDE Sketch. But before that, you need to make modifications to the following lines.
#define BLYNK_TEMPLATE_ID "TMPLiEm_ytX0"
#define BLYNK_DEVICE_NAME "APP"
#define BLYNK_AUTH_TOKEN "a16wQs9JID48MryB6TdLaONpFgRw5ymo"
You can get these details from the Web Dashboard Setup.
Apart from these, modify the WiFi SSID and Password from the following lines.
char
ssid
[
]
=
"*****************"
;
char
pass
[
]
=
"*****************"
;
Now copy the following code and upload it to the ESP32 Board.
#define BLYNK_TEMPLATE_ID "TMPLiEm_ytX0"
#define BLYNK_DEVICE_NAME "APP"
#define BLYNK_AUTH_TOKEN "a16wQs9JID48MryB6TdLaONpFgRw5ymo"
// Your WiFi credentials.
// Set password to "" for open networks.
char
ssid
[
]
=
"*****************"
;
char
pass
[
]
=
"*****************"
;
bool
fetch_blynk_state
=
true
;
//true or false
//#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <AceButton.h>
using
namespace
ace_button
;
// define the GPIO connected with Relays and switches
#define RelayPin1 19 //D19
#define RelayPin2 18 //D18
#define RelayPin3 5 //D5
#define RelayPin4 17 //D17
#define SwitchPin1 27 //D27
#define SwitchPin2 14 //D14
#define SwitchPin3 12 //D12
#define SwitchPin4 13 //D13
#define wifiLed 2 //D2
//Change the virtual pins according the rooms
#define VPIN_BUTTON_1 V1
#define VP
Technologies used
Hardware components
- ESP32
- ESP8266
- Arduino
- Relay
Software & tools
- Arduino IDE
- Blynk
- Firebase
- EasyEDA
- Fritzing
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.