You are on page 1of 41

KYAMBOGO UNIVERSITY

FACULTY OF ENGINEERING
DEPARTMENT OF ELECTRICAL AND ELECTRONIC
ENGINEERING

DESIGN AND CONSTRUCTION OF A HOME SECURITY


SYSTEM USING A GSM MODEM

BY

OPILA STEPHEN 16/U/12946/ETD/GV

A REPORT FOR EE 321 GROUP PROJECT SUBMITTED TO


THE DEPARTMENT OF ELECTRICAL AND ELECTRONIC
ENGINEERING IN PARTIAL FULFILMENT OF THE AWARD
OF A DEGREE OF BACHELOR OF ENGINEERING IN
TELECOMMUNICATION ENGINEERING OF KYAMBOGO
UNIVERSITY

SUPERVISOR; MR BUGA BEN BOSCO

AUGUST, 2017
DECLARATION

I Opila Stephen declare with great sincerity that this project report entitled, DESIGN AND
CONSTRUCTION OF A HOME SECURITY SYSTEM USING A GSM MODEM is
original and has not been presented anywhere or submitted to any institution/University for any
award of any degree or diploma

NAME : OPILA STEPHEN

REG. NO. : 16/U/12946/ETD/GV

DATE : ...

Signature : ..

ii
APPROVAL

This is to certify that this project carried out by Stephen Opila on the topic, DESIGN AND
CONSTRUCTION OF A HOME SECURITY SYSTEM USING A GSM MODEM has
been under my supervision and it is now ready for submission with my approval.

Supervisors Name : BUGA BEN BOSCO

Signature :

Date :

iii
ACKNOWLEDGEMENT

I would like to thanks to people who has supported me and gave encouragement, guidance and
advices in order to help me to complete the project successfully.

First and foremost, I would like to convey my sincere appreciation to my supervisor Mr. Buga
Ben Bosco for his valuable guidance and helpful advices throughout the process of project
building.

Second, I would like to give my deepest appreciation to my beloved family members. They have
been giving me mentally support and financial support while completing this project.
Furthermore, thanks to all the lectures and my fellow course mate for giving sharing and opinion
for project improvement sincerely.

Lastly, I would like to express my thanks to my group members for their innovative ideas and
contributions toward this project success.

iv
DEDICATION

Special dedicated to my beloved brother, John Juventine and his wife, Jane Alupo

v
ABSTRACT

This report presents a design and implementation of monitoring system of a home security with
sensor network and Global System for Mobile Communication (GSM) network. The monitoring
system of project consists of two sub-systems which are notification system and alert system.
Notification system enables the home owner to be notified by Short Message Service (SMS) over
GSM network whenever there is an intrusion at home. Alert system performs visual or audible
responses. Visual response is indicated by light while audible responses are indicated by buzzer.
Passive Infrared (PIR) sensor is used for short distance monitoring while SMS is used for both
long and short distance monitoring

vi
Table of Content
DECLARATION ............................................................................................................................ ii

APPROVAL .................................................................................................................................. iii

ACKNOWLEDGEMENT ............................................................................................................. iv

DEDICATION ................................................................................................................................ v

ABSTRACT ................................................................................................................................... vi

LIST OF FIGURES ....................................................................................................................... ix

LIST TABLES. .............................................................................................................................. ix

LIST OF SYMBOLS ..................................................................................................................... xi

CHAPTER ONE: INTRODUCTION ............................................................................................. 1

1.1 Background ............................................................................................................................... 1

1.2 Problem statement ..................................................................................................................... 2

1.3 Objectives ................................................................................................................................. 2

1.4 Justification ............................................................................................................................... 2

1.5 Significance of the project ........................................................................................................ 3

1.6 Project scope ............................................................................................................................. 3

1.7 Methodology ............................................................................................................................. 3

CHAPTER TWO: LITERATURE REVIEW ................................................................................. 4

2.1 Home Security System .............................................................................................................. 4

2.1.1 Hardware Based Home Security System ..................................................................... 4

2.1.2 Web based Home Security System ............................................................................. 5

2.1.3 Phone Based Home Security System .......................................................................... 6

2.2 System specifications ................................................................................................................ 8

2.2.3 PIR sensors................................................................................................................ 13

2.3 system block diagram .................................................................................................. 16

vii
CHAPTER THREE: IMPLEMENTATION................................................................................. 17

3.1 Selection and verification .................................................................................................. 17

3.1.1 Testing a PIR............................................................................................................ 17

3.1.2 GSM modem testing ................................................................................................ 20

3.2 Writing Code........................................................................................................................... 20

