You are on page 1of 30

PROJECT ON ARDUINO HOME SECURITY USING

ULTRASONIC SENSOR

MINI PROJECT REPORT -2020


ON

HOME SECURITY SYSTEM USING


ARDUINO AND ULTRASONIC SENSOR

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 1


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR

MINIPROJECT REPORT-2020

ON

HOME SECURITY SYSTEM USING


ARDUINO AND ULTRASONIC SENSOR
Submitted by: AJITH
NANDHANAN

AKHIL MOHAN

AKHIL KR

AKSHAY AS

AKSHAY VARGHESE

Guided by:
RAJESH P

JINESH M S
(Lecturers in electronics & communication Engineering)

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 2


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR

MINIPROJECT REPORT -2020

CERTIFICATE
This is to certify that the project entitled “HOME SECURITY
SYSTEM USING ARDUINO AND ULTRASONIC SENSOR
“ work done by AJITH NANDHANAN,AKHIL MOHAN,AKHIL
KR,AKSHAY AS,AKSHAY VARGHESE in the year 2020.
Place:Kalamassery.
Date:30-May-2020. Staff in charge Head of department

Submitted for the 4th semester Diploma Examination held


on_____________

Internal examiner External examinar

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 3


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
ACKNOWLEDGEMENT
We would like to express my special thanks of graduate to our mini
project coordinator Sri. Jinesh sir as well as our HOD Rajesh sir
andalso the department of technical education Kerala, drafted our
syllabus for giving as the golden opportunity to do this wonderful
project on the topic “HOME SECURITY SYSTEM USING
ARDUINO AND ULTRASONIC SENSOR” which also helped as
in doing lot of researches and we came to know about so many new
things we really thankful to them.
Secondly I would also like to thank my parents and friends who
helped me a lot in finalizing this project with in the limited period.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 4


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
ABSTRACT

The development of technology in the field of Electronics has


brought drastic changes in everyday life. The technology has
made tremendous advances in variety of domain fields like
medicine, telecommunication, automation and security. This
paper demonstrates the working of a low cost, low power
consumption wireless security system. We have proposed an
intelligent security system that uses ultrasonic sensor for theft
detection and sends signal (Text Message) to indicate the theft
using NodeMCU wireless communication technology. This paper
proposes the overall framework of hardware and software design
and methodology to implement the system

CONTENT PAGE
1) INTRODUCTION ………………………………………………
….......7

2) DESCRIPTION OF
PROJECT ………………………………......8

3) BLOCK
DIAGRAM ………………………………………………….…9
DESCRIPTION OF EACH BLOCK ……………………….……..

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 5


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
4) DESCRIPTIONOF INTERFACING COMPONENTS …….10
Arduino UNO

Ultrasonic sensor

NODE MCU

5) CIRCUIT DIAGRAM OF
PROJECT …………………………….13

6) CONCLUSION …………………………………..........................
14

.
7) REFERENCE ……………………………………………………
………15

8) APPENDIX ………………………………………………………
………16

APPENDIX 3: PROGRAM CODE

LIST OF FIGURES

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 6


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
➢ BLOCK DIAGRAM (fig:1)_____________________9
➢ ARDUINOUNO (fig:2)_______________________11
➢ ULTRA SONIC SENSOR (fig:3)________________________12
➢ NODE MCU (fig:4)________________________________12,13
➢ CIRCUITDIAGRAM (fig:7)____________________13

INTRODUCTION
With the emergence of new technology, security can be provided
in a smarter way. This paper proposes Home security system and
introduces many technologies for making the system installation
easy and secure. Most of the system makes use of mobile
communication like GSM and Wi-Fi for security systems. The
Central Processing Unit for the proposed system is developed
using the Arduino microcontroller which is a low cost and
efficient controller used in many applications.
The system consists of ultrasonic sensor and NodeMCU which is
connected to the microcontroller. The Fig - 1 describes the system
with the help of block diagram.
The wireless communication system used in this system is
NodeMCU, which sends notification to the owner.
The system also uses microcontroller board such as Arduino
along with the combination of NodeMCU and ultrasonic sensor
to provide a complete security system.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 7


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
The crucial component of security in this system is ultrasonic
sensor, normally being placed at window grill or door. It works by
sensing the vibrations. The wireless communication system used
in this system is NodeMCU, which sends notification to the owner

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 8


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
DESCRIPTION OF PROJECT
The system consist of ultrasonic sensor and Node MCU which is
connected to the microcontroller . the figure describes the system
with the help of block diagram .the wireless communication
system used in this system is Node MCU,which sends notification
to the owner .the system also uses microcontroller board such as
arduino along with the combination of Node MCU and ultrasonic
sensor system. The crucial component of security in this system is
ultrasonic sensor, normally being placed at window grill or
door.It works by sensing the vibration .The wireless
communication system used in this system is Node MCU,which
sends notification to the owner.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 9


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
BLOCK DIAGRAM

