Professional Documents
Culture Documents
Camera Surveillance System
Camera Surveillance System
BY:
SUPERVISORS:
OCTOBER 2021
THE UNIVERSITY OF BAMENDA
BY:
SUPERVISORS:
OCTOBER 2021
©Copyright by ……TAYO IVO ENCHO BARSEH……., 2021
All rights reserved
i
DECLARATION OF ORIGINALITY OF STUDY
ii
CERTIFICATION OF CORRECTIONS AFTER DEFENSE
This is to certify that this project titled “REAL TIME CAMERA SECURITY SURVEY
SYSTEM” is the original work of TAYO IVO ENCHO BARSEH. This work is submitted
in partial fulfilment of the requirements for the award of a Bachelor of Engineering Degree in
Computer Engineering in the National Higher Polytechnic Institute of The University of
Bamenda, Cameroon.
iii
ASTRACT
In our society today, the priority of people is their security in or out of their houses no matter
the time of the day. This security could be against thieves, it could be against fire outbreaks
around the place, it could also be someone crying for help for whatever has happened. In most
developed countries, camera survey systems have been put in place in nearly all streets, houses,
offices, market places, stadiums and even forest to monitor wild life. In this research, we are
going to build such systems but this time with some little advancements like implementing
Artificial Intelligence to detect fire scenes and also identify someone crying for help. The
realisation of this project will be divided into two major parts, software and hardware. The
features extraction part was executed on the hardware device and the output part was executed
on the software. This configuration will allow us to attain a real time processing system with a
good detection of the motion during our survey.
iv
RESUME
Dans notre société d'aujourd'hui, la priorité des personnes est leur sécurité à l'intérieur ou à
l'extérieur de leur maison, peu importe l'heure de la journée. Cette sécurité pourrait être contre
les voleurs, cela pourrait être contre les incendies autour de l'endroit, cela pourrait aussi être
quelqu'un qui crie à l'aide pour tout ce qui s'est passé. Dans la plupart des pays développés, des
systèmes de surveillance par caméra ont été mis en place dans presque toutes les rues, maisons,
bureaux, places de marché, stades et même forêts pour surveiller la vie sauvage. Dans cette
recherche, nous allons construire de tels systèmes, mais cette fois avec quelques petites
avancées comme la mise en œuvre de l'intelligence artificielle pour détecter les scènes
d'incendie et également identifier quelqu'un qui appelle à l'aide. La réalisation de ce projet sera
divisée en deux grandes parties, logicielles et matérielles. La partie extraction des
caractéristiques a été exécutée sur le périphérique matériel et la partie de sortie a été exécutée
sur le logiciel. Cette configuration nous permettra d'atteindre un système de traitement en temps
réel avec une bonne détection du mouvement lors de notre relevé.
v
DEDICATION
This research is dedicated to the TAYO’S family
vi
ACKNOWLEDGEMENT
I would like to offer a hand of applause for the success of this work or research would not have
been possible without the following people.
The first would be my supervisor Dr. NDUKUM PASCALINE and my co-supervisor Mr.
TCHASSO SERGE PAULINE for their immense support, encouragement and being there for
me with endless motivation to hard work which led to the completion of this project.
A big thank you goes to the staff of (N.A.H.P.I) Bambili who guided and made sure the
completion of this project was success.
I will also like to express my level of gratitude to my family who supported and encouraged
me to go through this study. My sincere appreciation for your love, care and sacrifice for
moulding me into a better person.
Additionally, I would like give a shout out to my class mates for the company through the stress
of a better tomorrow. I am happy because seeing you work gave me even more motivation than
I could ever possibly imagine.
I thank the father lord almighty for his endless grace which always gave me the power and
strength to always take a step ahead of my past work.
vii
TABLE OF CONTENT
ASTRACT ................................................................................................................................ iv
RESUME ................................................................................................................................... v
DEDICATION .......................................................................................................................... vi
ACKNOWLEDGEMENT .......................................................................................................vii
1.7.3. SENSORS................................................................................................................ 5
viii
1.9. PARTIAL CONCLUSION ......................................................................................... 7
ix
3.4.6. FLOW CHART OF THE SYSTEM ......................................................................... 36
REFERENCES ........................................................................................................................ 54
x
LIST OF FIGURES
Figure 2. 1 Image of raspberry pi 4............................................................................................ 9
Figure 2. 2 Micro USB port ..................................................................................................... 10
Figure 2. 3 USB ports .............................................................................................................. 11
Figure 2. 4 Ethernet port .......................................................................................................... 11
Figure 2. 5 HDMI ports .......................................................................................................... 12
Figure 2. 6 Camera .................................................................................................................. 12
Figure 2. 7 Buzzer .................................................................................................................... 13
Figure 2. 8 PIR sensor .............................................................................................................. 14
Figure 3. 1 Map of Africa on the left and Map of Cameroon on the right .............................. 15
Figure 3. 2 Map of Tubah ........................................................................................................ 16
Figure 3. 3 The Raspberry Pi showing labelled parts .............................................................. 17
Figure 3. 4 Raspberry Pi Pins .................................................................................................. 17
Figure 3. 5 Buzzer circuit......................................................................................................... 19
Figure 3. 6 PIR circuit .............................................................................................................. 20
Figure 3. 7 LM35 ..................................................................................................................... 21
Figure 3. 8 LM35 light Variation ............................................................................................. 21
Figure 3. 9 Motion Detection ................................................................................................... 22
Figure 3. 10 Code for the Alarm System ................................................................................. 23
Figure 3. 11 Code for Camera System ..................................................................................... 25
Figure 3. 12 Code for night Vision system .............................................................................. 26
Figure 3. 13 Light Variation values ......................................................................................... 27
Figure 3. 14 Code to Capture Pictures .................................................................................... 28
Figure 3. 15 Code for Video Capture System .......................................................................... 29
Figure 3. 16 Remote Access Configuration ............................................................................. 31
Figure 3. 17 Putty Configuration ............................................................................................. 32
Figure 3. 18 Remote Access configuration .............................................................................. 34
Figure 3. 19 Configuration for USB camera ............................................................................ 34
Figure 3. 20 More USB configuration ..................................................................................... 35
xi
Figure 3. 21 Flow Chart for Buzzer ......................................................................................... 37
Figure 3. 22 Flow Chart LED .................................................................................................. 38
Figure 3. 23 Flowchart for Motion Detection .......................................................................... 39
Figure 3. 24 Flowchart for Light Sensing System ................................................................... 40
Figure 3. 25 Flow chart for Capturing Photo .......................................................................... 41
Figure 3. 26 Flow Chart for Recording Video ........................................................................ 41
Figure 3. 27 Photo Security ..................................................................................................... 42
Figure 3. 28 Video Security Process ........................................................................................ 42
Figure 3. 29 Flow Chart of the entire system........................................................................... 43
Figure 4. 1 Results of Motion Detection ................................................................................. 45
Figure 4. 2 Result of Alarm System......................................................................................... 46
Figure 4. 3 Results showing a video captured by the system when motion is detected .......... 47
Figure 4. 4 Result showing Captured Photo ............................................................................ 47
Figure 4. 5 Result of lighting System ..................................................................................... 48
Figure 4. 6 Project Skeleton ..................................................................................................... 49
Figure 4. 7 Project Skeleton with green lighting ..................................................................... 50
Figure 4. 8 Project skeleton with blue lighting ........................................................................ 51
xii
LIST OF ABBREVIATIONS
CPU: Central Processing Unit
GB: Gigabyte
Pi 4: Raspberry Pi 4
xiii
CHAPTER 1: INTRODUCTION
1.1. BACKGROUND OF STUDY
Over the past years, we have seen in Cameroon the existence of camera surveillance in retail
shops, companies, banks and schools. These systems were put in place to report suspicious
activities by recording videos or taking pictures of these scenes. This method of security was
conceived because of the in-ability of the human being to keep watch 24/7 and report truly and
in detail the action of suspicious scenes. Not only were these systems capable of working all
day but they were more efficient and cost less with more productivity as they could keep good
records of activities carried out in a certain location at a particular time.
Camera based surveillance system using the Raspberry pi 4 is mainly beneficial for determining
crime scenes, it monitors scenarios and activities, helps to gather information and evidences
from a crime scene, it is also very useful as the advanced systems can detect and report natural
disasters such as earth quakes, the system is built to monitor homes, offices, remote areas. The
system is designed to report fully and in detail crime scenes by taking pictures and videos of
what exactly happened in a particular place at a particular time. The system uses the raspberry
pi 4 as the central processing unit with a pair of USB cameras for the pictures and videos, also
with PIR sensor for detecting and reporting motion to the processing unit, with the aid of a light
dependent resistor to detect the changes in light intensity and report to the raspberry for further
processing of the images. The cameras are equipped with infrared light emitting diodes which
will improve the vision of the system under low lighting conditions. Finally, the system can be
equipped with internet services to enable access to the cameras from remote locations.
The system constantly monitors the environment for motion and the input is fed to the processor
for corresponding actions. The PIR input is processed by the raspberry and the decision on
taking a picture or a video is decided by the pi. When motion is detected by the system, it
records a video while the motion is happening and the video is stored in the primary storage of
the raspberry pi on a location that is to be accessed by the end user.
1
1.2. PROBLEM STATEMENT
In our society today there is a lot of insecurity, people get to commit crimes and most times
than not, get away with it, the aim of this thesis is to design a camera security survey system
for a building which could be a house or an organisation that is capable of monitoring the
movement of different objects, take videos and pictures of suspicious scenes like a man holding
a gun, someone with the face all covered by a mask, fire scenes and stores them in a database,
and more over be able to send the videos over a network and not all that but be able to see live
videos of the surrounding. The main problem here is, most people now do not want to work to
earn their money, because of this they have to think of other ways of making a living and most
of them turn to engage in illegal practices to make money. This illegal practices can be physical
human harassment, breaking into people’s houses to steal, kidnap and also harm people with
weapons, breaking into public places like banks, “Njangi houses”, small business organisations
like retail shops. Some even go to the level of practicing social engineering attacks (this is a
case where someone uses the identity of another to request useful information or money or
passwords or location of vitals with the use of the victim identity like the phone number, email
address or even a social media account). Most of the time when this act is taking place, there
is little or no security to intervene and so the people who commit such crimes get to go un-
punished.
The project with title “Real time camera security survey system” will use the raspberry pi
computer which is a low cost, credit card sized computer that plugs into a computer monitor,
keyboard and mouse to write interesting programs that can be used to control hardware and the
python programming language pre-installed in the raspberry pi to control a set of cameras to
show a live preview of the environment and also a PIR (Passive Infrared Sensor) sensor which
is capable of detecting motion of different objects to process the images, sound and videos
from the camera to achieve task such as identifying suspicious scenes, identifying unwanted
people in some environment, detect and record motion of moving objects, alert the security.
1.3. RATIONALE
1.3.1. MOTIVATIONS
This is to work to reduce insecurity in our society
This will help me work to improve on the technology in our society.
It is a challenge to think and research more on new security ideas which can
better improve security of an environment.
2
It is a start of specialisation in the computer world.
1.3.2. SIGNIFICANCE
The research in this study is to help reduce the level of insecurity in our society taking into
consideration the fact there are a lot of thieves around, a lot of people practicing human
trafficking, a lot of people into kidnapping and asking for ransom payment before the release
of the individual. This implementation is not to catch the people involved in such practices but
to help the investigation department with the use the footages captured by the camera of that
scene identify and have leads as to where their focus on investigation should be. It can help
them identify people in scene, it can help with videos and pictures of what actually happened
during the scene. In cases of theft, you can be able to identify the thief before he even breaks
into the house or organisation and take special precautions.
3
Specific Research Objectives
4
surveillance process involves the identification of areas of concern and the identification of
specific cameras or group of cameras that may be able to view those areas.
1.7.3. SENSORS
A sensor is a device that detects the change in the environment and responds to some output
on the other system. A sensor converts a physical phenomenon into a measurable analogue
voltage converted to some human-readable display or transmitted for reading or further
processing. There are basically two types of sensors, PASSIVE and ACTIVE SENSORS.
active sensors require an external source of power that provides the majority of the
output of the signal. Some examples of the active sensor based technology include the
scanning electron microscope, the LiDAR, radar, GPS, X-ray, sona, infrared and
seismic.
Passive sensors output power is almost entirely provided by the measured signal
without an excitation voltage. Some examples of the passive sensors include Passive
Infrared sensor used for detecting and reporting motion, film photography, Infrared,
charge-coupled devices and radiometers.
5
1.7.5. DIGITAL CAMERA
A digital camera is a camera that captures photographs in digital memory, however, unlike film
cameras, digital cameras can display images on a screen immediately after being recorded and
also store and delete them from memory. Also many cameras can record video with sound
capture included in its functionalities. (Britanica, 2021)
1.7.6. ILLUMINATION
When a light source is poured on an object, they reflect light so that they can be perceived by
the human eyes. What illumination means is the act of using a light source. The same idea is
used in photography to capture images. (Colbor, 2021)
Chapter 1 is titled “Introduction” is where I will present the background of study, the problem
statement, some research questions and also the objectives of our study. We will also look at
the significance of the study and also the scope with the delimitations if the research. Then we
will end this chapter with definition of some terms used in this context of surveillance systems.
Chapter 2 is titled “Literature Review”. Here we are going to look at some related works, the
generalities involved.
Chapter 3 titled “Material and Methods”. This is where we will see in details the materials
used together with the steps involved in putting together the various hardware components to
function as a single standalone system.
Chapter 4 is titled “Results and Discussions”. This is the stage where we are going to evaluate
the results of the project in every scenario obtained at the end together with some screenshots
of the functionality of the project.
Chapter 5 titled “Conclusion Recommendations and perspectives”. At this final stage, we will
take a look at the summary of the results. We will also have some recommendations for possible
future researchers who will carry out similar research or study. Furthermore, we will present
the difficulties we have encountered throughout the study and implementation of this work.
Then finally we will look at the references used in our main work.
6
1.9. PARTIAL CONCLUSION
This chapter was aimed at introducing the background of study. After taking a look at the
problem statement, we head to evaluating the possible solutions to that problem created. Then
we continue to look at the research questions and also the objectives we have to meet when
designing the system. We also took a glance at the scope and delimitations of the work.
7
CHAPTER 2: LITERATURE REVIEW
2.1. INTRODUCTION
Presently, video surveillance systems are implemented both in public and private areas such as
airports, railway stations, highways, subways, parking lots, plaza stores, shopping malls,
offices, schools, universities and homes. Video surveillance systems have become a part of
modern safety management of public and private sectors and the installation of this systems is
showing no sign of stopping.
A proposed camera security system consisted of an open video equipment, a read image frame
buffer, a video capture, the microcontroller and a PIR sensor to design a video surveillance
system based on a 3G wireless mobile internet access. The database in the video control sever
to automatically store selected frames of the video stream data. A high speed video monitoring
system using the 802.11 in our surveillance system is also recognised. (Shivprased, student,
computer department, Savitribai Phule Pune University, Maharashtra, India)
Another proposed solution on video camera security used the pipeline method where the
processes follow each other. The method starts with the process of Observation Input. This is
where the input from the various sensors are captured and analysed. The second process is the
Object Detection, here the various objects found in the scene are collected and analysed for
detection, after this process follows the Object Recognition which is the stage where the
different objects that were detected are now analysed to recognise them. After this step, Object
Tracking takes place, here the object which is recognised is now tracked, that is follows its
movement. When the tracking is done, the next step is Event Analysis which is the stage where
the activities of the tracked object are analysed. Then follows the Database Archiving which is
where the important data is stored. When all of this processes have taken place, the Alarm
system now comes on based on the input that has been gotten from the other processes.
8
2.3. GENERALITIES
In this project, we will implement a real time camera security survey where cameras will be
placed at sensitive parts of a building, being it a house or a company, with the aim of detecting
and monitoring all moving objects. The system will use a Raspberry pi computer equipped with
the Raspberry Operating system, a set of cameras for photos and video capture, a PIR sensor
for detecting motion of different objects to realise the whole hardware of the security system.
The system will use the following components.
2.3.1 RASPBERRY PI
Raspberry pi is small single-board computer. The Raspberry Pi is a very small computer the
size of a credit card, but it is quite powerful and it can run a lot of applications (halfacree,
2018). With this small size computer as it goes it has a slot to connect your SD card which will
act as the non-volatile memory. It also has four (4) port for connecting mouse or keyboard, a
slot for power supply, for its camera module
9
2.3.1.1. SOME COMPONENTS OF THE RASPBERRY PI 4
a. MICRO USB POWER PORT
The micro USB port is the port used to connect the raspberry pi to power source. Normally a
standard charger will power the PI but when the raspberry pi has soo much work to do like
controlling circuits a motors the standard chargers turns to provide low current. For the best
results, it is good to buy the official PI USB power supply. It will supply a current of 5volts
and 3 Amperes.
The standard PI 4b comes with more redefined USB ports. This time it comes equipped with
four USB ports all of them compatible with input peripherals like the USB keyboard, USB
mouse, USB web camera and so much more. Not only are compatible with most input
peripherals but two of the ports come with USB 3.0 technology equipped which allows for
faster data transfer speeds for up to one hundred megabytes per second. This makes the
raspberry pi four very flexible. Below is a picture of the various USB ports
10
Figure 2. 3 USB ports
c) ETHERNET PORT
This is also known as the network port. It is useful when we want to use a wired connection to
connect the raspberry pi to the internet or to other devices that can share data through the rj45
cable connector. There are two lights at the bottom of the port which is there to indicate the
status of the network.
d) HDMI PORT
HDMI is acronym for High Definition Multimedia Interface. This port is used to transmit video
signals to and external display. Just as the name implies, we can tell that the video output is
11
very high and it carries both sound and video in one medium. It can transmit video for up to
4K resolution. This cable can be used to connect the raspberry pi to external display systems
like a TV monitor, a computer monitor, a projector with HDMI support system or a dedicated
monitor.
2.3.2. WEBCAM
WEBCAM is acronym for Web Camera which is a camera that is used for taking videos in real
time when on an internet call or making a video for local use. The raspberry pi computer has
two ways to which the web camera can be connected to it. Firstly, we can use the standard USB
port to connect the USB web camera to and lastly the raspberry pi computer comes with another
standard slot for connecting the pi camera to it. All of this cameras function the same way.
Figure 2. 6 Camera
12
2.3.3. BUZZER
This is an electroacoustic transducer which is a device that converts electrical audio signal into
its corresponding sound. It can be used to produce alerts for different scenarios in the video
capture scene. It has two terminals one positive and the other one negative, the positive one
supplies current to the Buzzer while the other is connected to and input terminal.
Figure 2. 7 Buzzer
13
Figure 2. 8 PIR sensor
14
CHAPTER 3: MATERIALS AND METHODS
3.1. INTRODUCTION
When doing a research or study, Methods is a systematic way of solving a problem. A research
method is the method used to carry out the study, the reasons for that study an also how that
study helps the economy or the society. Chapter three involves describing in detail the various
steps involved in the research, how you gather the requirements, the coding, the design,
methods, simulation and implementation. At the end of this chapter, we will describe all the
materials used in the research. This chapter will show in depth the heart of our work, with the
fact that it shows the methods used, methods in collection of data, the materials used for the
purpose of this research.
(source: Nations Online Project, 2020) Source: Nations Online Project, 2020)
Figure 3. 1 Map of Africa on the left and Map of Cameroon on the right
15
Figure 3. 2 Map of Tubah
The raspberry pi is a mini computer with the size of a credit card with capabilities like that of
a normal desktop computer system but what makes the difference is that the raspberry pi is
mostly used to build embedded systems with its large range of peripheral devices. The
raspberry pi comes with its hardware dormant until a compatible operating system or a
compatible Raspbian image is flashed into a storage device like a memory card and inserted
into it, then all its hardware components now come on live ready to be used as input and output
devices. The latest version of the Raspbian image is the raspberry pi operating system with
16
kernel version 5.10 released on May 7th 2021 with size of 2867 megabytes.(raspberrypi.org on
August 17th 2021)
To continue with the hardware components of the raspberry pi, it comes equipped with general
purpose input and output pins which are used to send data into and out of the raspberry pi
system. The general purpose input and output pins are generally called GPIO pins which is an
acronym. Below is a figure of the general purpose input and output pins and their numbering.
17
The general purpose input and output pins are accessed with cables which are called Jumper
wires. The jumper wires are of three types depending on the architecture of the how the both
ends look like. The first one is the male to male which has two male head pins, the second is
the male to female with one end equipped with a female port. The last time is female to female
connector with the both ends having female ports.
The raspberry pi also comes equipped with a port called the CSI Camera port which is acronym,
for Camera Serial Interface port dedicated for the raspberry pi. The Camera Serial Interface is
a specification of a mobile industry interface (MIPI) Alliance which define and interface
between a camera and a host processor.
Furthermore, the DSI display port is a port which comes pre-installed with the raspberry. DSI
is acronym for Display Serial Interface which defines a high speed serial interface host between
a processor and a display module. This module is widely used in mobile phones, laptops,
wearables and other embedded systems.
CPU, GPU and Memory are components that must be present with all computer devices. The
CPU is acronym for the Central Processing Unit and just as its name sounds, it is the part of
the computer that takes care of all the instructions to be processed in the system. The GPU
which stands for Graphic Processing System is a part of the computer which takes care of all
the processing that has to do with graphics. Then the memory is available to store data
temporally while all the processing is done by the processor.
Bluetooth is a short range wireless technology standard used for exchanging data between fixed
and mobile devices over a short range. The Bluetooth 4.1 is a technology currently featuring in
headphones such as MEE x7 plus earbuds that can better manage their power and that of the
device they are paired to by automatically powering up and down based on a power plan. This
module comes installed in the pi.
Audio and Video is the module responsible for the transmission of audio and video signals into
and out of the raspberry pi.
18
of silicon. It is made up of a grid of tiny photosites that are sensitive to light. Each photo site
is usually called a pixel which is a contraction of picture element. There are millions if these
individual pixels in the sensor of the camera.
The NE555 integrated circuit produces accurate oscillation or time delays. Moreover, the
interval timing can be controlled or set by using a resistor and a capacitor network in the mono-
stable mode or operation. Furthermore, the stable mode operation of the IC involves the
changing of the frequency and duty cycles with the help of a capacitor and a variable network.
The circuit with all the values of its resistor and capacitor set, when supplied with 9 volts of
battery, it produces a buzzer sound. This IC NE555 drive an eight ohm to twenty-five-ohm
loudspeaker producing the audible square wave tone. In addition to this, a siren or 555 tone
generators can be interchangeably used as a buzzer. (Fried, 2021)
19
3.3.4. THE PASSIVE INFRARED SENSOR
A passive infrared sensor with acronym PIR are electronic devices which are used in some
security alarm systems to detect motion of an infrared emitting source, usually a human body.
The radiation is invisible to the human eye but can be detected by electronic devices designed
for that purpose. The passive infrared sensor uses a pair of pyroelectric sensors to detect heat
energy in the surrounding environment. These two sensors sit beside each other and when the
signal differential between the two sensors changes (if a person enters the room for example)
the sensor will engage, this means it triggers an alarm which notifies the security. The infrared
radiation focuses on each of the two pyroelectric sensors using a series of lenses constructed
as the sensor’s housing (Cook, 2021)
The PIR sensor circuit is used in numerous electronic projects which are used to discover
human being entering and leaving a particular area or room. The passive infrared sensor has
three pins, ground, signal and the power. Generally, the PIR power is up to 5v but the larger
the size of the PIR the higher the input voltage. The output of a PIR is a logic gate of either 1
or zero.
20
switching circuits. They are mostly used in circuits which are required to sense light. Below is
a picture of the light dependent resistor.
Figure 3. 7 LM35
This resistor works on the principle of photo conductivity. When light falls on its surface, the
material conductivity reduces and also the electrons in the valence band of the device are
excited to the conduction band. There photons in the incident light must have energy greater
than the gap of the semi-conductor material. This makes the electrons to jump from the valence
band to conduction. To give a brief summary of how this device works, when light touches the
surface of the resistor or when the light intensity in an environment increases, the resistance on
the light dependent resistor decreases and when the light intensity in an environment is
decreasing, the resistance increases, so they have an inverse proportionality where one quantity
increases while the other decreases and vice versa. Below is a graph showing the inverse
proportionality or the variation of light intensity with the conductivity of the light dependent
resistor (light dependent resistor ldr with:applications, 2021)
21
3.4. METHODS
3.4.1. MOTION DETECTION
Motion detection involves determining motion of a human being in an area where there is not
supposed to be one. The passive infrared sensor is responsible for doing this. The PIR sensor
has two slots each made up of a special material that can detect or are very sensitive to IR. It
has a lens which makes sure the sensor can sense past some reasonable distance. When the
sensor is idle, both slots detect the same amount of IR and then the ambient amount radiated
from the room or walls. On the other hand, when a warm body like a human being passes, it
first intercepts one half of the sensor which causes a potential difference between the two
halves. When the warm body leaves the area, the reverse happens. (lady ada, 2020)
22
take the usual security measures. Now we are going to take a look at the software components
of the buzzer.
Line one imports the general input and output system which is necessary for the functioning of
the buzzer. Next we have to import the time module to control the timing of the sound. After
this, we have to define a variable that will hold the buzzer pin. To continue, we have to use a
while loop to decide how long we want the sound to be produced. On line eight, we print the
“beep” when the sound is produced, and a “no beep” when no sound is produced to test the
proper functioning of the buzzer.
23
look at how to put on the camera with software and we are going to be us using python
programming language for this.
import cv2
vid_capture = cv2.VideoCapture(0)
vid_cod = cv2.VideoWriter_fourcc(*'XVID')
while(True):
ret,frame = vid_capture.read()
output.write(frame)
break
vid_capture.release()
output.release()
cv2.destroyAllWindows()
24
Figure 3. 11 Code for Camera System
Now let us see exactly how the code works. The first line imports the necessary library to work
with pictures and videos which is Opencv. Then line two defines the function to put camera
on. On line 4, we use the library to open an instance of the camera system and name it cap.
This is followed by defining the width and height of the video footage. On the next line, we
define a variable to hold to the video format to which the video is going to be converted and
stored on. Now we have to create a while loop to keep the camera on to take a live preview of
the environment. On the next line which is 17, we define the camera frame rate. Which is the
measure of how quickly a number of frames appears within a second. Next is to define a button
to quit the live preview session. After that we have to call the function to so that it can execute
the lines of code inside the function.
25
Figure 3. 12 Code for night Vision system
The above code will be to test the proper functioning of the device. To begin we have to import
the necessary libraries and modules that are necessary for the proper functioning of the device.
First the OS module that is imported first provides functions for interacting with the operating
system, secondly the date time module is necessary to work with dates and time in
programming to help in decision making during some hours of the day, next is the RPI and the
GPIO which is necessary for the general purpose input and output of the whole system. Line
six shows the general purpose pin to which we are connecting the light dependent resistor to
and we commence to define our function. This function is designed to setup the GPIO pins and
also set the pins up to output a low state from the very beginning of our program. The next
section sets up a loop to continuously take the readings from the light dependent resistor. We
have here three things that we have to measure, we have to measure the time in seconds,
resistance in Ohms and lastly the capacitance in Farads. The resistance here is the light
dependent resistor, that is the lighter we pass through it the lower the resistance and the quicker
the voltage that passes through it. So here we have to measure how long ti takes for the circuit
to reach a voltage that is great enough to register a HIGH in the general purpose input an output
system of the raspberry pi. So we are going to use the date time module to record the date and
time and stores it into a variable called GetDateTime and then we have another function which
changes the date and time to the desired function that we want as shown above on the code.
26
Now we are going to take a look at the results of the light dependent resistor. It is going to
output analogue light intensity signals as digital output.
Above are the values of the light dependent resistor as per the lighting conditions of that
environment at that particular time.
27
Figure 3. 14 Code to Capture Pictures
To begin we will start by importing the necessary libraries for this to work which are cv2 and
os, then we go furthermore to define a function to capture a picture of a scene with the name
capPic. The camera variable is to invoke an object of the cv2 library which will open a camera
preview, next we will use a while loop to check and assign names or identifiers to the pictures
we want to take, the while loop is responsible for checking the filename and if any repetition it
is incremented to the next number so as to avoid overwriting the previous photo that is captured.
Then the return value of the function captures the image followed by a filename assigned to it
below. Then a function of the cv2 library now comes in to take the filename and the image and
match them together before writing to memory. Then finally the camera live preview is
destroyed at the end with del(camera). Now we need to see how a video is captured in code.
28
Figure 3. 15 Code for Video Capture System
29
Capturing a video with coding is a little bit more complex than just taking pictures. We will
begin with our normal routine of importing the libraries that are necessary for this package. We
will continue our program to define a function capVid. Next on line 8 and 9 we will define the
duration that we want to take the video footage for. Followed by initialising the camera with
the cv2 function. On line 11 and 12, we call a function to check if the camera that is connected
to the system is properly connected and if not we print a message to the screen to alert the user
that the camera connected has a problem. After this is done we will define the width and height
of the video we want to capture. Next we will define a while loop to take care of naming of the
video footages captured. Since a video is a series of pictures captured we will define another
while loop to continuously take pictures with the desired frame rate. After that we will define
a button to exit the video recording when we want to stop the recording before the time elapses.
Finally, we destroy sessions of the camera and the video is stored the root storage of the device
to which the camera is connected.
30
Figure 3. 16 Remote Access Configuration
After this is done, the memory card is inserted back to the raspberry pi and then all three
devices powered on. When the Pi boots, it immediately connects to the Wi-Fi network
as per the configuration settings that was inputted at the configurations above. When
this happens, we launch our PUTTY software and immediately we will see a text box
prompting us to input the IP (internet protocol address) of the device that we want to
31
access. We can get the IP addresses of all devices connected to that modem from the
configuration settings.
This address is now inputted into the PUTTY software and immediately, a terminal
window opens for us to input the login details of the raspberry pi. The default username
and password of the raspberry pi system is pi, raspberry respectively. After logging into
the system, we will be presented with a terminal window an cannot access a remote
desktop interface where we can click to install and run programs. For this to be possible,
we have to install a package called XRDP which will help us access the desktop of the
pi. XRDP is a free open source implementation of Microsoft Remote Desktop Protocol
server that enables the operating systems of other devices. To archive this, we run the
command “pip install xrdp” and then the package installs with the help of an active
internet connection. Then on the windows machine, we launch another in-built
application called “remote desktop” which is used to access other computer systems on
a network. Immediately this application comes live, it opens a window to input the IP
address of the raspberry pi. In my case is 192.168.1.134. when this is done, another
window opens asking us for the login details which are the username and password of
the remote system we want to access. Below are some figures to demonstrate the local
remote access.
32
ONLINE REMOTE ACCESS: This is the ability of a person to access a network or
a computer from a geographical distance through the use of a local network or network
with the use of the internet services. To achieve this, there are three connections that
need to be made, first is the connection of the raspberry pi to the internet services,
secondly we need a server where we will connect the raspberry pi to and then followed
by the connection of the computer or laptop to the internet and to that same server where
our raspberry pi is registered on. There is a company called REMOTE IT which
provides remote services to devices and operating systems such as that of the raspberry
pi. To begin with REMOTE IT, we have to sign up to use her services with a Google
mail. After the registration is complete, we will be prompted with a window asking us
for service we want. When all this is done we will click on the register button and then
it will connect to the raspberry pi and check all the credentials, if all correct then we
will get a confirmation that the process is successful. To access the pi now using the
internet services, put on the raspberry pi, let it boot, connect it to the internet services.
On your other computer where you installed the application remote it, Windows for my
case, connect the laptop to the internet services as well. Launch the application
REMOTE IT and then login with your email credentials and then you will be presented
with a window as such below.
33
Figure 3. 18 Remote Access configuration
After the update has been processed by the pi, we need to continue with the installation of a
software called “motion” which will enable us make the raspberry pi become a webcam server.
To do this, we need to run the command “sudo apt-get install motion” it is about 5KB of data
and the installed package will take about 5MB of hard disk space. After the package has been
installed, we need to connect our webcam to the raspberry pi. To confirm that the camera is
connected correctly, we need to run some code in the terminal which is “lsusb”. This command
on the terminal will list all the USB devices connected to the raspberry.
34
The highlighted device shows that our USB webcam has been recognised successfully. If the
camera is connected well and it does not appear here, then it might simply mean that the
connected device is not compatible with the version of raspberry we are using. Now we have
to head over to the editor of motion to configure some camera properties that are necessary. To
do this we need to write the following code to the terminal, “sudo nano /etc/motion.conf”. this
command will open the main configuration file.
The configuration file opens up as shown above with information on it such as the version and
the developer options available. Firstly, we need to make sure that the Demon tool is put on, to
do this we need to edit the file and replace the Demon off to demon On. Now since the file is
too large and we just need a few configuration files, we need to be able to search the commands,
to do this we need to use a short cut on the keyboard which is Control plus w. this will open up
a label and give you the opportunity to search items on the file. The first configuration that we
are going to search is the frame rate. Frame rate is a unit for measuring how many photos are
taken per camera circle. So we are going to edit the frame rate and put 1500 frames per second.
If the frame rate is higher than what your camera can capture, then there will be an error when
viewing the live footage. Secondly we need to search for another configuration which is the
live stream server section, below this, we will find a stream port which will be used to access
the camera using a web browser. We have to note this port or change it to a port we desire and
35
cannot forget. We will set this to 8080. The next file we have to access is the stream quality
and for this we will assign the value 50 and finally under the stream services, we have to access
the part called stream_localhost and assign its value to on. This will enable us access the camera
of the raspberry remotely using a browser. Next we have to head on to “HTTP control” and set
the local host to off
THE BUZZER
The buzzer here will act as the alarm system, it comes on and makes a buzzling noise
when motion is detected and stops when there is no motion. This is the way the buzzer
acts as an alarm system
Start
36
Figure 3. 21 Flow Chart for Buzzer
This is how the lighting system will be controlled. The Red LED comes on when there is motion
and goes off when there is no motion, the blue LED comes on when there is no motion and
goes off when motion if detected
37
Start
While
Motion=True
LED.on()
End
This is how the motion detector system works, it senses the environment and when motion is
detected, it send back a signal to the processing system where other actions such as the lighting
systems are put in place.
38
Start
Print(“motion detected”)
End
39
LIGHT SENSING SYSTEM
The light dependent resistor works as follows. I was able to convert the light intensity
analogue signals to digital signals. When the values went above 1000, a high signal was
sent to the processor meaning there is low lighting in the system.
start
If(1light >=
Print(“low lighting”)
1000)
Print(“good lighting”)
end
40
CAPTURING PHOTO
The flowchart for taking a picture is very simple and straight. When motion is detected, a photo
of the subject is taken and stored for later viewing by the user or the administrator.
start
Camera.capPhoto()
end
Just like the photo, video is captured for 20 seconds and stored for later viewing by the user or
the administrator of the system.
start
Time = 20 seconds
Camera.capVIdeo(20)
end
41
THE MAIN
Designing the main is still a little bit complex, representing all those blocks in a single page
will crowd the page with so much information that may reduce the readability and the ease
with which the code can be understood. For this effect, we are going to define some other
processes and give them names.
Capture photo
Put on buzzer
The photo security
process
Camera.capVIdeo(20)
Put on buzzer
Choice=Press 1 to
record video and 0 to
take pictures
While While
0 If(choice=1) 1
Motion = True Motion = True
End
43
The main flowchart is a combination of all the other small units or components of the system.
It combines the functionalities of all the other systems, the buzzer, the lighting system, the
photo and video processes, the motion detection system.
44
CHAPTER 4: RESULTS AND DISCUSSIONS
4.1. INTRODUCTION
In this chapter, we will be showing the results of our research, discuss the difficulties
encountered throughout this study. The main objective of this system is to be able to detect
motion in a certain environment and take pictures or videos when necessary and stored in a
database where they can be later viewed. To achieve this, we have divided the task into small
parts which will be handled individually and then combined to form a whole working system.
The various parts will be, detecting motion, detecting light intensity, setting up the alarm
system, setting up the lighting system, recording videos and finally remote access.
45
When motion is detected, a message is printed on the screen and the system waits five seconds
before emitting rays again to detect motion.
The code is designed to print to the screen for testing purposes of the actions it is taking while
doing the actions. So when a beep sound is produced, it waits for one second of silence and
then produces another beep sound.
46
4.5. CAPTURING VIDEO
The quality of videos that can be captured is solely dependent on the quality of the camera you
are using, now we will take a look at a screenshot of a video that was captured with the USB
camera of the raspberry pi 4
Figure 4. 3 Results showing a video captured by the system when motion is detected
This video is captured and stored with the filename “captured_vid2” which has been
incremented from the previously saved video with filename “captured_vid1”. When this video
is captured, it is saved in the directory where the code is stored.
47
4.7. THE LIGHTING SYSTEM
The code is designed to print also a message to the screen for tests to make sure all is working
well
The lighting system is just here for guidance; the red LED comes on when system detects
motion.
48
Figure 4. 6 Project Skeleton
The green LED comes on when the system is normal and no motion.
49
Figure 4. 7 Project Skeleton with green lighting
The Blue LED comes on to signify that the lighting condition around the area is not the best
and so the infrared lighting system has been activated.
50
Figure 4. 8 Project skeleton with blue lighting
51
CHAPTER 5: CONCLUSION PERSPECTIVE AND
RECOMMENDATIONS
5.1. CONCLUSION
The thesis of the research carried out above is aimed at designing a security system where by
cameras are placed at strategic positions of a organization we wish to secure, the cameras are
equipped with motion sensors which are able to detect motion and report it to the CPU, also
with the help of a light dependent resistor to sense the changes in light intensity and report back
to the central processing unit so as to sense low lighting conditions and put on the infrared LED
to enable better vision of the system. With the help of internet services, the cameras of the
system can be accessed from a remote location with active and fast internet services.
Talking about the lighting system, we have made provision for different color of light emitting
diodes to represent different conditions in the system. There will be a green LED which will
signify that the system is idle and no motion is detected, there is a red LED to signify that the
system has detected motion and is currently taking a picture or recording a video. The system
also is limited in the night due to low lighting
When the system is installed in a specific location, the user is given the choice on whether the
security action to be taken will be taking pictures or recording videos. This choice will be made
available to the user once and it is the first time the system installed. The pictures or videos are
stored in the root access of the system where the user can access at any time. Talking about the
general security of the system, there will be a root password enabled which is to be decided by
the user to remove the fear of unauthorized access.
5.2. PERSPECTIVES
There are limitations to every project carried out there. Talking of this one, the quality of videos
or the quality of the pictures taken solely depends on the quality of the camera used, and though
we have made provision for a night vision system, the images and videos taken from such low
lighting conditions will not be crystal clear compared to the videos or pictures taken during the
day or under bright and good lighting conditions. Talking about remote access, the quality of
the live stream that can be gotten from the camera solely depends on the network system
available at that particular location as data packets are to be transferred in real time. The best
network or the recommended network which is suitable for this system is a stable 4G LTE
52
network. During days with bad weather like rain and storm, the rain droplets will shield the
perfect vision of the system and also, the system can also detect motion when there actually is
no motion occurring.
5.3. RECOMMENDATION
For proper and effective functioning of the system,
The end user should at least check the root storage once a month to see if it is full, if
not the system will crash when there is no place to store taken videos or pictures
There should be made provision of good network services so that the online or remote
access is smooth
The system’s functionality will greatly improve when cameras of higher resolution are
used.
The passive infrared sensor used in this project has a range of 6meters, for more
sensitivity, a better version can be used.
53
REFERENCES
Britanica. (2021, August 19). www.britannica.com. Retrieved from britannica:
https://www.britannica.com/technology/information-processing/Dissemination-of-
information
Cook, J. S. (2021, August 18). Home: Articles and Videos . Retrieved from Arrow:
https://www.arrow.com/en/research-and-events/articles/understanding-active-and-
passive-infrared-sensors
halfacree, G. (2018). The official Raspberry Pi Beginner’s Guide. How to use your new
computer. Cambridge: Raspberry Pi Trading Ltd, Station Road, Cambridge, CB1 2JH.
54
YAN, W. Q. (2018). Introduction To Intelligent Surveillance,. In Surveillance Data Capture,
Transmission and Analytics, Third Edition.
55