How To Make A Home Security System Using Nodemcu ESP8266 and Blynk App

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 48

3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

0
 

How to make a home security system using Nodemcu ESP8266 and Blynk app

Hello, welcome back to another tutorial from the SriTu Hobby. In this tutorial, we will learn how to make a
home security system using the Nodemcu ESP8266 board and the Blynk application. Also, the PIR sensor is
mainly used for this project. We have done this project using the Telegram app in a previous article. You
can study it from this link. Also, this project can be used for our home, place of business, shops. So this
tutorial will cover how to make this project at a low cost. Keep reading.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 1/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

ESP8266 NodeMCU Web Server Using Arduino IDE: Control components from your M…

CrowdStrike a 3X EPP Leader


CrowdStrike named a 2022 Gartner® Magic Quadrant™ Leader for Endpoint Protection Again.

CrowdStrike® Open

How does this security system work?

When this security system is powered on, The Nodemcu board connects to the Blynk cloud via the internet.
Then we can turn ON and OFF this system using the button on the interface set up in the Blynk app. After,
when a motion is captured by the PIR sensor, the buzzer and the red LED are activated. Then, the mobile
x
phone also receives a push notification via the Blynk app. Afterward. this system will return to normal after

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 2/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

a short time. Also, this time can be changed by the preset in the PIR sensor. The green LED bulb turns ON
when the system is operating normally.

OK, let’s do this project step by step. The required components are given below.

Nodemcu ESP8266 board x 1 — Amazon / Banggood


PIR sensor x 1 — Amazon / Banggood
LED x 2 — Amazon / Banggood
180-ohm resistor x 2 — Amazon / Banggood
5v buzzer x 1 —  Amazon / Banggood
Jumper wires — Amazon / Banggood
Foam board — Amazon / Banggood

Step 1

Firstly, identify these components.

Nodemcu ESP8266 board

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 3/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

PIR sensor

LED bulb x 2

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 4/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

180-ohm resistor x 2

5v buzzer

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 5/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Jumper wires

Foamboard

Step 2

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 6/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Secondly, cut the foam board pieces as follows.

Ads by
Stop seeing this ad Why this ad? 

Ads by
Stop seeing this ad Why this ad? 

Step 3  x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 7/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Thirdly, solder the jumper wires for the buzzer and LEDs.

Ads by
Stop seeing this ad Why this ad? 

Curated Bonds For You


Don't think twice before you take your vacation. Get up to 13% returns on your investment

AltiFi Open

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 8/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Step 4

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 9/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Next, connect all the components to the Nodemcu board. To do this, use the circuit diagram below.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 10/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 11/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

₹244 ₹7,490 ₹85


RF/IF and RFID Products
Digi-Key India

Step 5

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 12/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Then, adjust a 1.5 x 3.5-inch piece to fit the Nodemcu board and glue it on.

Step 6

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 13/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Next, set a 2.5 x 3.5-inch piece to fit the PIR sensor and the two LEDs.After, glue them.

Earn up to 13% returns

Open

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 14/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 15/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Step 7

Then, take a 1.5 x 3.5-inch piece and adjust it to fit the buzzer. After, glue it on.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 16/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Step 8

Now, connect the piece that holds the Nodemcu board to the 3.5 x 2.5-inch piece.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 17/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Step 9

Then, glue the 1.5 x 2.5-inch piece to the base foam board piece. Also, glue the buzzer-connected piece to
the base piece.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 18/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 19/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Step 10

Next, glue the 1.5 x 2.5-inch piece to the main foam board piece. Also, glue the PIR sensor attachment
piece to the top as follows.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 20/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Step 11

Ok, now let’s set up the Blink app step by step.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 21/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

PRICE DROP PRICE DROP

₹3,579 ₹133 ₹251


PRICE DROP PRICE DROP PRICE DROP

₹298 ₹314 ₹600


Range Of Electronic Components
Robu

First, download and install the Blynk app from your mobile phone. Then, sign up for this app using your
Gmail. Next, click the new project button.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 22/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Then, enter the project name as you like. Also, select the device and connection type. After. Click the
“Confirm” button.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 23/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Now, we can see the project interface. Then, click the “+” icon and add one button and notification widget.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 24/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 25/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 26/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 27/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 28/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

₹244 ₹7,490 ₹85


RF/IF and RFID Products
Digi-Key India

Then, click the button and enter the name of your choice. Next, change the pin to A0 and the mode as the
switch. Afterward, click the Notification Widget and change the priority to HIGH.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 29/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 30/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Earn up to 13% returns

Open

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 31/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Step 12

OK, the Blynk app is ready. Now, connect this project to the computer. After that, let’s create the program for
this project. It is as follows.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 32/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

WIFI library — Download


Blynk library — Download
The complete program of this project – Download

1 #define BLYNK_PRINT Serial


2 #include <ESP8266WiFi.h>
3 #include <BlynkSimpleEsp8266.h>
4
5 char auth[] = ""; //Enter your Blynk application auth token
6 char ssid[] = ""; //Enter your WIFI name
7 char pass[] = ""; //Enter your WIFI passowrd
8
9 BlynkTimer timer;
10 int pinValue = 0;
11
12 void setup() {
13 Serial.begin(9600);
14 pinMode(D0, OUTPUT);
15 pinMode(D1, OUTPUT);
16 pinMode(D2, OUTPUT);
17 pinMode(D6, INPUT);
18
19 Blynk.begin(auth, ssid, pass);
20 timer.setInterval(1000L, notifiaction);
21
22 }
23 BLYNK_WRITE(V0) {
24 pinValue = param.asInt();
25 }
26
 x
