How To Make A Full Home Automation System With Nodemcu Esp8266 and Blynk App - SriTu Hobby
How To Make A Full Home Automation System With Nodemcu Esp8266 and Blynk App - SriTu Hobby
0
How to make a full home automation system with Nodemcu esp8266 and Blynk app
Hello, welcome back. In this tutorial, we will learn how to make a Full home automation system using the Nodemcu
ESP8266 and Blynk app. Through this system, we will be able to monitor and control everything in our home. Also, five
sensors and a two-channel relay module are mainly used for this system. Therefore, we can monitor and control everything
in the house such as temperature, humidity, amount of leaking gas, amount of water in the water tank, home security, and
control of electrical appliances. For that, it uses ultrasonic, flame, PIR, MQ2, DHT11 sensors and uses a two-channel relay
module to control household electrical appliances. Remember to select the correct relay module you want. Also, this
system is mainly based on IoT technology. Therefore, we can control and monitor all factors through the internet. The Blynk
app has been used for that. If you are not familiar with the Blynk app. For that, please visit the previous tutorials.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 1/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Mumbai to Dubai
from Rs10,901 View
PRICE DROP
OK, let’s do this project step by step. The required components are given below.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 2/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Step 1
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 3/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Nodemcu board
Flame sensor
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 4/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Ultrasonic sensor
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 5/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
MQ2 sensor
PIR sensor
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 6/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Relay module
LCD display
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 7/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
I2C module
Buzzer
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 8/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Breadboard
Jumper wires
x
Step 2
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 9/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Secondly, connect these components. To do this, use the circuit diagram below.
Step 3
Thirdly, let’s set up the Blynk app. For that, follow the steps below.
First, download and install the Blynk app on your phone. Then, sign up for this app using your Email address. After, run
this app and click the “New project” button.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 10/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Next, enter the project name as you like. Then, select the device and connection type. Finally, click the “Confirm” button.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 11/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Now, you can see the project interface. Then, we include the widget. For that, click on the + icon in the corner and include
three “Button” widgets and three “Level H” widgets. Next, include one “Level V” widget and a notification widget.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 12/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 13/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 14/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Okay, now let’s set up this widget. First, click the relay control buttons one by one and name them as you like. Then,
change the relay control buttons PIN D5 and D6 respectively. Then, change the input value from 1 to 0 and switch mode.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 15/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 16/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 17/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Next, click the PIR sensor control button and name it as you like. Then, change the PIN as V0 and mode to switch.
Now, click the “level H” widgets one by one and name as Gas level, Temperature, and Humidity. Also, change the PINs as
V1, V2, and V3 respectively. Then, change the input values from 0 to 100.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 18/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 19/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 20/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 21/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Next, click the “Level V” widget and name it Water Level. Then, change the PIN to V4 and the input value to the height of
the water tank. Also, change the flip axis to the ON side.
Lastly, click the notification widget and change the priority to HIGH.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 22/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
OK, now the Blynk app is ready. Then, customize these widgets as you like.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 23/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 24/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 25/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Step 4
Okay, now let’s create the program for this system. It is as follows.
Code explanation
1 #include <LiquidCrystal_I2C.h>
2 #define BLYNK_PRINT Serial
3 #include <ESP8266WiFi.h>
4 #include <BlynkSimpleEsp8266.h>
5 #include <DHT.h>
Secondly, includes the Blynk Auth token and WI-FI connections details.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 28/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Thirdly, objects are created for LCD, DHT11, and Blynk libraries
1 #define Buzzer 10
2 #define MQ2 A0
3 #define flame D0
4 #define PIR D3
5 #define trig D5
6 #define echo D6
7 #define relay1 D7
8 #define relay2 D8
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 29/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
1 void setup() {
2 Serial.begin(9600);//The serial monitor is begin
3 //The LCD display is initialize
4 lcd.init();
5 lcd.backlight();
6 //sensors and relays pins are set as input and output pins
7 pinMode(Buzzer, OUTPUT);
8 pinMode(flame, INPUT);
9 pinMode(PIR, INPUT);
10 pinMode(trig, OUTPUT);
11 pinMode(echo, INPUT);
12 pinMode(relay1, OUTPUT);
13 pinMode(relay2, OUTPUT);
14 //The relays are turns off
15 digitalWrite(relay1, HIGH);
16 digitalWrite(relay2, HIGH);
17 //Blynk and DHT11 libraries are begin
18 Blynk.begin(auth, ssid, pass);
19 dht.begin();
20 //Main functions are called. These functions are described below
21 timer.setInterval(100L, gassensor);
22 timer.setInterval(100L, DHT11sensor);
23 timer.setInterval(100L, flamesensor);
24 timer.setInterval(100L, pirsensor);
25 timer.setInterval(100L, ultrasonic);
26 }
1 void gassensor() {
2 //Gets the sensor values
3 int value = analogRead(MQ2);
4 Serial.println(value);
5 //This analog value is converted from 0 to 100
6 value = map(value, 0, 1024, 0, 100);
7 //This value is checked using the IF condition
8 if (value <= 35) {
9 digitalWrite(Buzzer, LOW);
10 } else if (value > 35) {
11 Blynk.notify("Warning! Gas leak detected");
12 digitalWrite(Buzzer, HIGH);
13 }
14 //This value is sent to the Blynk app
15 Blynk.virtualWrite(V1, value);
16 //This value is printed on the LCD
17 lcd.setCursor(9, 0); x
18 lcd.print("G :");
19 lcd.print(value);
20
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 30/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
21 lcd.print(" ");
}
1 void DHT11sensor() {
2 //Gets the sensor values
3 float h = dht.readHumidity();
4 float t = dht.readTemperature();
5 //DHT11 sensor status checked
6 if (isnan(h) || isnan(t)) {
7 Serial.println("Failed to read from DHT sensor!");
8 return;
9 }
10 //These values are sent to the Blynk app
11 Blynk.virtualWrite(V2, t);
12 Blynk.virtualWrite(V3, h);
13 //These values are printed on the LCD
14 lcd.setCursor(0, 0);
15 lcd.print("T :");
16 lcd.print(t);
17
18 lcd.setCursor(0, 1);
19 lcd.print("H :");
20 lcd.print(h);
21 }
1 void flamesensor() {
2 //Gets the sensor values
3 bool value = digitalRead(flame );
4 //These values are checked using the IF condition
5 if (value == 1) {
6 digitalWrite(Buzzer, LOW);
7 } else if (value == 0) {
8 Blynk.notify("Warning! Fire was detected");
9 digitalWrite(Buzzer, HIGH);
10 }
11 }
1 void pirsensor() {
2 //Gets the sensor values
3 bool value = digitalRead(PIR);
4 //These values are checked using the IF condition
5 if (pirbutton == 1) {
6 if (value == 0) {
7 digitalWrite(Buzzer, LOW);
8 } else if (value == 1) {
9 Blynk.notify("Warning! Please check your security system");
10 digitalWrite(Buzzer, HIGH); x
11 }
12
13
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 31/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
13
}
}
1 void ultrasonic() {
2 //Gets the distance from the ultrasonic sensor
3 digitalWrite(trig, LOW);
4 delayMicroseconds(4);
5 digitalWrite(trig, HIGH);
6 delayMicroseconds(10);
7 digitalWrite(trig, LOW);
8 long t = pulseIn(echo, HIGH);
9 long cm = t / 29 / 2;
10 //These values are sent to the Blynk app
11 Blynk.virtualWrite(V4, cm);
12 //These values are printed on the LCD
13 lcd.setCursor(9, 1);
14 lcd.print("W :");
15 lcd.print(cm);
16 lcd.print(" ");
17 }
1 void loop() {
2 Blynk.run();
3 timer.run();
4 }
Step 5
Now, select board and port. After, upload this code to the Nodemcu board.
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 32/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Step 6
Lastly, run the Blynk app interface and enjoy this project. The full video guide is given below. So, we will meet in the next
tutorial.
How to make a full home automation system with Nodemcu esp8266 and Blynk app
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 33/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
IOT based home automation using Nodemcu | Step by step instructions [ESP8266 project]
Related Posts
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 34/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
1 thought on “How to make a full home automation system with Nodemcu esp8266 and Blynk app”
x
AILTONMK
JUNE 24, 2022 AT 8:51 AM
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 35/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
congratulations!! your projects are very good, when you have new ones send them to me I will be very grateful
Reply
Leave a Comment
Your email address will not be published. Required fields are marked *
Type here..
Name*
Email*
Website
Save my name, email, and website in this browser for the next time I comment.
Post Comment »
Search
Search
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 36/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
report this ad
Home
Arduino
Arduino Tutorials
Arduino Projects
IoT
Nodemcu ESP8266
ESP32
Electronic
Raspberry Pi
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 37/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Products
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 38/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Arduino obstacle avoiding + voice control + Bluetooth control Robot | DIY Arduino Robot
GenSwin
Halloween...
$14.99
Shop now
ELEGOO UNO
R3 Project...
$79.99
Shop now
SriTu Hobby
x
Create your dream electronic hobby project step by step with SriTu Hobby - the world's No. 1 hobby electronic website. Get
access to tutorials, and products for beginners and experienced hobbyists
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 39/40
3/27/23, 9:52 PM How to make a full home automation system with Nodemcu esp8266 and Blynk app - SriTu Hobby
Links
Privacy Policy
Disclaimer
Terms And Conditions
Contact Us
Refund and Returns Policy
Shipping
Read
Read
Arduino
Arduino Tutorials
Arduino Projects
IoT
Nodemcu ESP8266
ESP32
Raspberry Pi
Electronic
Buy
Development Boards
Displays
Modules
Motors
Related components
Semiconductors
Sensors
x
https://srituhobby.com/how-to-make-a-full-home-automation-system-with-nodemcu-esp8266-and-blynk-app/ 40/40