3.3 Construction and testing ......................................................................................................... 21

3.3.1 Circuit diagram ....................................................................................................... 22

3.3.2 Connection of the circuit ......................................................................................... 22

3.3.3 Results and discussion ........................................................................................... 22

CHAPTER 4: CONLUSIONS AND RECOMMENDATION ..................................................... 24

4.1. Conclusion ............................................................................................................................. 24

4.2. Recommendations .................................................................................................................. 24

REFERENCES ............................................................................................................................. 25

APPENDIXES .............................................................................................................................. 26

Appendix A: The time schedule for project .................................................................................. 26

Appendix B: Characteristics of Component Used ........................................................................ 27

Appendix C: Project budget .......................................................................................................... 29

Appendix D: Photos ...................................................................................................................... 30

viii
LIST OF FIGURES

FIGURE NO. TITLE PAGE


1 Hardware Based system 1
2 Web Based System 2
3 Phone Based System 3
4 showing PIR features 14
5 Showing heat source movement and output signal 15
6 showing ceiling and wall mounting sensitivity 15
7 showing a block diagram 16
8 PIR circuit testing 17
9 photo showing PIR non-retrigger mode. 18
10 photo showing PIR sensitivity and time trim pots. 19
11 showing SMS received from system by a mobile phone 22
12 SMS received from system by a mobile phone 23
13 Photos of the project. 30

LIST TABLES.

TABLE NO. TITLE PAGE

1 PIR sensitivity results 19


2 The time schedule for project 26

3 Characteristics of ARDUINU UNO 27

5 Characteristics of GSM Modem. 27

6 Characteristics of Voltage Regulator 28

7 Showing the cost of system component 29

8 Showing the cost for project activities 28

ix
LIST OF ABBREVIATIONS

AT - Attention Commands
GSM - Global System Mobile Communication
GPM - GSM Power Meter
HBS - Hardware Based System
ICSP - In Circuit Serial Programming
IR - Infrared
LCD - Liquid Crystal Display
PBS - Phone Based System
PCB - Printed Circuit Board
PDA - Personal Digital Assistant
PIC - Peripheral Interface Controller
PIR - Pyroelectric Infrared
SMS - Short Message Service
SPDT - Single Pole Double Throw
WBS - Web Based System
Wi-Fi - Wireless Fidelity
CDMA - Code Division Multiple Access
TDMA - Time Division Multiple Access
PDU - Protocol Data Unit
EEPROM - Electrically Erasable Programmable Read-Only Memory

x
LIST OF SYMBOLS

- Micro
K - Kilo
kHz - Kilo Hertz
Tx - Transmit
Rx - Receive
V - Volts
dc - Direct Current
cm - Centimeter

xi
CHAPTER ONE: INTRODUCTION

1.1 Background

Security is one thing that is very influential in todays life, everyone needs security guarantees
when they work, like health, security is an important aspect in life. Hence, various kinds of
development in the technology field are designed to provide security at all times to protect their
assets and privacy. Installing a reliable home security system may be the best decision any
person would ever have made especially because People nowadays are busy with daily activities.
Adult deals with career while children busy with academics. Only elderly people left at home or
most of the time there is nobody home especially day time.

For this reasons, there exists a number of security systems in the world that works in a number of
application principles; A good lock for the door which still thefts have managed to break, destroy
and get into homes. Security lighting around the home and measures to ensure these lights are on
at night, even the security lights have been vandalized and removed by thieves when the owner is
not around. Barbed wires on the fence, these wires have also been cut and removed by the
intruders. Burglary proof windows or doors have also been destroyed by thieves once the home
is left alone, alarm systems have also been ignored once there is no one to respond to the alarm
property will be stolen. Surveillance cameras, besides the need for their constant monitoring
which is costly to hire the person to monitor also thieves have worn masks and the cameras could
not recognize. Other people have recruited security guards who often go and leave there work
once they know the home owner has also gone away and home is left alone. These weaknesses
and failures have been overcome by this project.

1
1.2 Problem statement

Breaks in and theft has caused the loss of valuable properties and assets at homes where by every
owner of a home without a security system has no comfort while away from home. Therefore
there arises a need to know the status of a home from a remote place and be able to make a
timely response to any incident that happens at home.

1.3 Objectives

Main Objective

The main objective was to design and construct a phone based home security system using the
GSM

Specific Objective

The following specific objectives were achieved;

a) The PIR sensor was calibrated to monitor appropriate field of view and was interfaced
with the ARDUINO UNO.
b) The GSM modem was interfaced with the ARDUINO UNO and sent an SMS to a
registered phone number
c) The piezo buzzer was calibrated with the ARDUINO UNO
d) The ARDUINO UNO was programmed to integrate all the modules and the phone based
home security system capable of detecting intrusion, sending alert and alarming was
constructed.

