Home Security System with Raspberry Pi
Home Security System with Raspberry Pi
ASSIGNMENT – II
MINI PROJECT
<TITLE>
Submitted By
NAME:
[Link].
By
NAME: [Link]
REG NO: 922321105005
DEP: EEE
ACKNOWLEDGEMENT
It is a great privilege for us to express our profound gratitude to our teacher
[Link], University college of engineering Dindigul for his constant guidance, valuable
suggestions, supervision and inspiration throughout the course work without which it would have
been difficult to complete the work within scheduled time.
We would like to express our gratitude towards all the faculty members for his/her
kind cooperation and encouragement which helped us in completion of this project.
We are also indebted to the Head of the Department, University college of
engineering Dindigul for permitting us to pursue the project. We would like to take this
opportunity to thank all the respected teachers of this department for being a perennial source of
inspiration and showing the right path at the time of necessity.
---------------------------------
-
[Link]
(922321105005)
---------------------------------
-
---------------------------------
-
---------------------------------
-
CERTIFICATE OF APPROVAL
The project report titled “Home Security System Using Raspberry pi” prepared by
[Link] (922321105005) is hereby approved and certified as a creditable study in
technological subjects performed in a way sufficient for its acceptance for partial fulfilment of the
degree for which it is submitted.
-----------------------------------
--------------------------------------
--------------------------------------
RECOMMENDATION
We hereby recommend that the project report titled “Home Security System Using
Raspberry pi” prepared by [Link] (922321105005)be accepted in partial fulfillment of the
requirement for the Degree of Bachelor of engineering in Anna University , University college of
engineering Dindigul.
-------------------
------------------
--------------------------------------
ABSTRACT
With the advancement of modern technologies areas related to robotics and
computer vision, real time image processing has become a major technology under consideration.
So here a try has been made for a novel approach for capturing images from the Pi Camera in real
time environment and process them as we are required. This project portrays an machine learning
approach for face recognization to accomplish this process very quick with high identification rates
using OpenCV. Here in this project depicts a basic and simple equipment execution of face location
framework utilizing Raspberry Pi, which itself is a minicomputer of a small estimate and is of a
low cost. The framework is modified utilizing Python programming language. The destinations of
the face recognization are to recognize appearances and its spatial area in any pictures or recordings
.The proposed framework distinguishes the faces present in a grey scale and colored image. This
project center around usage of face detection framework for human recognizable proof in light of
OpenCV library with python. Here in this project the idea of identification has been built up by
composing distinguishable code for dataset generator, trainer and indicator. Effectiveness of the
framework is examined by ascertaining the Face recognization rate for every one of the database.
The outcomes uncover that the proposed framework can be utilized for face detection even from
low quality pictures and shows incredible execution level. At last the data that will be shown
alongside recognized photograph has been put away on database. This concept has a higher scope
on security and surveillance projects and various operation.
LIST OF FIGURES
Figure Page no
Figure 1: Block Diagram 9
Figure 3: Raspberry Pi 11
Chapters Page No
Chapter 1: Introduction 1
Chapter 2: Literature Review
2.1: Earlier Developments 3
2.2: Recent Developments 4
2.3: Face Recognization 6
Chapter 3: Overview of the Project
3.1 Block Diagram 9
3.2 Hardware equipments 9
3.3 Circuit Diagram 10 10
Chapter 4: Component Description
4.1: Raspberry Pi 11
4.2 Raspberry Pi Camera 14
4.3 2 channel Relay 15
4.3.1 2 Channel Relay with Raspberry Pi 17
4.4 DC Motor 18
4.5 LED 19
Chapter 5: Methodology
5.1 Installing Raspbian on the Raspberry Pi 20
5.2 Installation of OpenCV 21
5.3 Face Recognization 24
5.4 Haar Cascade Classifier Algorithm 26
INTRODUCTION
Home automation alludes to the use of computer applications and information
technology for control of home and residential appliances. Its application changes from basic
remote control of lighting to complex microcontroller based systems including changing degrees
of insight and automation. Home automation results in ease of work, increased efficiency, and
security benefits prompting improved personal satisfaction. The prevalence of system empowered
home automation has been expanding incredibly as of late because of straightforwardness and a
lot higher affordability. Also, with the fast development of the Internet, there is the potential for
the remote control and checking of such network enabled appliances. Notwithstanding, the new
and energizing chances to expand the availability of gadgets inside the home is the end goal of
home automation. Modeling of a home automation system for controlling all the various devices
in Remote locations can be achieved through a variety of communication options such as wireless
LAN technologies, dial-up modems, satellite communication, cellular network, Internet and so on.
The main virtue of home automation can be stated as its security facilities where one can be notified
and one can be alarmed by this home automation if there is any threat caused to someone’s privacy.
Home automation enables human beings to take advantage of high-tech functionality that was
almost impossible to visualize a few years back. The convenience factor here is huge. Having the
capacity to keep the majority of the automation inside home associated through one interface is a
huge step forward towards innovation and home automation. Theoretically, all one has to do is
simply figure out how to utilize one application on a cell phone and tablet, and one will have the
capacity to take advantage of incalculable capacities and gadgets all through the home. This
reduces the expectation to absorb information for new clients, makes it simpler to get to the
usefulness someone really need for their home. Smart home systems tend to be wonderfully
flexible when it comes to the accommodation of new devices and appliances and other technology.
No matter how state-of-the-art your appliances seem today, there will be newer, more impressive
models developed as time goes on. Beyond that, you’ll probably add to the suite of devices as it
will replace the older ones or discover new technology to accompany indoor and outdoor spaces.
Being able to integrate these newcomers seamlessly will make everyones job as a homeowner
much easier, and allows to keep upgrading to the latest lifestyle technology. Home automation
LITERATURE REVIEW: CHAPTER 2
frameworks can associate motion detectors, surveillance cameras, automated entryway locks, and
other substantial safety efforts all through the home so
Page | 1
INTRODUCTION: CHAPTER 1
one can enact them from one cell phone before making a beeline for bed. It will
provide security cautions on different gadgets relying upon the time of day an alarm goes off, and
watch activities continuously whether someone is in the house or most of the way around the
world. A very important part of this security virtue of home automation is keeping surveillance
through cameras and survilliance on the entryway automated and which can be only open by
certain identities which are granted permission to enter. For this doing face recognization where if
the face is recognized then the door will open otherwise not. In this proposed scheme face
recognization which generally involves two stages which are face detection and then face
recognization is done. Face Detection where the picture is searched to feed a face, then the picture
is processed to crop and extract the person’s face for easier recognization. Face Recognization is
the part where that detected and processed face is compared to a database of known faces, to
decide who that person is. Here face detection is performed on Intel’s open source framework
called OpenCV. OpenCV (Open Source Computer Vision) is a library that can be imported in
almost all computer languages like python, C, Java etc. python. Raspberry pi-cam has been used
to capture the picture of the faces that we are going to store in the database. Here in this proposed
scheme one will basically go through three stages which are face detection, data gathering(where
we will click picture of the faces of the respective identities) and the final stage is going to be the
face recognization part which will match the live faces with the pictures of the faces in the database
and give us the identification details of the given entity and work further for extra requirements. If
the matching index is 50% or more then only it can be said that it is a successful facial
recognization process. OpenCV has got lot of algorithms but in this particular project. Here Haar-
Cascade algorithm Haar Cascade Algorithm has been used mainly. This whole setup is done on
the operating system of Raspberry Pi which is known as Raspbian. Python has been used here as
the platform to perform the functions and keeping OpenCV the main domain. Finally home
automation can be summed up as the most convenient form of modern day technology. Home
automation is actually a mixture of a lot of virtues coming together like safety, control, comfort,
2|Page
LITERATURE REVIEW: CHAPTER 2
convinience and most importantly peace of mind. This form is a very flexible form of technology
which is growing in the market very rapidly and is on the upsurge for being a game changer in the
field of modern day automation.
Page | 2
The idea of home automation has been revolving around for around for some time.
It’s very recent that actual smart homes have come into existence. Keeping in mind the advantages
related to home automation research and development projects already started from a long time
back but due to the absence of standard networking of the home appliances nobody could move
forward with this concept. The major roadblock was removed in 1992 with the development of the
consumer electronic bus by Electronics Industries Association of America. The CEBus standard
includes specification for a layered network architecture based on open system interconnection
model with network layer protocols for the physical, Data Link, Network layer and application
layer [1]. A proposed scheme by Cross & Douligeris states that fiber optics might be the best
medium for home automation network because with fiber, the limitations of the home automation
system can be reduced and capabilities can be increased to include many more functions, leading
to complete home integration. They observed that although CEBus includes fiber optics as one of
the physical media but it is not specifying the configuration of the fiber optic network. After that
they designed a fiber optics network which offered various advantages such as (i) increased
bandwidth, (ii) immunity to electromagnetic noise, (iii) ease of installation, and (iv) safety from
electric shock hazards. There were a few drawbacks as well that the cost was high and as fiber
optics cannot carry direct current they had to use an alternate source of energy [2-3]. In early 1990s,
the consumer electronics devices was evolving into digital format, henceforth the need was felt to
interconnect these home appliances through digital links to preserve the fidelity of information
transmitted. Chen proposed a home automation network which will serve the above purpose. Other
than the digital link main feature of the proposed home automation network was the Digital access
system which due to which the home automation network could communicate and with the outside
3|Page
LITERATURE REVIEW: CHAPTER 2
world also. Chen researched the use of IEEE 1394 for the proposed network as it could handle
both data and isochronous traffic well at a data rate above 100 Mbps [4]. Fujieda sensed for thriving
and achieving complete marketability. Home networks should be installed easily which will
require network buildup without extra wiring. Therefore he proposed the scheme for wireless
media in home networks and named it as wireless home networks. Fujieda suggested the use of
400MHz special low
4|Page
LITERATURE REVIEW: CHAPTER 2
power band for wireless home networks. He developed a small and low power
microwave oven, air conditioner and washing machines, Bluetooth access point and home terminal
in a home. All appliances had the Bluetooth unit embedded within them and wee connected to
internet [5]. In 2005 Hayong Oh and others, mentioned the importance of energy efficiency for the
routing scheme of the sensors placed at home. In the upcoming automated home, sensors are
required to be placed everywhere in the house which will collect various physical data such as
temperature, humidity, and light to provide information to various appliances. The authors
discussed that in the conventional sensor routing scheme every sensor node detects an event and
then broadcasts the event to all sensor nodes within one hop range from where all the nodes
broadcast the message to the next nodes. This process is repeated until the event reaches the base
station. This scheme generally cause drainage of battery power and the batteries have got limited
power so the routing scheme needs to efficient enough for successful implementation of home
networking. Henceforth they advised a new sensor routing scheme for home automation networks
and called it as RDSR (Relative Direction based Sensor Routing). This scheme divides the home
area into sectors and locates a manager node to each sector. The sensor devices transfer the data to
manager nodes in its sector and then the data is transferred to the base station through the shortest
path of two dimensional coordinates resulting in an energy efficient scheme [6]. In 2006 Mario
Kolberg and Evan [Link] mentioned the control of complex networked appliances. Presently
computer interface is most used to configure and remotely control these appliances. However the
authors discussed that this will be unsuitable for the target audience who are not that much familiar
with the use of computers. Therefore they proposed Anoto-enabled pen and paper as a suitable
alternative as users are highly familiar with pen and paper and they will find it suitable for control.
In the suggested system data is transferred to the service provider through
Bluetooth communication and mobile processed and sent to the user’s home. Using
this approach appliance can be controlled in the home and outside the home [7].
In recent years the Internet of Things (IOT) have enabled innovation to make daily
lives easier and comfortable. From refrigerators, to apparatuses, to home security and many others
can be controlled with smart home innovation. When home devices are remotely controlled from
anywhere irrespective of anything through internet it becomes a important virtue of the IoT
5|Page
LITERATURE REVIEW: CHAPTER 2
(Internet of Things). Security and living greener are the main features of the present homes. Current
patterns in home automation includes remotely controlled appliances and computerized gadgets,
portable/email/content warnings, and remote video observation Sensors are the most important
part of this home automation system as it acts as the eyes of the system. There are sensors for an
extensive variety of uses, for example, measuring temperature, dampness, light, fluid, and gas and
recognizing development or commotion. In case of Java Based Home Automation System the
World Wide Web is used by the home appliances to control and monitor then the software engine
is written in Java code that can be portable and also can be used on any platform. The embedded
system board is connected to the pc home server and serves the java pages and java beans [8]. In
case of the Integrated Residential Gateway Controller for Home Energy Management System, high
performance is derived from compact OS and to reduce the memory space than the three steps plug
& player mechanism is used for reducing installation engineering [9]. In case of the Remote
Controller for Home and Office Appliances by Telephone, the home based design and the
development of the phone based remote controller for the home and office automation, in this
advanced technique the remote controller is used for time and energy consuming [10]. The
verification of the proposed algorithm, several LED’s were used to indicate the proper execution.
The Rpi has received an email through the user from a system connected to the internet. Gmail has
been used in order to conduct mail communication. The corresponding results were generated by
a series of e-mail communication. For example an E-
mail sent as “ON=1 ON Time=7:00. OFF Time=8:00 to the RPi account from the
user account. The algorithm that is used starts its process by scanning the mail [11]. According to
R.A. Ramlee, smart home system via Wireless Bluetooth is the is the new virtue of this automated
technologies where it is acting as a motivation for disable persons making it possible for them to
carry out the daily activity, safely and comfortably [12]. Girish Birajdar and Shrikant Mahindrakar
have developed a way in to automate home appliances using an Embedded Web Server combined
with a Raspberry Pi. Embedded Web Server (EWS). is the embedded system which can serve the
web documents on request from the client. It generally deals with management of dynamic content
and is very easy to use and operates at a fast speed. EWS design includes a complete web server
with TCP/IP support, running different OS, memory, application wise [13].
6|Page
LITERATURE REVIEW: CHAPTER 2
Android based home automation makes the system more flexible and provides
attractive user interface compared to other home automation systems. In this system mobile
devices are integrated into home automation systems. A novel architecture for a home automation
system is proposed using the relatively new communication technologies. The system consists of
mainly three components is a Wi-Fi module, raspberry pi board and relay circuits. Wi-Fi is used
as the communication channel between android phone and the raspberry pi board [14].
Face detection is one of the current research topics in the computer vision field. It
is very easy for human beings to detect faces on the other hand it is difficult for computers to detect
faces.. The difficulties associated with face detection are variations in scale, pose, orientation,
lighting condition, facial expression etc. Many approaches have been implemented but each has
its own advantages and limitations. The proposed system is relay on the appearance based
approach. Here the face detection is done by extracting facial features like eye feature, bridge of
the nose feature, mouth feature etc. which are present in a grey scale image. These features are
proportional to the change in contrast values between adjacent groups of pixels but not to the
intensity values of a pixel. The features used in this system are named as rectangular features and
are reminiscent of Haar basis functions [15] [16]. The suggested face detection system detects the
faces with low false positive rate. Initially the face detection is done with 10 and 12 stage detector
but it gives poor detection accuracy and high false positive rate. The 14 stage detector gives good
accuracy in face detection and very low false positive rates. The detector works well on Raspberry
Pi with a 5MP camera and detects the faces of captured image with the lowest resolution of
640x480 and the highest resolution of 2560x1920pixels with acceptable detection speed [17]. Patel
and shah introduced a research on facial feature extraction techniques for automatic face
annotation. A vital role is being played by automatic face annotation role in multimedia
information. The method to identify human faces from image and assign appropriate human name
is known as automatic face annotation. In face annotation face detection and face recognition are
the two most important virtues. An author also discuss the phases of the automatic face annotation
and surveyed various techniques of facial feature extraction [18]. Patoliya and Desai developed
ATM Security System using Embedded Linux Platform which is being based on the face detection
system. Raspberry pi is being used for the implementation of this system with the extended
7|Page
LITERATURE REVIEW: CHAPTER 2
capabilities of Computer Vision (OpenCV) software which is used for Image processing operation.
One tine password technique is used in this system which increases the security of the system. In
an unauthorized condition ATM door has been locked and it’s only when the OTP password is
entered my watchman [19]. Heshmat et al. introduced Face Identification system in Video. An
author proposed CIE-Luv color space, facial feature extraction and variance estimation. In
surveillance, human machine interfacing, Database management system can be implemented and
is of great use as it is creating a proper visual interface here. The experimental results shows the
efficiency and the usefulness of the system where the system can recognize different faces and
work accordingly and this one is highly advantageous due to it high security advantages [20].
Intensive research work and detailed study on implementation of smart door lock system using
GSM network by Jie-Ci Yang [21]. Pi Camera Module is a add on with Raspberry Pi which acts
as a visual interface in case of face detection or Recognization, This interface uses the dedicated
CSI interface, which was designed especially for interfacing to cameras [22]. An algorithm known
as Haar Cascade classifier is used for detection of the object which it has been trained for, from
the source. This proposed system uses Haar Cascades classifier as a face detection algorithm [23].
Face preprocessing is the module which lessens the issues that makes the image vague to perceive
the face. for example, less brightness and complexity issues and noise in the picture and ensure the
facial highlights dependably be in a consistent position. In this task we use histogram leveling for
face preprocessing. For proficiency we utilize separate preprocessing which is histogram evening
out for left and right face. So histogram leveling is completed multiple times, right off the bat for
the entire face and the other two for side appearances [24]. For better working, each stage of the
cascade must have a low false negative rate, because if the actual object is classified as a nonobject,
then the classification of that branch stops, with no way to correct the mistake made. However,
each stage can have a relatively high false positive rate, because even if the n-th stage classifies
the non-object as actually being the object, then this mistake can be fixed in n+1-the and
subsequent stages of the classifier[25-26]. The purpose or objective of the suggested work is to
implement a working model of a smart door and to give solutions to the problem faced by people
in day to day incidents of burglary or losing the key and also to promote and ignite the work being
done on IOT systems and implementing it with the help of key research areas of Neural Networks
and IoT APIs and protocols[27].
8|Page
LITERATURE REVIEW: CHAPTER 2
After the detailed study of the previous works, here in this proposed scheme
developing a home automation system using a Raspberry Pi with which one will be able to control
home appliances and the most important virtue of this project will be the home surveillance where
the face recognization technology which will be used as a part of security in this project. The main
platform which is being used is OpenCV which is a open source computer vision library a part of
python and will be used in Python.
9|Page
OVERVIEW OF THE PROJECT: CHAPTER 3
Miniature Door
Pi Camera LED
• RASPBERRY Pi
• RASPBERRY Pi CAMERA
• 4 CHANNEL 2 SLOT RELAY
• DC MOTOR
• LED
• BREADBOARD
• CONNECTING WIRES
• MINIATURE DOOR
10 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
Camera
slot Pi camera
Raspberry pi
GPIO DC Motor
Relay LED
Here one can see that the Pi camera is attached to the camera slot and the DC motor
and Relay is attached to the GPIO pins of the Raspberry Pi. As it is a two channel relay so it is
connected to the LED and the DC motor which helps in driving the DC [Link] the DC motor
drives a miniature door which is being used for a door locking system for surveillance purposes.
The door only opens after a successful recognization process, when the face is stored previously in
11 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
the database and that image has got the access to open the door then it will work otherwise it won’t
open.
CHAPTER 4: COMPONENT DESCRIPTION
Figure3:Raspberry Pi
In the above figure no.3 the Raspberry Pi is a low priced, small sized computer that
plugs into a computer monitor or TV, and uses a normal peripherals like keyboard and mouse. It is
a capable little device that enables people of all ages to explore computing, and to learn how to
program in languages like Scratch and Python. It’s capable of doing everything you’d expect a
desktop computer to do, from browsing the internet and playing high-definition video, to making
spreadsheets, word-processing, and playing games. The Raspberry Pi was first launched in 2012,
and there have been a few changes and variations performed from that point forward. The first Pi
had a single core 700MHz CPU and simply 256MB RAM, and the most recent model has a quad-
core 1.4GHz CPU with 1GB [Link] over the world, individuals use Raspberry Pi to get the skills
of programming abilities, , do home automation, and even use them in modern [Link]
Raspberry Pi works in the open source environment: it runs Linux (diverse distribution), and its
12 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
principle supported working system, Raspbian, is open source and runs a suite of open source
programming. The Raspberry Pi Foundation adds to the Linux part and
13 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
different other open source extends just as releasing its very own lot programming
as open source.
Here Raspberry pi is being used as a main controller to derive other features like
face recognization and detection which we are doing in our project.
14 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
Voltages:
Two 5V pins and two 3V3 pins are present on the board, as well as a number of
ground pins (0V), which are unconfigurable. The remaining pins are all general purpose 3V3 pins,
meaning outputs are set to 3V3 and inputs are 3V3-tolerant.
Outputs:
A GPIO pin designated as an output pin can be set to high (3V3) or low (0V).
Inputs:
A GPIO pin designated as an input pin can be read as high (3V3) or low (0V). This
is made easier with the use of internal pull-up or pull-down resistors. Pins GPIO2 and GPIO3 have
fixed pull-up resistors, but for other pins this can be configured in software. The GPIO pins can be
used for other functions also. Some are available on all pins and others on some specific pins.
The Pi camera comes with a flex cable. The flex cable is inserted into the connector
which is located between the Ethernet and HDMI port with the silver connectors facing the HDMI
port. The flex cable connector is opened by pulling the tabs on the top of the connector upwards
then towards the Ethernet port. The flex cable then is inserted firmly into the connector. The top
part of the connector then is pushed towards the HDMI connector and down, while the flex cable
is held in place. Here the Pi camera is being utilized for the face detection and the face
recognization process where firstly are captured and stored it in the database using python and then
again using the camera while the automation and the surveillance part.
16 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
This is a LOW Level 5V 2-channel relay interface board, and each channel needs
a 15-20mA driver current. It is used to control various appliances and equipment with large current.
It is equipped with high-current relays that work under AC250V 10A or DC30V 10A. It has a
standard interface that can be controlled directly by microcontroller. Relay is being used here as a
driver circuit to drive other appliances through the relay.
FEATURES:
• Relay maximum output: DC 30V/10A, AC 250V/10A.
• 2 Channel Relay Module with Optocoupler LOW Level Trigger expansion board,
which is perfect with arduino.
17 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
INPUT:
• VCC: Connected to positive supply voltage
• GND: Connected to negative supply voltage
• IN1: Signal triggering terminal 1 of relay module
• IN2: Signal triggering terminal 2 of relay module
OUTPUT:
• There is one NC(Normal-close), NO(Normal-open) and COM(common) in each
sub-modular of the relay so there are 2NC,2NO and 2COM.
18 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
• Connect the signal terminal IN2、IN1 of 2-channel relay to port 17、18 of the
2-channel relay-----------------Raspberry Pi
IN2-----------------------17
IN1-----------------------18
19 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
4.4 DC MOTOR:
20 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
scheme the DC motor is connected to the relay and drives the miniature door after successful
recognization process.
A light-emitting diode (LED) is a semiconductor light source that emits light when
current flows through it. Electrons in the semiconductor recombine with electron holes, releasing
energy in the form of photons. Here the light emitting diode is used just post face recognization
21 | P a g e
COMPONENT DESCRIPTION: CHAPTER 4
where it will indicate whether the face is recognized. If the face is recognized the LED (Light
Emitting Diode) will glow otherwise it will not glow which will in turn unlock the door.
22 | P a g e
METHODOLOGY: CHAPTER 5
METHODOLOGY
23 | P a g e
METHODOLOGY: CHAPTER 5
Step2 (install dependencies): The first step is to update and upgrade any existing
packages.
unzip [Link]
24 | P a g e
METHODOLOGY: CHAPTER 5
Before the start of compiling OpenCV on our Rasapberry Pi 3,one needs to install
a python package manager
Creating a Python virtual environment that will be used for computer vision
development Python2.7 is used.
mkvirtualenv cv -p python2
In the event that Raspberry Pi is ever booted; log out and log back in; or open up
another terminal one needs to utilize the "workon" order to re-get to the "cv" virtual environment.
source ~/.profile
workon cv
25 | P a g e
METHODOLOGY: CHAPTER 5
The only Python dependency is NumPy, a Python package used for numerical
processing:
OpenCV needs to be compiled and installed .First one should check whether one
is in the virtual environment then “execution of the command “workon” will be done.
workon cv
After being sure that one is in the “cv” virtual environment then one needs to setup
the build using CMake.
26 | P a g e
METHODOLOGY: CHAPTER 5
cd ~/opencv-3.3.0/
make -j4
ls -l /usr/local/lib/python2.7/site-packages/
total 1852
cd ~/.virtualenvs/cv/lib/python2.7/site-packages/
ln -s /usr/local/lib/python2.7/site-packages/[Link] [Link]
27 | P a g e
METHODOLOGY: CHAPTER 5
Open a new terminal, execute the source and workon commands, and then finally
attempt to import the Python + OpenCV bindings.
source ~/.profile
$ workon cv
$ python
>>> cv2.__version__
'3.3.0'
• Face Recognition
Step1: Instaling OpenCV 3.3.0
28 | P a g e
METHODOLOGY: CHAPTER 5
After the installation of open cv library, the first and foremost thing is to test
whether the pi camera is working properly or not. If the camera is properly installed the to
ongoing steps are to be performed. The camera must be aligned in the correct manner to detect
and recognize the features of the face.
Detecting faces and after that gather data. The most common way to detect faces
is by using Haar Cascade Algorithm. In this algorithm real time face detection is performed.
Step5: Trainer
On this second phase, we must take all user data from our dataset and "trainer" the
OpenCV Recognizer. This is done directly by a specific OpenCV function. The result will be a
.yml file that will be saved on a "trainer/" directory.
Step5: Recognizer
Here capturing a face will be done on the camera and if this person had his face
captured and trained before, our recognizer will make a "prediction" returning its id and an index,
shown how confident the recognizer is with this match.
Here face recognization has been done using one kind of classifier which is known
as Haar Cascade classifier. In this process of face recognition the most important part is of image
processing. Image processing is a numerically serious task and one of the greatest territories of
29 | P a g e
METHODOLOGY: CHAPTER 5
research for a major information field. It is a procedure on the picture to change it into desired
looking or which the info is a picture and the output might be a picture or set of characters related
with the specific picture. It alludes to variety of techniques that are utilized to augment the data
output from an image.
It is basically a classifier which is being used to detect objects for which it has been
trained for. First and foremost, the algorithm needs a lot of positive pictures and negative pictures
to prepare the Haar cascade classifier. Positive pictures are pictures with clear faces where negative
pictures are those with no countenances. Each feature is represented as a single value obtained
from the difference of the sums of pixels in white rectangle from the sum of all pixels in the black
rectangle. All different possible sizes and locations of classifier is used for calculating of plenty of
features. As the number of classifiers increase the arithmetic computations seems to take a long
time. Instead of it, the concept of Integral Image has been used. Image Processing Integral image
is a data structure which is a summed area table and algorithm for quickly and efficiently
generating sum of values in a rectangular grid subset. To avoid the complex calculation we use
Adaboost machine learning algorithm, which is inbuilt in OpenCV library that is cascade classifier,
it eliminates the redundancy in the classifiers. Any classifier which has a probability of 50% of
more in detection is treated as weak classifier. The Sum of all weak classifier gives a strong
classifier which makes the decision about detection. Classification takes place in stages, if the
selected region fails in the first stage, we discard it. One doesn’t use the classifiers on that region
which is discarded. The region which passes all the stages i.e. all strong classifiers is treated as the
detected face. Detected Faces are passed to the Face recognition phase. Local Binary Patterns
histogram algorithm (LBPH) has been used for face recognition. Local binary patterns are simple
at the same time very efficient texture operator which assigns the pixels of the image by comparing
with the adjacent pixels as threshold and which results in a binary result.
• EDGE FEATURES
• LINE FEATURES
30 | P a g e
METHODOLOGY: CHAPTER 5
• CENTER-SURROUND FEATURES
• SPECIAL DIAGONAL LINE FEATURES
a) EDGE FEATURES:
b) LINE FEATURES:
31 | P a g e
METHODOLOGY: CHAPTER 5
c) CENTER-SURROUND FEATURE:
32 | P a g e
METHODOLOGY: CHAPTER 5
In this proposed scheme it has been decided to bring on a normal dc motor and
connect it with a relay which will be connected to the main controller Raspberry Pi. The DC Motor
will also connected to any of the pins of Raspberry Pi. DC motor here is helping the miniature
door to open after the face is recognized in Face Recognization process. This whole system is a
post part of the surveillance of Home automation.
33 | P a g e
RESULTS AND DISCUSSIONS: CHAPTER 6
34 | P a g e
RESULTS AND DISCUSSIONS: CHAPTER 6
In figure no 15 the whole system is depicted where one can see there is a box like
structure which is holding the Pi camera upright so it could take clear and proper pictures for the
purpose of face recognization.
35 | P a g e
RESULTS AND DISCUSSIONS: CHAPTER 6
36 | P a g e
RESULTS AND DISCUSSIONS: CHAPTER 6
The above figure is the outcome of the Face Recognization. This picture is taken
by the Raspberry Pi camera which is used for the face recognization. Firstly taking the pictures and
storing it in the database then during the recognization process the outcome shows the name of the
identity if it is stored in the database and it also shows the matching index which is previously
mentioned that if it is 45% or more then it is successful otherwise not. Here clearly it is not the case
as the matching index is showing 29.0%.
37 | P a g e
RESULTS AND DISCUSSIONS: CHAPTER 6
In the above figure it is the output of the face recognization and the person is
identified properly. The matching index here is 44% which is almost 45% (the desired matching
index) so one can say here that it is approximately successful.
38 | P a g e
RESULTS AND DISCUSSIONS: CHAPTER 6
In the above figure one can see that one face is being recognized as it is stored in
the database and another face is not properly recognized and is showing “Unknown “from here one
can conclude that if the face is not stored in the database previously then the face won’t be
recognized and will show unknown
In this proposed scheme it has been already decided to introduce a smart door lock
system where a miniature door will be used. The door will be driven by a DC motor which will be
driven by a relay. the Pi camera is attached to the camera slot and the DC motor and Relay is
attached to the GPIO pins of the Raspberry Pi. As it is a two channel relay so it is connected to
39 | P a g e
RESULTS AND DISCUSSIONS: CHAPTER 6
the LED and the DC motor which helps in driving the DC motor .Here the DC motor drives a
miniature door which is being used for a door locking system for surveillance purposes. The door
only opens after a successful recognization process, when the face is stored previously in the
database and that image has got the access to open the door then it will work otherwise it won’t
open.
40 | P a g e
CONCLUSION AND FUTRURE WORKS: CHAPTER 7
41 | P a g e
REFERENCES: CHAPTER 8
security. Facial recognition is an extremely viable apparatus that can help law masters perceive
offenders and programming organizations are CONCLUSION AND FUTRURE WORKS:
CHAPTER 7
utilizing the innovation to enable clients to get to their innovation. This innovation
can be additionally created to be utilized in different roads, for example, ATMs, getting to secret
documents, or other touchy materials. This can make other safety efforts, for example, passwords
and keys old. Another way that trend-setters are hoping to execute facial acknowledgment is inside
trams and other transportation outlets. They are hoping to use this innovation to utilize faces as
charge cards to pay for your transportation expense. Rather than setting off to a stall to purchase a
ticket for an admission, the face acknowledgment would take your face, run it through a
framework, and charge the record that you've recently made. This could conceivably streamline
the procedure and advance the stream of traffic definitely.
[1] Electronics Industries Association, Consumer Electronics Group, EIA Home Automation
System: EIA/Is-60, EIA ,1992.
[2] D.L. Cross, C. Douligeris; “A Fiber Optic Home Automation System”, IEEE Transactions on
Consumer Electronics, Vol. 39, No. 3, August 1993,pp. 636-645.
[3] C. Douligiris; “Intelligent Home Systems” IEEE Communication Magazine, October 1993,
pp. 52-61
42 | P a g e
REFERENCES: CHAPTER 8
[4] W.Y. Chen; “Emerging Home Digital Networking Needs”, Proc. 4th IEEE Int. workshop on
Community Networking, Atlanta, 1997, pp. 7-12..
[5] H. Fujieda, Y. Horiike, T. Yamamoto and T. Nomura; “A Wireless Home Network and its
Application Systems”, IEEE Transactions on Consumer Electronics, Vol. 46, No.
2, May 2000, pp. 283-290.
[6] [Link], [Link], K.J. Chae; “An Energy-Efficient Sensor Routing Scheme for Home
Automation Networks”, IEEE Transactions on Consumer Electronics, Vol. 51,
No.3, August 2005.
[7] Mario Kolberg & Evan H. Magill; “Using Pen and Paper to control Networked Appliances”,
IEEE Communications Magazine, November 2006, pp. 148-154.
[8] Al-Ali A. R and Al-Rousan M., "Java-based home automation system", IEEE Transactions
on Consumer Electronics, vol. 50, 2003,no. 2, pp. 498-504.
[11] Narendra M and Vijaylakshmi M,"Raspberry pi based advanced scheduled home automation
system through E-mail", Chennai, 2014.
43 | P a g e
REFERENCES: CHAPTER 8
[12] [Link], [Link] dan [Link](2012), “Smart Home System For Disabled
People Via Wireless Bluetooth”, IEEE International Conference on System
Engineering and Technology ,pp. 978-983,2012.
[13] [Link] and [Link], “Embedded web server based home automation using
raspberry pi”, International Journal of Modern Trends in Engineering and Research, vol. 1,
no.5 ,,India,September2014.
[15] Paul Viola and Michael Jones, “Rapid object detection using boosted cascade of simple
Features”, IEEE Conference on Computer vision and Pattern Recognition, 2001,
Vol.1,pp. 511518.
[16] C. Papageorgiou, M. Oren and T. Poggio, “A general framework for object detection”,
InInternational Conference on Computer Wsion, Bombay, Jan 1998, pp. 555-562.
[17] N.V. Naik, [Link] and Kumara .K .R,"Face Detection on Open CV using Raspberry
Pi", Department of ECE,GSIT, Karwar, Karnataka, IJEECS, volume6, 2017.
[18] [Link] and [Link], “A Survey on Facial Feature Extraction Techniques for Automatic Face
Annotation”, IEEE International Conference on Innovative Mechanisms for
Industry Applications (ICIMIA),Bangalore, India, 2017.
[19] J.J. Patoliya and M.M. Desai, “Face Detection based ATM Security System using
Embedded Linux Platform”, IEEE 2017 2nd International Conference for
Convergence in Technology (I2CT),Mumbai, India,2017.
44 | P a g e
REFERENCES: CHAPTER 8
[21] J.C Yang, "An Intelligent Automated Door Control System Based on a Smart Camera".2012.
[22] W. F. Abaya, J. Basa, M. Sy, A. C. Abad and E.P. Dadios, "Low cost smart security camera
with night vision capability using Raspberry Pi and OpenCV," 2014 International Conference
on
Humanoid, Nanotechnology, Information Technology, Communication and
Control,
Environment and Management (HNICEM), Palawan, 2014, pp. 1-6
[23] P.Pasumarti1, P. P. Sekhar “Classroom Attendance Using Face Detection and Raspberry-Pi”
International Research journal of Engineering and Technology (IRJET), Volume: 05 Issue:
03. p3-p5,Mar-2018
[24] [Link], [Link], “Automated attendance using Raspberry pi”, International Journal
Of Pharmacy & Technology (IJPT), Vol. 8, No. 3, pp. 16214-16221, September
2016.-
[27] [Link], [Link] and [Link] A Review: Face Detection Methods And Algorithms,
International Journal of Engineering Research & Technology (IJERT) ISSN:2278-0181
[Link] Vol. 2 Issue 6, June – 2013.
45 | P a g e
DATASHEETS
1 Introduction
5 Pin Assignments
GPIO2GND 79 108
GND
GPIO3GPIO4GPIO5GPIO6GPIO7
13191121152317
20141618241222
46 | P a g e
DATASHEET
S
GND
GPIO9 3729
32303436
31
GPIO10GPIO11GND 333541 KEY
384042
GPIO0GND-27_VDD 39
GPIO28-45_VDD
GND
GPIO13GPIO14GPIO15 495547535751
50565860485452
GPIO16GPIO17GND 59
GPIO20GPIO21GPIO22GPIO23GND
72
7369757771 74 707678
GND
GND
DSI0_DN1GPIO25GPIO26GPIO27
85918387958993
86
928884909496
GND
DSI0_DP1
DSI0_DP0
101105 102
DSI0_CNDSI0_CPGND 103107113111
110104106108112114
HDMI_CLK_NGND 109
HDMI_CLK_P
47 | P a g e
DATASHEET
S
HDMI_D2_P
CAM1_DN3
139137141147149
140146138148150
CAM1_DP2CAM1_DN2GND 145143
142144
CAM1_CNCAM1_CPGND
CAM1_DN1
155161165167
156162158160
CAM1_DP0CAM1_DN0GND 157159
164166168
USB_DPUSB_DMGND 163
HDMI_CECHDMI_SDAGND 169171173
170174176178172
HDMI_SCL
175177 RUN
GND
181 182 EMMC_DISABLE_N
NCNC
1V8 183 184
SDX_
1V8 VDDSDX_VDD
185 186
GND
187 188
GND
195 196
48 | P a g e
DATASHEETS
SDX_D3 GPIO28GND
GND
CAM0_DP0GND
GPIO0GPIO29GPIO30GPIO31-27_VDD
GND CAM0_DN0CAM0_DN1CA
M0_DP1CAM0_CPCAM0_
GPIO28-45_VDD
G CN
PIO32GND
GPIO33
GND
GND
G
PIO34GPIO35GPIO36G
PIO37GND G
ND
GND N
C
GPIO38GND
GPIO39GPIO40GPI
USB_OTGIDTVDACGNDNCNCNCNC
O41
GND
VC_TRST_NGND
G
PIO42GPIO43GND
V
GPIO44GND C_TMSVC_TDOVC_T
DIVC_TCK11VV88
HDMI_HPD_N_1V8GPIO45
GND
GND EMMC_EN_N_1V8
DSI1_DP0DSI1_DN0GND G
NDVDAC
DSI1_CPGND 3
3VV33
DSI1_DP3DSI1_DN3DSI G
NDVBAT
V
BAT
1_DP2DSI1_DN2DSI1_C
GND
GND
DSI1_DP1GND
DSI1_DN1NCNCNCNC
GND
49 | P a g e
DATASHEETS
Table 2: Compute Module 3+ SODIMM Connector Pinout
Table 2 gives the Compute Module 3+ pinout and Table 3 gives the pin functions.
6 Electrical Specification
Caution! Stresses above those listed in Table 4 may cause permanent damage to the
device. This is a stress rating only; functional operation of
DATASHEETS
51 | P a g e
Python and its libraries, like OpenCV, play a pivotal role in developing smart home systems by supporting functionalities such as image processing for facial recognition . Python's flexibility and extensive library resources allow developers to implement sophisticated algorithms efficiently, making it ideal for integrating various sensors and processing units within smart home setups . The language's capability to run on multiple platforms ensures the system's scalability and adaptability .
The use of open-source libraries such as OpenCV in home automation enhances face recognition capabilities by providing a range of optimized algorithms for tasks like face detection and recognition . OpenCV allows for flexibility and portability in system design, facilitating the integration of advanced image processing features, such as Haar classifiers and LBPH face recognizers . This can improve system accuracy and performance through techniques like color processing and edge detection .
Advancements in communication technologies like wireless LAN, cellular networks, and the Internet have significantly impacted home automation by enabling remote control capabilities . The development of Bluetooth-enabled appliances and the use of embedded web servers have facilitated seamless connectivity and control, contributing to more efficient and user-friendly systems . These technologies support the integration of IoT, expanding the potential for automation and device interaction .
The integration of IoT with home automation transforms modern living spaces by allowing remote control and monitoring of appliances, leading to increased convenience and security . IoT facilitates the creation of smart ecosystems, enabling functionalities such as real-time energy management, automated surveillance, and seamless device communication . This transformation also supports greener living through efficient resource usage and innovative security measures .
Sensors are crucial in home automation systems as they act as the system's 'eyes', allowing for the monitoring of various environmental factors like temperature, humidity, and light . They are essential for collecting data to enable appliances to function intelligently and efficiently . Sensors also play a key role in security and energy management, supporting remote control and notifications for surveillance purposes .
Existing home automation interfaces often rely on computer interfaces, which may not be user-friendly for everyone, especially those unfamiliar with computers . Recent research has proposed alternatives like Anoto-enabled pen and paper, which are more familiar and accessible to a broader audience . This approach allows data transfer through Bluetooth, enabling control both inside and outside the home .
Facial recognition technology in home automation significantly enhances security by allowing systems to authenticate individuals based on stored images in a database . This reduces the reliance on traditional methods such as passwords and keys, which can be less secure. However, it requires precise matching indices for successful recognition to prevent unauthorized access, as shown when a matching index below 45% is deemed unsuccessful .
Energy efficiency in sensor-based home automation is critical due to the limited battery life of sensor nodes . Traditional routing schemes can drain power as every sensor node broadcasts events to neighboring nodes. The Relative Direction based Sensor Routing (RDSR) divides the home area into sectors managed by nodes, optimizing the data transfer path to the base station using two-dimensional coordinates . This reduces energy consumption, enhancing the sustainability of home networks .
Smart home systems enhance the daily lives of people with disabilities by automating routine activities and enabling remote control of appliances, providing comfort and safety . Technologies like wireless Bluetooth allow different devices to be controlled through voice commands or smartphones, facilitating independence for individuals with mobility issues . Automation solutions are also increasingly customized to cater to specific needs, improving accessibility and quality of life .
Home automation offers various benefits including ease of work, increased efficiency, and enhanced security, ultimately improving personal satisfaction . It provides high-tech functionality and convenience by enabling control and management of appliances through one interface, reducing the learning curve for users . Moreover, it is flexible in accommodating new devices, allowing homeowners to upgrade to the latest technologies .