Figure :1

DESCRIPTION OF EACH BLOCK


Arduino UNO
The Arduino UNO is a microcontroller based on the ATmega 328.

It has 14 digital input and output pins, 6 analog inputs, a 16MHz


ceramic resonator, a USB connection, a power Jack, an ICSP header,

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 10


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
and a reset button.

The Arduino board is programmed using the Arduino IDE


software.

Ultrasonic sensor
Ultrasonic sensor also known as transceivers as they send and
receive signals.
NODE MCU
NodeMCU is an open-source firmware and development kit that helps you
to prototype or build IoT product. It includes firmware which runs on the
ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based
on the ESP-12 module.

Power supply:
Used a cheap power supply which can output 5 volts as well as
3.3 volts. I bought it online from china. 5 volts side of power
supply is supplying power to hcsr04 and 3.3 volt side is used to
power nodemcu. Note the grounds of 3.3v and 5v are made
common

DESCRIPTION OF INTERFACING
COMPONENTS

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 11


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
ARDUINO UNO

Arduino [6] is a tool for making computers that can sense and
control more of the physical world than your desktop computer.
It's an open-source physical computing platform based on a
simple microcontroller board and a development environment for
writing software for the board. The Fig - 3 shows the Arduino
board.
The Arduino can be used to develop interactive objects
considering inputs from a variety of switches or sensors, and
controlling a variety of lights, motors, and other physical outputs.
The Arduino projects can be stand-alone, or they can
communicate with software running on your computer (e.g.
Flash, Processing, and MaxMSP.) The boards can be assembled by
hand or purchased preassembled. Arduino simplifies the process

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 12


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
of working with microcontrollers and also it offers some
advantage to variety of users over other systems:

ULTRASONIC SENSOR

Ultrasonic sensors [9] (also known as transceivers as they send


and receive signals, but more generally called transducers) work
on the similar principle toradar or sonar, which evaluate
attributes of a target by interpreting the echoes from radio or
sound waves respectively. The active ultrasonic sensorsgenerate
high frequency sound waves and evaluate the echo which is
received back by the sensor, measuring the time interval between
sending the signal and receiving the echo to determine the
distance to an object. When there is a sensation, message is being
sent to the mobile phone of the owner. The Fig - 4 shows the
Ultrasonic Sensor.

NODE MCU

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 13


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR

NodeMCU is an open-source firmware and development kit that


helps you to prototype or build IoT product. It includes firmware
which runs on the ESP8266 Wi-Fi SoC from Espressif Systems,
and hardware which is based on the ESP-12 module. The
firmware uses the Lua scripting language. It is based on the eLua
project, and built on the Espressif Non-OS SDK for ESP8266

CIRCUIT DIAGRAM OF PROJECT

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 14


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
Figure :7

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 15


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
CONCLUSION
This paper presents the design and the implementation of a Smart
Security System for homes using Arduino and the Wireless
communication using ESP8266 chip. A. The system has a user
friendly interface which is easy to install and use. The system is
low cost, consumes low power and provides high security.
We guarantee the success of this project after checking the
security alert message on the mobile phone.this system provide
security for the home.
The wireless communication system used in this system is
NodeMCU, which sends notification to the owner.
The system also uses microcontroller board such as Arduino
along with the combination of NodeMCU and ultrasonic sensor
to provide a complete security system.
The crucial component of security in this system is ultrasonic
sensor, normally being placed at window grill or door. It works
by sensing the vibrations. The wireless communication system
used in this system is NodeMCU, which sends notification to the
owner .
The sensor based system has worked automatically without help ,
it makes the system more efficient and convenient.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 16


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
REFERENCE
We mainly used internet for referring more over internet we done
various projects using Arduino which make us capable for
designing our own prototype. We have the basic knowledge about
C programming language and studied about the libraries of
Arduino from GitHub.com. As we do various projects we
understand how to interface the components using knowledge we
build a prototype within a time duration of 2 months.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 17


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
APPENDIX
Appendix :3-PROGRAM CODE

const int pingPin = 10; // Trigger Pin of Ultrasonic