1.4 Justification

People nowadays are busy with daily activities. Adult deals with career while children busy with
academics. Due to the weakness of existing home security systems like A good lock for the door
which still thefts have managed to break, destroy and get into homes. Security lighting around
the home and measures to ensure these lights are on at night, even the security lights have been
vandalized and removed by thieves when the owner is not around. Barbed wires on the fence,
these wires have also been cut and removed by the intruders. Burglary proof windows or doors
have also been destroyed by thieves once the home is left alone, among others. Therefore, it is
thus justifiable to design a home security system which can detect illegal intrusion then send a

2
notification update of the home status to home woner via SMS through GSM network that will
enable the home owner to call the police, neighbors, security guards among others for help and
also make an alarm to scare away the intruder.

1.5 Significance of the project

a) Makes an alarm that scares a way the intruder that would otherwise vandalize the home
without anyone.

b) The alarm bring attention of any one around the home to intervene

c) The timely alert received via SMS enables the home owner to take appropriate measures to
request for assistance from neighbors, the security personnel like the police and alerting security
guard.

1.6 Project scope

The implementation of this project is limited to a network coverage area of a specific network
provider like MTN. The area of application is for homes, the digital home security system
designed in the project finds applications in a building whose entry and exit points are with a
maximum of 21metres from the sensor mounted on wall. For commercial application, the system
will only need to be provided with additional sensors of up to a maximum of nine (9) to provide
wider coverage of secured points.

1.7 Methodology

Several research methods have been employed in yielding most of the information to be used in
implementing this project. These methods include the following.

a) A broad and thorough research study on the various microcontrollers available and their
personal attributes, which should be best, suited for the implementation of this project.
Going into detail about their processor power including storage capacity and speed of
command execution in response to the goals of this project from text books.
b) Consultations from Lecturers, fellow students and guidance from our supervisor and
other published project reports from previous years.
c) Studying the different component data sheets, data acquisition and personal testing for
proper calibration of sensor. Documenting the results and comparing them with the
manufacturers results.

3
CHAPTER TWO: LITERATURE REVIEW

The discovery of the burglaries alarm system is a great innovation in the crime for intrusion into
a given structure this was done by Boston in 1852. The discovery is a great trend to the todays
security systems. The various problems, disadvantages and failures offered by many types of
security system is the major lead to the implementation of this project as it aims to provide the
most reliable system of security available by utilizing the principles of the GSM technology.

This chapter introduces devices, approaches and communication technologies that have been
implemented in current home security system. Beside of explaining different type of home
security system, it also explains latest SMS based applications

2.1 Home Security System

The three common types of home security system in the market are phone based system (PBS),
web based system (WBS) and hardware based system (HBS). For phoned based system,
monitoring and control for home is done by global system for mobile communication network.
For web based system is done over internet or wireless router. For hardware based system,
monitoring and control is fully done by hardware

2.1.1 Hardware Based Home Security System

This is a widely used system in our country Uganda it include a good padlock, security wall
fence, razor wires, security lighting, security gourds among others. Almost every home in the
world has at least one of these measures in place to safe guard them from intrusion; a lot of
advancements have been made on hardware based home security systems as illustrated in figure1
below. The main advantage of this system is being vulnerable to destruction once the home
owner is not around, no matter how strong the hardware, thieves always try to vandalize it in
different ways.

4
Figure 1: Hardware based system

2.1.2 Web based Home Security System

Web server and home controller play the important role in the wed based system. Figure 2 shows
the web based system architecture. Web server governs the interfaced webpage that allows user
to control the system. Real time monitoring of home condition is done over web browsers via
laptop, personal digital assistant (PDA) or internet-enabled mobile phone. Laptop is connected to
internet via wired local access network or wireless local access network (WLAN). PDA is
connected to internet via WLAN. Internet- enabled mobile phone is connected to an internet
service which is provided by a mobile service company. When a sensor detects
abnormal incident, an alert message is sent to user through web page. User can confirm the alarm
after observing home condition for true abnormal incident through installed camera. Web based
system requires high cost devices such as personal computer, laptop or PDA. Laptop and
personal computer are large in size and heavy to be carried. Monthly internet service or phone
service makes web based system a high cost system.

5
Figure 2: Web Based System

Web Based System Weakness

1. Internet access, user can only log in if there is internet access

2. User name and password must be secure, if not can be accessed online by others

3. We cannot monitor the CCTV system at home if there is no electric supply