27 void notifiaction() {
28 bool sensor = digitalRead(D3);
29 Serial.println(sensor);
30
https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 33/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby
30 if (pinValue == 1) {
31 Serial.println("System is ON");
32 if (sensor == 1) {
33 Blynk.notify("WARNING! Please check your security system");
34 digitalWrite(D0, HIGH);
35 digitalWrite(D1, HIGH);
36 digitalWrite(D2, LOW);
37 } else if (sensor == 0) {
38 digitalWrite(D0, LOW);
39 digitalWrite(D1, LOW);
40 digitalWrite(D2, HIGH);
41 }
42 } else if (pinValue == 0) {
43 Serial.println("System is OFF");
44 }
45 }
46
47 void loop() {
48 Blynk.run();
49 timer.run();
50 }

Code Explanation

Firstly, it includes WIFI and Blynk libraries.


#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

Secondly, enter your Blynk app token and WIFI connection details.
char auth[] = “BMFz-z1357p65VVCAcsWTPfg_K-Jcuwj”; 
char ssid[] = “Dialog 4G 025”; 
char pass[] = “12345”; 

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 34/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Next, variables were created for BlynkTimer and Button Widget.


BlynkTimer timer;
int pinValue = 0;

In the void setup, the LEDs, buzzer and sensor pins are set as output. Also, the Blynk library starts using the
Auth token, WIFI name, and WIFI password. Later, the notification function is called. The notification
function is described below.
void setup() {
Serial.begin(9600);
pinMode(D0, OUTPUT);
pinMode(D1, OUTPUT);
pinMode(D2, OUTPUT);
pinMode(D6, INPUT);

Blynk.begin(auth, ssid, pass);


timer.setInterval(1000L, notifiaction);

void notifiaction() {
First, values are obtained from the PIR sensor and these values are entered into the boolean variable. Also,
these values are printed on the serial monitor
bool sensor = digitalRead(D3);
Serial.println(sensor);

If the Blynk app button value is 1, the system is activated. Also, it is printed on the serial monitor.
if (pinValue == 1) {
Serial.println(“System is ON”);

Then, PIR sensor values are checked using the IF condition. If the value is 1, a push notification is sent to
your phone and the red LED and buzzer are activated. x
if (sensor == 1) {

Blynk.notify(“WARNING! Please check your security system”);

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 35/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

digitalWrite(D0, HIGH);
digitalWrite(D1, HIGH);
digitalWrite(D2, LOW);

If the value is 0, the green LED is active.


} else if (sensor == 0) {
digitalWrite(D0, LOW);
digitalWrite(D1, LOW);
digitalWrite(D2, HIGH);
}

If the Blink application button value is 0, the system deactivates. Also, it is printed on the serial monitor.
} else if (pinValue == 0) {
Serial.println(“System is OFF”);
}
}

This code receives values from the blynk Button Widget.


BLYNK_WRITE(V0) {
pinValue = param.asInt();
}

In the loop function, the blink library and timer are activated.
void loop() {
Blynk.run();
timer.run();
}

RF/IF and RFID Products


Digi-Key India

Step 13

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 36/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

OK, now select the board and port. Then, upload this code to the Nodemcu board.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 37/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Step 14

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 38/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Now, run the Blynk app interface and enjoy this project. The full video guide is given below. So, we will meet
in the next tutorial.

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 39/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

How to make a home security system using Nodemcu ESP8266 and Blynk app

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 40/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

How to make a PIR SECURITY SYSTEM with ESP8266 | Bly…


Bly…

← Previous Post Next Post →

Related Posts

Introduction to Arduino and Arduino IDE Configuration – Step by step instructions

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 41/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

How to make an led light up and blink using Arduino

How to make a knight rider LED chaser (part i)

Leave a Comment
x
Your email address will not be published. Required fields are marked * 

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 42/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Type here..

Name*

Email*

Website

Save my name, email, and website in this browser for the next time I comment.

I'm not a robot


reCAPTCHA
Privacy - Terms

Post Comment »

Search

Search

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 43/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

report this ad

Home

Arduino

Arduino Tutorials

Arduino Projects

IoT

Nodemcu ESP8266

ESP32

Electronic

Simple DIY Toys

Raspberry Pi

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 44/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Products

High-Quality 16x2 LCD Display | Free guide with box


sssss
$5.99

Solderless PCB Breadboard | Mini Universal Test Protoboard


sssss  x
$4.99

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 45/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Arduino Compatible R3 ATmega328P | Arduino UNO board SMD With Cable


sssss
$12.99

4x4 Membrane Switch Keypad


sssss
$2.99

Wheel For Smart Robot Car


sssss
$3.99

Arduino obstacle avoiding + voice control + Bluetooth control Robot | DIY Arduino Robot

GenSwin
Halloween...
$14.99

Shop now

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 46/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

ELEGOO UNO
R3 Project...
$79.99

Shop now

Create it step by step

SriTu Hobby

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

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
 x
Buy

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 47/48
3/27/23, 9:00 AM How to make a home security system using Nodemcu ESP8266 and Blynk app - SriTu Hobby

Development Boards
Displays
Modules
Motors
Related components
Semiconductors
Sensors

Copyright © 2020 - 2023 SriTu Hobby. All rights reserved

 x

https://srituhobby.com/how-to-make-a-home-security-system-using-nodemcu-esp8266-and-blynk-app/ 48/48

You might also like