Sensor
const int echoPin = 9; // Echo Pin of Ultrasonic
Sensor
const int LED= 13; //LED PIN ONBOARD
const int ESP= 12; // ARD 12 TO ESP D1 PIN
void setup() {
Serial.begin(9600); // Starting Serial Terminal
pinMode(LED, OUTPUT);
pinMode(ESP, OUTPUT);

void loop() {
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 18
GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
long duration , cm;
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(10);
digitalWrite(pingPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
//inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);

Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(1000);

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 19


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
if (cm < 50)
{
Serial.print("Alert");
digitalWrite(LED, HIGH);
digitalWrite(ESP, HIGH);
}
else
{
Serial.print("Safe");
digitalWrite(LED, LOW);
digitalWrite(ESP, LOW);
}
}

long microsecondsToCentimeters(long
microseconds) {
return microseconds / 29 / 2;
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 20
GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
}

#include <ESP8266WiFi.h>

const char* ssid = "BLOOD";


const char* password = "REDBLOOD";
const char* host = "maker.ifttt.com";
const char* apiKey = "d3yyZqPXjZJmCcb0oygknb";

int pin = 5;//esp D1 trigger msg


volatile int state = false;
volatile int flag = false;
const char* door_state = "closed";

unsigned long previousMillis = 0;


const long interval = 3000;
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 21
GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR

void changeDoorStatus() {

unsigned long currentMillis = millis();

if (currentMillis - previousMillis >= interval) {


previousMillis = currentMillis;

state = !state;
if (state) {
door_state = "opened";
}
else {
door_state = "closed";
}
flag = true;
Serial.println(state);
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 22
GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
Serial.println(door_state);
}

void setup() {
Serial.begin(115200);
delay(100);
Serial.println("Preparing the Door Status Monitor
project...");

pinMode(pin, OUTPUT);
attachInterrupt(digitalPinToInterrupt(pin),
changeDoorStatus, CHANGE);

Serial.println();
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 23
GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {


delay(500);
Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 24


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
void loop() {

if (flag) {
Serial.print("connecting to ");
Serial.println(host);

WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}

String url =
"https://maker.ifttt.com/trigger/esp/with/key/d3yyZ
qPXjZJmCcb0oygknb";

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 25


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
Serial.print("Requesting URL: ");
Serial.println(url);
client.print(String("POST ") + url + "
HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Content-Type: application/x-www-form-
urlencoded\r\n" +
"Content-Length: 13\r\n\r\n" +
"value1=" + door_state + "\r\n");
flag = false;
}
delay(10);
}
Features
• High Performance, Low Power AVR® 8-Bit Microcontroller
• Advanced RISC Architecture
– 131 Powerful Instructions – Most Single Clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 20 MIPS Throughput at 20 MHz

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 26


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
– On-chip 2-cycle Multiplier
• High Endurance Non-volatile Memory Segments
– 4/8/16/32K Bytes of In-System Self-Programmable Flash progam
memory
(ATmega48P/88P/168P/328P)
– 256/512/512/1K Bytes EEPROM (ATmega48P/88P/168P/328P)
– 512/1K/1K/2K Bytes Internal SRAM (ATmega48P/88P/168P/328P)
– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
– Data retention: 20 years at 85°C/100 years at 25°C(1)
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– Programming Lock for Software Security
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescaler and Compare Mode
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and
Capture
Mode
– Real Time Counter with Separate Oscillator
– Six PWM Channels
– 8-channel 10-bit ADC in TQFP and QFN/MLF package
Temperature Measurement
– 6-channel 10-bit ADC in PDIP Package
Temperature Measurement
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Byte-oriented 2-wire Serial Interface (Philips I2C compatible)
– Programmable Watchdog Timer with Separate On-chip Oscillator
– On-chip Analog Comparator
– Interrupt and Wake-up on Pin Change
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 27


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
– Internal Calibrated Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-
down, Standby,
and Extended Standby
• I/O and Packages
– 23 Programmable I/O Lines
– 28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and 32-pad QFN/MLF
• Operating Voltage:
– 1.8 - 5.5V for ATmega48P/88P/168PV
– 2.7 - 5.5V for ATmega48P/88P/168P
– 1.8 - 5.5V for ATmega328P
• Temperature Range:
– -40°C to 85°C
• Speed Grade:
– ATmega48P/88P/168PV: 0 - 4 MHz @ 1.8 - 5.5V, 0 - 10 MHz @ 2.7 - 5.5V
– ATmega48P/88P/168P: 0 - 10 MHz @ 2.7 - 5.5V, 0 - 20 MHz @ 4.5 - 5.5V
– ATmega328P: 0 - 4 MHz @ 1.8 - 5.5V, 0 - 10 MHz @ 2.7 - 5.5V, 0 - 20 MHz
@ 4.5 - 5.5V
• Low Power Consumption at 1 MHz, 1.8V, 25°C for
ATmega48P/88P/168P:
– Active Mode: 0.3 mA
– Power-down Mode: 0.1 μA
– Power-save Mode: 0.8 μA (Including 32 kHz RTC)

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 28


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 29


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY
PROJECT ON ARDUINO HOME SECURITY USING
ULTRASONIC SENSOR
GITHUB.COM
www.Arduinounomagic.com

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING 30


GOVERNMENT POLYTECHNIC COLLEGE
KALAMASSERY

You might also like