2.1.3 Phone Based Home Security System

Phone based system is a public phone system which is connected to Public Switched Telephone
Network (PSTN). Figure 3 shows phone based system architecture. User can activate home
alarm when he/she leaves the house. When one of the sensors for example door sensor is
triggered, alarm is alerted through PSTN system. PSTN calls the alarm monitoring company or
homeowner. To get confirmation for the alarm incident, a physical visit is required

6
Figure 3: Phone Based System

Phone based system merits.

i. A mobile phone is a device thats carried by its owner most of the time. Whenever an
SMS text message is received, the mobile phone will notify you by giving out a sound or
by vibrating. You can check what the SMS text message contains immediately.
ii. SMS technology allows the push of information. This is different from the pull
model where a device has to poll the server regularly in order to check whether there is
any new information. The pull model is less suitable for alert and notification
applications, since it wastes bandwidth and increases server load. In a remote system
monitoring application, a program (sometimes with the help of a group of sensor) is
constantly monitoring the status of the remote system. If a certain condition is satisfied,
the program will send a text message to the system administrator to notify him/her of the
situation. For example, a program may be written to ping a server regularly. If no
response is received from the server, the program can send an SMS alert to the system
administrator to notify him/her according to the written program.

7
2.2 System specifications

2.2.1 ARDUINO UNO

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use


hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in
creating interactive objects or environments.

Arduino can sense the environment by receiving input from a variety of sensors and can affect its
surroundings by controlling lights, motors, and other actuators. The microcontroller on the board
is programmed using the Arduino programming language and the Arduino development
environment. Arduino projects can be stand-alone or they can communicate with software
running on a computer (e.g. Flash, Processing,).

The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14
digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz
crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It
contains everything needed to support the microcontroller; simply connect it to a computer with
a USB cable or power it with a AC-to-DC adapter or battery to get started.

Power

The Arduino Uno can be powered via the USB connection or with an external power supply. The
power source is selected automatically. External (non-USB) power can come either from an AC
to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center
positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and
Vin pin headers of the POWER connector

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V,
however, the 5V pin may supply less than five volts and the board may be unstable. If using
more than 12V, the voltage regulator may overheat and damage the board. The recommended
range is 7 to 12 volts. The power pins are as follows:

8
VIN. The input voltage to the Arduino board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.
5V.This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 - 12V), the USB connector (5V),
or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses
the regulator, and can damage your board. We don't advise it.
3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50
mA.
GND. Ground pins

Memory

The ATmega328 has 32 KB (with 0.5 KB used for the boot loader). It also has 2 KB of SRAM
and 1 KB of EEPROM.

Output

Each of the 14 digital pins on the Uno can be used as an input or output, using pin mode, digital
write, digital read functions. They operate at 5 volts. Each pin can provide or receive a maximum
of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In
addition, some pins have specialized functions:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL
Serial chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analog write function.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, its off.

