Content uploaded by Nosheen Sabahat
Author content
All content in this area was uploaded by Nosheen Sabahat on Oct 14, 2021
Content may be subject to copyright.
ECAI 2019 - International Conference – 11th Edition
Electronics, Computers and Artificial Intelligence
27 June -29 June, 2019, Pitesti, ROMÂNIA
978-1-7281-1624-2/19/$31.00 ©2019 IEEE
Shield: An Intelligent and Affordable Solution for
Home Security
Aimen Shahid
Department of Computer Science
Forman Christian College University
Lahore, Pakistan
amshahid178@gmail.com
Sidra Minhas
Department of Computer Science
Forman Christian College University
Lahore, Pakistan
sidraminhas@fccollege.edu.pk
Mahroo Ali
Department of Computer Science
Forman Christian College University
Lahore, Pakistan
alimahroo21@gmail.com
Nosheen Sabahat
Department of Computer Science
Forman Christian College University
Lahore, Pakistan
nosheensabahat@fccollege.edu.pk
Mariam Eijaz
Department of Computer Science
Forman Christian College University
Lahore, Pakistan
mariam.eijaz@hotmail.com
Abstract— Reliable home security is vital for progression of
our societies. Traditional methods to protect house premises
against intruders include security guards and CCTV cameras
which is labor intensive, expensive and unreliable. In this paper,
we propose a wireless, intelligent, affordable and portable IoT
based home security system. The input unit consisting of
multiple sensors is placed at the entry points of the house. The
SONAR, motion and sound sensor capture the situation at entry
points. The sensor data is collected and wirelessly transmitted by
NodeMCU to the Raspberry Pi server via an online database. The
server uses logistic regression classification algorithm to detect
human presence at the gate. Once intruder is detected, alerts are
generated to the user and camera mounted on the input unit is
turned on to take pictures. Facial recognition unit is also
incorporated to detect known versus unknown faces. The
information of intrusion including image and timestamp are send
to the Shield’s mobile application.
Keywords— NodeMCU, Raspberry Pi, python, classification,
SONAR, PIR motion sensor
I. I
NTRODUCTION
Burglaries and thefts are two major security threats for
residents of Pakistan. According to Pakistan Bureau of
Statistics more than 25,000 [1] burglaries have been
reported in 2017 which is not significantly lower than
previous years. These statistics have led to a widespread
feeling of uncertainty and fear amongst common people of
Pakistan which further escalate socio-economic problems.
In response to these security threats, people are bound
to employ security guards privately or via a security service
provider. Apart from being expensive, this security method
is not reliable. Several cases have been reported when hired
security guards have breached sensitive information and
helped the criminals. In armed burglaries, the human
security guards suffered injuries and also life loss by the
criminals. Due to these drawbacks of human security
guards, people were inclined towards electronic and man-
less surveillance systems.
CCTV cameras were introduced for on-site scrutiny,
while the feed was constantly being monitored at the back
end and being stored. Both wired and wireless cameras are
used, however, the restriction of constant monitoring was
labor intensive and huge video records were difficult to
manage. Various researchers presented innovative
techniques to automatically detect abnormal situations, but
the cameras themselves were vulnerable to damage. Several
sophisticated solutions to this problem are presented by
numerous companies which involve installment of
numerous sensors on entry points to detect unauthorized
entry. However, such systems are very expensive.
Therefore, there is a need for low cost, robust and reliable
security system for house premises.
In this paper, we present an affordable, wireless, IoT
based home security solution which suits the needs of
citizens of Pakistan to the fullest. A wireless input unit is
designed to monitor the entry point. The input unit consists
of three sensors: PIR, SONAR, and sound. A camera is also
installed on the input unit which is activated only when
human presence is detected. The sensors transmit their data
wirelessly to the Raspberry-Pi server. The server unit is
trained to classify the input data as normal (absence of
intruder) or abnormal (presence of intruder). In case of
intruder presence, the server unit is responsible to
communicate the activity to the homeowner’s mobile phone
via the mobile app. simultaneously, a signal is sent to the
camera to start recording the event.
Authorized licensed use limited to: Auckland University of Technology. Downloaded on June 07,2020 at 23:56:53 UTC from IEEE Xplore. Restrictions apply.
Main contributions of this paper are:
1. Wireless, mobile input unit which can be placed at
any entry point of the house
2. Existence of motion detection sensors around the
camera early detect attempts to damage the
hardware
3. Use of soft computing techniques to reduce false
alarms and accurately detect anomalous events
4. Inclusion of facial recognition methods to detect
home dwellers and servants before generating
burglar alarm
II. M
ETHODOLOGY
The basic flow of the proposed AI agent for home
security is depicted in Fig 1. The system is divided into
three major modules; the input module, the processing
module, and the output module. Surrounding data is
gathered using multiple sensors mounted on the input unit.
The data is then wirelessly fed to the database from where
the processing unit can access it. The processor is
implemented on Raspberry Pi which autonomously detects
intruders. Once an intruder is detected, e-mail and SMS
alerts are generated to the user. The details of each module
are mentioned in the following pages.
A. Input Module
To develop a robust intelligent system, the inputs must
be highly accurate. Hence to capture the correct situation at
the house entry points, we employ three analogue sensors.
These sensors include the SONAR sensor (HC-SR04),
Passive Infrared (PIR) motion sensor (HC-SR501), and a
sound sensor (KY-038). The aim of using more than one
sensors is to cater for false positive and false negative
situations by overcoming the drawbacks of each sensor.
Fig. 2 represents the working of the sensors used in this
system. SONAR sensors are widely used in home security
systems. A SONAR sensor emits ultrasonic waves which
are reflected by obstructions, if any. [2] The reflected waves
are captured via receivers and an electronic signal is
generated. However classic sensors have a range of only 55
degrees which is quite narrow and susceptible to blind spots.
Also some objects, softer ones such as padded jackets or
pillows, tend to absorb ultrasonic waves, hence become
undetectable. The SONAR sensor also mainly relies on the
detection of the reflected waves to give a reading, however
if once the door and there is no object beyond the door for
quite a distance, then the waves will not be reflected and
hence, not detected. [3] [4]This will cause an error and no
reading will be taken by the sensor. Another problem can
occur during the time when the door is being opened. If the
sensor is pointed directly at the door, and it is opened at an
angle the ultrasonic waves will be reflected at an angle and
will not travel back to the sensor, again causing error in
detection and producing no readings. Therefore, PIR motion
sensors are incorporated to cater for drawbacks of SONAR
sensors. PIR sensor has a much wider range of 110 degrees
and can detect motion up to 7 meters. Finally the sound
sensor is also added to detect any unusual voice which could
indicate a break in, such as the rattling of a gate, the
breaking of a window, etc. The sensitivity of each sensor
can be adjusted using the potentiometers installed.
For wireless transmission of sensor data, all three
sensors are interfaced with the NodeMCU and are coded in
C Language using the Arduino IDE. The NodeMCU was
specifically chosen as it already contains a built-in WiFi
module. An Arduino Uno is also added in the input module
(a)
(b)
(c)
Fig 2. Sensors in the input module, a) SONAR, b) PIR Motion Sensor, c) Sound senor
Fig 1. Flow Diagram for Shield
Authorized licensed use limited to: Auckland University of Technology. Downloaded on June 07,2020 at 23:56:53 UTC from IEEE Xplore. Restrictions apply.
to provide an interface to camera (ArduCAM) for
enhanced security features. [5] These inputs are an
accurate combination and are good candidates for the
features.
B. Processing Module
Our processor is implemented on the Raspberry Pi,
which runs the Python code in a bootable file for every
new entry from the sensor unit. Combination of Python
and Raspberry Pi can handle large data and cross-
platform interaction. Resultantly, our server is portable
with low power consumption. The processor flow
diagram is depicted in Fig 3. Data from the sensors are
stored in an online database from where it is fetched by
the processor. In this manner there is no requirement of
high storage capacity of our portable system.
Furthermore, using soft computing techniques, the server
is made intelligent. For server training, a total of 1,000
cases are generated using the three sensors. The system is
trained using basic logistic regression classifier. Logistic
regression is best suited for the current framework as it
can handle low dimensional data effectively, [4] without
making the module complex and it is also space and time
efficient. Logistic regression model is easy to regularize
and is highly interpretable with its predictions. Our model
presented 97.48% training accuracy for detecting
Abnormalities in the training environment. [5] [6].
In Fig 3 the Classifier score shows the trained model has
the score of 0.9748 calculated by a premade function
(model.score( (y_train, y_predicted) ) available in the
library. The mean absolute error of the model was 0.0173.
The data frame used for training was collected for 48 hours
of daytime and night time in a local household with variant
environments. The selected features are Sonar, PIR, and
sound and active user time, as mentioned before. They
together diminish their individual shortcomings therefore
presenting very attractive system accuracy.
The Score function from the Python library-scikit learn,
computes the y-prediction (where y is the target feature)
against the test set and compares them with the y-real values
to check the accuracy of the trained model. The mean
absolute error is the mean of errors between the real and
predicted values of Y-target feature.
Once deployed, the input unit sends sensor readings to
the central database every second. These readings are used
to detect human presence, detect sound levels and change in
object distance using the trained logistic regression
classifier. If human presence is detected, a flag is raised for
the output module to act upon and it activates the alerting
modules.
C. Output Module
Once the Logistic Regression Model predicts abnormal
behavior it updates it into the online database. At the same
time it also sets a flag to turn on the camera for 30 seconds
for it to capture images and save them on the Raspberry Pi.
The user will have the choice to use the Shield mobile
application and enter their preferences in the settings. These
are their preferences for how they want to be alerted in the
case of an abnormal situation, via Email and/or SMS. If they
select Email they will be sent the captured images as soon as
they are taken as well. All these preferences will be saved in
the online database for each user, so the Python code can
access these before generating any alert.
These images will also go through a facial recognition
module. Pictures of people who are allowed to be at the
premise will be labeled and saved in the Raspberry Pi
beforehand. Using these examples the facial recognition
program will then compare the new images and try to judge
if the faces detected in them are previously identified or not.
In case they are not, the email will mention that an unknown
person has been detected in the house.
It is to be noted that these alerts are initially only sent to
the user themselves. However, if they do not respond to the
notification on their Shield mobile application, by setting
the flag back to normal then an SMS alert will also be sent
to their Emergency Contacts. This is another option
available in the app, to add people and their phone numbers
in the system. Their details will also be uploaded into the
online database for the Python code to retrieve, and send
SMS alerts to.
Since all components of this system rely heavily on a
stable WiFi connection to maintain communication, it is
important to be able to detect when any of the components
do not have an internet connection. The NodeMCU has been
Fig 4. Processing
Fig 3 Classifier Score
Authorized licensed use limited to: Auckland University of Technology. Downloaded on June 07,2020 at 23:56:53 UTC from IEEE Xplore. Restrictions apply.
programmed to take sensor reading and send them to the
online database after every second. The Python code is also
meant to process that data and update the database within
that second. So the database can be checked if it has not
been added to, or updated within the past 2 seconds it should
generate an alert which can be displayed in the mobile app.
The app itself will display whether it is connected to WiFi
or not, as soon as the user goes on the home page.
Fig 5a. Email Alert on a smartphone
Fig 5b. SMS Alert on a smartphone
III. R
ESULTS
&
C
ONCLUSION
The purpose of the proposed system is to provide an
intelligent, wireless, energy efficient, portable and
affordable home security solution. The wireless input
modules can be placed at multiple entry points of the house
for added security. With the use of online database for input
recording, the need for a separate dedicated storage space is
eradicated. The prediction power of Shield is evaluated
using various classifiers including logistic regression, and
cross-validated by Support Vector Machines (SVM) and
decision trees, however the sophistication of classification
algorithm least affected the classification performance.
Logistic regression achieved a training accuracy of 97.5%
hence it was selected to be our final model. The system was
thoroughly tested in 4 houses and the predictions for
abnormal situations were correct 9 out of 10 time. Shield
also outperformed in a comparative study with a security
guard operated CCTV system.
The entire sensing system can be powered by a single
6000mAh power bank for multiple days on a single charge.
NodeMCU can last for about 72 hours on a single charge
while the Arduino Uno module will last for around 100
hours [3]. The PIR motion sensor and the sound sensor only
require 3.3V to operate while the sonar sensor requires 5V.
Even though the system is already quite energy efficient, its
battery time can be still increased. Since both modules
execute several million instructions per second, we can save
some power by using Deep Sleep mode on the NodeMCU
and the Power Down mode on the Arduino Uno. Since we
have a delay of a second before data from the sensors is read
again, we can use these modes for that second to minimize
the power consumption for that idle second as much as
possible. Furthermore, by removing the voltage regulator as
well as the LEDs present on the boards we can decrease
power usage even more. This means that the entire sensing
unit would last much longer on the single charge of the
power bank.
This system is highly expandable. More sensors can be
added to improve intruder detection. Other sensors like gas
sensors, smoke detectors, vibration sensors, and rain
detectors to act as stand-alone sensors with the current
sensor unit. All of these can very easily added in the
algorithm and be displayed in the mobile app. These
additions will allow the user to have much more intel about
their homes, and not just in terms of robberies but also
natural disasters and even medical emergencies. The user
does not even need to be in the same country in order to be
able to monitor their home and family’s safety. In addition
to improvements in the algorithms, the server on the
Raspberry Pi can be moved online, therefore improving the
overall performance, accessibility and decreasing the cost of
the system by a huge margin.
A
CKNOWLEDGMENT
We would like to give special thanks to Dr.Amara Tariq
for useful discussions, constructive criticisms and guidance.
We would also like to gratefully acknowledge Ammar Saqib
for his relentless support and assistance with our work.
R
EFERENCES
[1] G. Eason, B. Noble, and I. N. Sneddon, “On certain
integrals of Lipschitz-Hankel type involving products o
f
Bessel function," vol. A247, p. 529–551, April 1955.
[2] J. C. Maxwell, "A Treatise on Electricity and
Magnetism," Oxford: Clarendon, vol. 2, p. 68–73, 1892.
[3] B. B. Ahmet Turan Özdemir, "Detecting Falls with
Wearable Sensors Using Machine Learning
Techniques," vol. 14, no. 6, 2014.
[4] P. HARRINGTON, "Machine Learning in Action,"
MANNING , vol. 5, 2012.
[5] Q. Cheng, P. Varshney and M. Arora, "Logistic
Regression for Feature Selection and Soft Classification
of Remote Sensing Data,"
I
EEE Geoscience and Remote
Sensing Letters, vol. 3, no. 4, pp. 491-494, 2006.
[6] K. L. L. G. M. I. Chao-Ying Joanne Peng, "An
Introduction to Logistic Regression Analysis and
Reporting," The journal of educational research, vol.
96, no. 1, pp. 3-14, 2010.
Authorized licensed use limited to: Auckland University of Technology. Downloaded on June 07,2020 at 23:56:53 UTC from IEEE Xplore. Restrictions apply.
Authorized licensed use limited to: Auckland University of Technology. Downloaded on June 07,2020 at 23:56:53 UTC from IEEE Xplore. Restrictions apply.