9
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution
(i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible
to change the upper end of their range using the AREF pin and the analogreference function.
There are couple of other pins on the board:

AREF. Reference voltage for the analog inputs. Used with analog reference.
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.

2.2.2 GSM Modem

The GSM modem is a wireless modem that works with a GSM wireless network. A wireless

modem behaves like a dial-up modem. The main difference between them is that a dial-up

modem send and receives data through radio waves. Like a GSM phone, a GSM modem requires

a SIM card from a wireless carrier in order to operate.

There different types of GSM modems, among others are sim 900, sim 800L. In this project
sim800L was used because of its better advantages; its very small making it more portable for
such a small project, it also has its libraries easily available in Arduino that make it compatible
with Arduino.

To communicate with GSM modem, one need to use AT command. By using this command, the
user can communicate either by computer or Arduino. Both GSM modem and dial-up modem
support a common set of standard AT command. These extended AT commands are defined in
the GSM standard. From this knowledge, the user can do things like:

i. Reading, writing and deleting SMS messages.


ii. Sending SMS message.
iii. Monitoring the signal strength.
iv. Make a phone call
v. Receive a phone call, among others.

Message Service (SMS)

10
This is a technology that enables the sending and receiving of message between mobile phone.
SMS first appeared in Europe in 1992. It was included in the GSM (Global System for Mobile
Communication) standard right at the beginning. Later it was ported to wireless technologies like
CDMA and TDMA. One SMS message can contain at most 140 bytes (1120 bits) of data SMS
text messaging supports many languages internationally. It works fine with all language
supported by Unicode. SMS messages can also carry binary data. It is possible to send ringtones,
pictures operator logos, wallpapers, animations, business card and WAP configurations to a
mobile phone with SMS messages. One major advantage of SMS is that it is supported by 100%
GSM mobile phones. Almost all subscription plans provided by wireless carriers include
inexpensive SMS messaging service. Unlike SMS, mobile technologies such as WAP and mobile
Java are not supported on many old mobile phone models.

Example Application of SMS

SMS is a technology for delivering alerts and notification of important events. There are two
important reasons for this choice:

iii. A mobile phone is a device that carried by its owner most of the time. Whenever an SMS
text message is received, the mobile phone will notify you by giving out a sound or by
vibrating. You can check what the SMS text message contains immediately.
iv. SMS technology allows the push of information. This is different from the pull
model where a device has to poll the server regularly in order to check whether there is
any new information. The pull model is less suitable for alert and notification
applications, since it wastes bandwidth and increases server load. In a remote system
monitoring application, a program (sometimes with the help of a group of sensor) is
constantly monitoring the status of the remote system. If a certain condition is satisfied,
the program will send a text message to the system administrator to notify him/her of the
situation. For example, a program may be written to ping a server regularly. If no
response is received from the server, the program can send an SMS alert to the system
administrator to notify him/her according to the written program.

Operating Mode: SMS Text and SMS PDU

11
The SMS specification has defined two modes in which a GSM/GPRS modem or mobile phone
can operate. They are called SMS text mode and SMS PDU mode (PDU stands for Protocol Data
Unit). The mode that a GSM/GPRS modem or mobile phone is operating in determines the
syntax of some SMS AT commands and the format of the responses returned after
execution

Basic Commands and Extended Commands

There are two types of AT commands: basic commands and extended commands. Basic
commands are AT commands that do not start with +. For example, D (Dial), A (Answer), H
(Hook control) and O (Return to online data state) are basic commands. Extended commands are
AT commands that start with +. All GSM AT commands are extended commands. For
example, +CMGS (Send SMS message), +CMSS (Send SMS message from storage), +CMGL
(List SMS messages) and +CMGR (Read SMS messages) are extended commands.

General Syntax of Extended AT commands

The general syntax of extended AT commands is straightforward. The syntax rules are provided
below. The syntax of basic AT commands is slightly different.

Syntax rule 1: All command lines must start with AT and end with a carriage return character.
(<CR> represents a carriage return character). In a terminal program like HyperTerminal of
Microsoft Windows, user can press the Enter key on the keyboard to output a carriage return
character. Example: To list all unread inbound SMS message stored in the message storage area,
type AT, then the extended AT command +CMGL, and finally a carriage return character,
like this:

AT+CMGL<CR>

Syntax rule 2: A command line can contain more than one AT command. Only the first AT
command should be prefixed with AT. AT commands in the same command-line string should
be separated with semicolons. Example: To list all unread inbound SMS message storage area
and obtain the manufacturer name of the mobile device, type AT, then the extended AT
command +CMGL, followed by a semicolon and the next extended AT command +CGMI:
AT+CMGL; +CGMI<CR>

12
An error will occur if both AT commands are prefixed with AT:

AT+CMGL; AT+CGMI<CR>

Syntax rule 3: A string is enclosed between double quotes. Example: To read all SMS messages
from message storage in SMS text mode, assign the string ALL to the extend AT command
+CMGL:

AT+CMGL=ALL<CR>

Syntax rule 4: Information responses and result codes (including both final result codes and
unsolicited result codes) always start and end with a carriage return character and a linefeed
character. Example: After sending the command line AT+CMGI<CR> to the GSM modem,
the GSM modem should return a response similar to this:

<CR><LF><OK><CR><LF>

The first line is the information response of the AT command +CMGI and the second line is the
final result code. The <CR> and <LF> represent a carriage return character and a linefeed
character are respectively. The final result code OK marks the end of the response. It indicates
no more data will be sent from the mobile device to the computer or PC. When a terminal
program such as HyperTerminal of Microsoft Windows sees a carriage return character, it moves
the cursor to the beginning of the current line. When it sees a linefeed character, it moves the
cursor to the same position on the next line. Hence, the command line AT+CGMI<CR> that
you entered and the corresponding response will be displayed like this in a terminal program
such as HyperTerminal of Microsoft Windows:

AT+CGMI
OK

2.2.3 PIR sensors

PIR sensors allow you to sense motion, almost always used to detect whether a human has
moved in or out of the sensors range. They are small, inexpensive, low-power, easy to use and
don't wear out. For that reason they are commonly found in appliances and gadgets used in

13
homes or businesses. They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR
motion" sensors.

PIRs are basically made of apyroelectric sensor (which you can see above as the round metal can
with a rectangular crystal in the center), which can detect levels of infrared radiation. Everything
emits some low level radiation, and the hotter something is, the more radiation is emitted. The
sensor in a motion detector is actually split in two halves. The reason for that is that we are
looking to detect motion (change) not average IR levels. The two halves are wired up so that they
cancel each other out. If one half sees more or less IR radiation than the other, the output will
swing high or low.

Along with the pyroelectic sensor is a bunch of supporting circuitry, resistors and capacitors. It
seems that most small hobbyist sensors use the BISS0001 ("Micro Power PIR Motion Detector
IC"), undoubtedly a very inexpensive chip. This chip takes the output of the sensor and does
some minor processing on it to emit a digital output pulse from the analog sensor.

Figure 4: PIR features

PIR Working

The PIR sensor itself has two slots in it, each slot is made of a special material that is sensitive to
IR. The lens used here is not really doing much and so we see that the two slots can 'see' out past

14
some distance (basically the sensitivity of the sensor). When the sensor is idle, both slots detect
the same amount of IR, the ambient amount radiated from the room or walls or outdoors. When a
warm body like a human or animal passes by, it first intercepts one half of the PIR sensor, which
causes a positive differential change between the two halves. When the warm body leaves the
sensing area, the reverse happens, whereby the sensor generates a negative differential change.
These change pulses are what is detected.

Figure 5: Showing heat source movement and output signal

The different faceting and sub-lenses create a range of detection areas, interleaved with
each other. Thats why the lens centers in the facets above are 'inconsistant' every other
one points to a different half of the PIR sensing element

Figure 6: Ceiling and wall mounting sensitivity

15
2.3 system block diagram

Figure 7: showing a block diagram

How the system works

The PIR detector used in this system reacts to fast temperature variations caused by the
movement of people in an enclosed space. All mammals radiate a certain amount of heat, and it
is this that causes local variations in temperature. The radiant energy is picked up by a Fresnel
lens, at the focus of which is a double differential pyroelectric sensor. The detector is largely
unaffected by other electrical radiation. Also, it does not react to movement outside the guarded
space.

The space to be monitored is divided by the lens into a number of zones. The number of zones
depends on the number of segments of which the lens is composed. When somebody moves from
one zone into another, there is a change in temperature which is collected by the lens as a
variation in radiant energy. At the focus of the lens is a pyroelectric sensor which reacts to such a
change by generating a small electric signal. That signal is fed to ARDUINO pin 7 which is
configured as the input pin.

Once pin 7 goes high the Arduino triggers the buzzer to alarm for 3 minutes and then send an
SMS at the same time through the GSM modem to registered number.

16
CHAPTER THREE: IMPLEMENTATION

3.1 Selection and verification

Same project could have been designed with a microcontroller 8051 or ARDUINO. An Arduino
UNO was used to realize this project because; it simplifies the amount of hardware and software
development you need to do in order to get a system running, the Arduino hardware platform
already has the power and reset circuitry setup as well as circuitry to program and communicate
with the microcontroller over USB. In addition, the I/O pins of the microcontroller are typically
already fed out to sockets/headers for easy access (This may vary a bit with the specific model).
On the software side, Arduino provides a number of libraries to make programming the
microcontroller easier. More useful for things such as being able to set I/O pins to PWM at a
certain duty cycle using a single command or doing Serial communication.
The greatest advantage is having the hardware platform set up already, especially the fact that it
allows programming and serial communication over USB.

3.1.1 Testing a PIR

Once we had the breadboard wired up as in fig 3.4.2, inserted 5v battery and wait 30-60 seconds
for the PIR to 'stabilize'. During that time the LED may blink a little. Had to Wait until the LED
is off and then move around in front of it, waving a hand, etc, to see the LED light up

Figure 8: PIR circuit testing

17
There were a couple options tested with the PIR, first explored the 'Retriggering' option. As the
LED was blinking, from the back of the PIR sensor the jumper by default is found in the H
(high) position, make sure that the jumper is changed into the L position as shown below

We set up the testing board again. And notice that when connecting up the PIR sensor as below,
the LED does not stay on when moving in front of it but actually turns on and off every second
or so. That is called non-retriggering

Figure 9: Photo showing PIR non-retrigger mode.

Changing sensitivity

The Adafruit PIR has two orange trimpot on the back for adjusting sensitivity and delay time.
We had to adjust this because the PIR was too sensitive, adjust anti clockwise the sensitivity
trimpot to minimal level, to level sensitive enough - clockwise makes it more sensitive. The
delay time trimpot is for changing the time in which the PIR output will keep high when it
detects motion.

18
Figure 10: photo showing PIR sensitivity and time trim pots.

PIR sensor sensitivity results


When trim pots were adjusted clock wise here results.
Adjusted position Distance Led comes on
0 1m
way 3m
way 7m
way 12m
Full way 15m
Table 1: PIR sensitivity results
TIME trimpot
This is a 1Megaohm adjustable resistor which is added to a 10K series resistor. And 0.01uF,its
obtained from formula below.
Tx = 24576 x (10K + Rtime) x 0.01uF
If the Rtime potentiometer is turned all the way down counter-clockwise (to 0 ohms) then
Tx = 24576 x (10K) x 0.01uF = 2.5 seconds (approximate)
If the Rtime potentiometer is turned all the way up clockwise to 1 Megaohm then
Tx = 24576 x (1010K) x 0.01uF = 250 seconds (approximate)
If RTime is in the middle, that'd be about 120 seconds (two minutes) so you can tweak it as
necessary. For this project demonstration the best choice was minimum both sensitivity and time
day

19
3.1.2 GSM modem testing

To test the GSM, it needs the Arduino program installed in the computer, Arduino, three male
and female connecting wires and GSM modem, connection is as defined in the sketch program.
Run the Aduino program, select file in menu, then in examples look out for sim800l and chose
the sendSMS example, by default the connection is RX to TX, TX to RX and reset to reset, you
can change this to any pin by defining the pins in the program and then upload it to the Arduino.

Once GSM initialized for about 60 sec using AT commands to verify its functionally observe the
led blinking, initially after powering the GSM its indicator LED blinks on for one second and off
for one second, when the GSM gets connected to the network the blinking of indicator LED
changes to three seconds off and one second on, for the Arduino GSM shield to sends an SMS
message SIM card should be loaded with airtime, open the serial monitor, and wait for the
"READY" message to appear in the monitor. Next, type a message to send and press "return".
Then enter the phone number to receive the text message. After 2 to 3 seconds SMS was
received

3.2 Writing Code

#include <SoftwareSerial.h>
SoftwareSerial mySerial(3,4); // RX and TX pins to communicate with GSM module
#define msg_key 7
String number ="790962901"; // Add the 10-Digit Mobile Number to which message /call is to
be made,by replacing the 0's
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
pinMode(msg_key,INPUT);
pinMode (8, OUTPUT);
digitalWrite(msg_key,LOW);
digitalWrite(8,HIGH);
delay (40000);
}
void loop()
{
//Sends an sms everytime msg_key goes high

20
if (digitalRead(msg_key)==HIGH) // Check if the sms key is being high
{
mySerial.println("AT+CMGF=1"); // Set the Mode as Text Mode
delay(150);
mySerial.println("AT+CMGS=\"+256"+number+ //number in international format.
delay(150);
mySerial.print("Warning! Intruder Alert!"); // Enter the message
delay(150);
mySerial.write((byte)0x1A); // End of message character 0x1A :
delay(50);
mySerial.println();
digitalWrite (8, LOW);
delay (2000);
digitalWrite (8,HIGH);
delay (3000);
digitalWrite (8, LOW);
delay (2000);
digitalWrite (8,HIGH);
delay (300000);
}

3.3 Construction and testing

There different components that we tested differently on the bread board before Fabrication of
the enclosure for the whole system into adaptable box for display purpose, insulated materials
were used so as to avoid short circuits. Soldering Iron and soldering wire were used to fix all the
components on the printed circuit board (PCB). The system was fixed by use of screws on to the
base of the box to ease its use and make it safe for the end user.

The components were connected to the PCB as per the fig below, basing on the calculations and
design.

21
3.3.1 Circuit diagram

Figure 11: Showing the circuit diagram of the system.

3.3.2 Connection of the circuit

The above program was first uploaded to Arduino before any connections were made to avoid
errors in upload while components are connected. The PIR is connected to pin 7 of Arduino
which is configured as the message key in the program, the buzzer I/O pin is connected to pin
7of the Arduino, the GSM modem RX and TX pins are connected to SG1 and SG0 respectively.
All the components ground should be made common and the Arduino is powered using a USB or
7805 power supply.

3.3.3 Results and discussion

Figure 12 shows the SMS communication capture from a mobile phone. The developed GSM
based security system gives good response to the sensor and sends SMS when it detects the
intrusion at the door. The time taken by the system to deliver the SMS is dependent on the

22
coverage area or range of the specified mobile network. the mobile was in the range of the
system and the SMS was delivered in 25-30 seconds .

The buzzer alarm came on immediately the delay time of 40 second elapsed as defined in the
program, it sounded for 2 seconds went off for 3 seconds and then came on for more 2 seconds
and finally went off even while motion was still detected. This was just as the program defined it
in the program code written above.

Figure 12: SMS received from system by a mobile phone

23
CHAPTER 4: CONLUSIONS AND RECOMMENDATION

4.1. Conclusion

Generally, the project was completed successfully though there have been challenges on
hardware such as fine tuning the sensor to work simultaneously with the burnt program inside
the microcontroller, identifying components on the market, which was eliminated by providing
good and accurate anticipated results. There was also problem of making a systematic design for
which the first design was hard to be implemented on the circuit board; therefore we had to
redesign it again to proper and simple designs which ease the component layout and soldering.
The project undertaken helped us to gain a better perspective on various aspects related to our
course of study as well as practical knowledge of electronic equipment and communication
Coupled with familiarization of software analysis, designing, implementation and testing the
project.
The extensive capabilities of this system make it so interesting. From the convenience of a
simple GSM, a user is able to remotely know the status of their homes.

4.2. Recommendations

The future implications of the project are very great considering the amount of time and it saves.
The project we have undertaken can be used as a reference or as a base for realizing a scheme to
be implemented in other projects of greater level such as weather forecasting, temperature
updates, device synchronization, etc. The project itself can be modified to achieve a Home
security System which will then create a platform for the user to interface between himself and
his household like control the house appliances.

24
REFERENCES

Anil, (2007), Digital electronic 4th edition, Vol. 70 (2).

Z. Ahmed, "HOME AUTOMATION", Zeeshan Ahmed (2009) AeroFighter 2D Gaming In:


9th National Research Conference onManagement and Computer Sciences, SZABIST Institute
of Scienceand Technology, Pakistan
"Power Electronics by M D Singh and K B Khanchandan

"Linear Integrated Circuits by D Roy Choudary & Shail Jain

"Electrical Machines by S K Bhattacharya

"Electrical Machines II by B L Thereja

http://www.academia.edu/9331497/GSM_Based_Intelligent_Home_Security_System_
for_Intrusion_Detection

http://www.cellular.co.za/gsm-features.htm

http://www.tutorialspoint.com/gsm/gsm_overview.htm

http://www.awarehome.gatech.edu/

25
APPENDIXES

Appendix A: The time schedule for project

Table 2: The time schedule for project

26
Appendix B: Characteristics of Component Used

ARDUINU UNO

Description Specifications
Microcontroller: ATmega328
Operating Voltage: 5V
Input Voltage (recommended): 7-12V
Input Voltage (limits): 6-20V
Digital I/O Pins: 14 (of which 6 provide PWM output)
Analog Input Pins: 6
DC Current per I/O Pin: 40 mA
DC Current for 3.3V Pin: 50 Ma
Flash Memory: 32 KB of which 0.5 KB used by boot loader
SRAM: 2 KB (ATmega328)
EEPROM: 1 KB (ATmega328)
Clock Speed: 16 MHz

Table 3: Characteristics of ARDUINU UNO

PIR Sensor.
Description Specifications

Sensitivity range: up to 20 feet (6 meters) 110 x 70 detection range

Power supply 5V-12V input voltage for most modules (they have
a 3.3V regulator
Size Rectangular
Output 3v
Table 4: Characteristics of PIR Sensor

27
GSM Modem

Table 5: Characteristics of GSM Modem.

Voltage Regulator

Table 6: Characteristics of Voltage Regulator

28
Appendix C: Project budget

ITEM QUANTITY UNIT COST TOTAL COST


ARDUINO UNO 1 140,000 140,000
GSM modem 1 90,000 90,000
Sim Card 2 3,000 6,000
LED 1 500 500
PIR sensors 1 15,000 15,000
Buzzer 1 5,000 5,000
Multimeter 1 65,000 65,000
Resistors 1 500 500
Mobile Phone 1 500 40,000
Voltage source 1 28,000 28,000
Bread board 1 12,000 12,000
Male and female connectors 6 500 3,000
Adaptable box 1 10,000 10,000
PCB 1 5,000 5,000
Flexible wires 1m 5,000 5,000
TOTAL 420,000
Table 7: Showing the cost of system component

PROJECT ACTIVITIES COST


ACTIVITY COST Shs
Research 15000
Transport 20000
Communication 10000
Printing & binding 30000
photocopying 5000
Accommodation & feeding 100000
Total cost 180000
Table 8: Showing the cost for project activities

29
Appendix D: Photos

Figure 13: photos of the project.

30

You might also like