GSM-Based Security System

98
i GSM BASED SECURITY SYSTEM NURHAYATI BINTI SO’AIB 51211109271 Report Submitted to Fulfill the Partial Requirements for the Bachelor of Engineering Technology (Hons) in Electronic Universiti Kuala Lumpur MAY 2011

Transcript of GSM-Based Security System

Page 1: GSM-Based Security System

i

GSM – BASED SECURITY SYSTEM

NURHAYATI BINTI SO’AIB

51211109271

Report Submitted to Fulfill the Partial Requirements

for the Bachelor of Engineering Technology (Hons) in Electronic

Universiti Kuala Lumpur

MAY 2011

Page 2: GSM-Based Security System

ii

DECLARATION

I declare that this entitle GSM – based Security System is the results of my own

research expects as cited in the references. The report has not been accepted for any

degree and is not concurrently submitted in candidature of any other degree.

Signature : …………………………………………..

Name : …………………………………………..

Date : …………………………………………..

Page 3: GSM-Based Security System

iii

APPROVAL

We have examined this report and verify that it meets the program and University

requirement for the Bachelor of

………………………………………………………………………………

Date: …../.…./……… Signature: ……………………………………………..

Supervisor‟s Name: ……………………………………

Official Stamp:

Date: …../.…./……… Signature: …………………………………………….

Co-Supervisor‟s Name: ………………………………

Official Stamp:

Page 4: GSM-Based Security System

iv

ACKNOWLEDGMENT

Firstly, thank to Allah with His blessing I‟m finishing for my GSM-based

Security System project. I would like to express my sincere appreciation to my

supervisor, Mr Ahmad Basri bin Zainal for his guidance, advice and assistance

throughout the process of fulfillment of this final year project.

I am very grateful to get the guidance and advice from Mr. Ismail Bin Adam

as my co-supervisor. He always help to improve my knowledge about the

Programming C and troubleshoot the circuit. The sources given by him are useful

indeed.

I would also like to take this opportunity to thank my beloved parents and

siblings for always mentally and financially supporting me while completing this

project till the end.

My fellow course mates should also be recognized for their support. My

sincere appreciation also extends to all my friends and others who have provided

assistance at various occasions. Their views and tips are useful indeed.

Thank you for all.

Page 5: GSM-Based Security System

v

ABSTRACT

This project is designed to improve the security system. It based on the

application of PIC 16F877A microcontroller. The objective of this project is to build

a security system by using GSM modem. Since many years ago, security system has

been an essential part of home management system. It became important due the

increase number of crime in Malaysia every year. House is very important need of

living nowadays. So, the main goal of this project is to establish a security system

with send system service via Short Message Service (SMS). This project consists of

two main parts, hardware and software. For hardware part, the security system is

controlled by a microcontroller PIC 16F877A, Liquid Crystal Display (LCD), keypad

and GSM Wavecom modem. While for the software implementation, Proteus 7.2 for

PIC has been used for simulation. Besides, it also interfaces the microcontroller with

computer using UC00A USB to UART converter. This project successfully achieved

the main objective which is user was able to get the message using SMS and it

definitely can inform the user if have the criminal at home. It also can protect house

by using password door system. Thus, it is need to do testing for reliability and it also

can applied in the practical life because it just a simple and affordable system for

home to apply security system right now.

Page 6: GSM-Based Security System

vi

TABLE OF CONTENT

CHAPTER TITLE PAGE

TITLE PAGE i

DECLARATION ii

APPROVAL iii

ACKNOWLEDGEMENTS iv

ABSTRACT v

TABLE OF CONTENTS vi

LIST OF TABLES x

LIST OF FIGURES xi

LIST OF SYMBOLS xiii

TABLE OF APPENDICES xiv

1 INTRODUCTION

1.1 Introduction 1

1.2 Project Background 2

1.3 Problem Statement 2

1.4 Objective 3

1.5 Scope of Study 4

Page 7: GSM-Based Security System

vii

1.6 Project Expectation 4

1.7 Report Structure 5

1.8 Summary 6

2 LITERATURE REVIEW

2.1 Introduction 7

2.2 The Security System in Market

2.2.1 Maxtrigger Security System 8

2.2.2 Wireless Door Alarm 9

2.3 GSM Modem

2.3.1 Wavecom Fabstack Supreme 10 10

2.4 PIC 16F877A Microcontroller 12

2.4.1 The PIC Architectures 13

2.4.2 Special Features of Microcontroller 14

2.5 Handphone

2.5.1 Short Message Service 15

2.5.2 Example Application of SMS 16

2.5.3 Operating Mode 17

2.6 AT Command 17

2.6.1 Basic and Extended Commands 18

2.6.2 General Syntax of Ext AT Commands 18

2.7 Sensor

2.7.1 PIR Sensor 21

2.7.2 Limit Switch 22

2.8 Liquid Crystal Display (LCD) 23

2.8.1 System Overview 24

2.9 Keypad 26

2.9.1 Pin Connection 27

2.10 Summary 29

Page 8: GSM-Based Security System

viii

3 METHODOLOGY

3.1 Introduction 30

3.2 Design Flow 31

3.3 Project Architecture

3.3.1 Flow Chart 33

3.3.2 Block Diagram 35

3.4 Hardware Development

3.4.1 Controller Unit Design 36

3.4.1.1 Schematic Diagram 36

3.4.2 PIC Circuit Design 38

3.4.2.1 List of Component 39

3.4.2.2 PCB Layout 40

3.4.3 Switching

3.4.3.1 Push Button 40

3.4.3.2 Limit Switch 41

3.4.4 LCD 42

3.4.4.1 Schematic Diagram 43

3.4.5 Keypad 45 ssd 37

3.5 Software Development 45

3.5.1 Basic AT Command 46

3.5.2 Software Flow Chart 47

3.5.3 Programming Tool

3.5.3.1 CCS Compiler 48

3.5.3.2 UIC00A PIC Programmer 51

3.5.3.3 Board Layout 53

3.5.3.4 PICkit 2 v2.55 Compiler 54

3.6 Summary 58

Page 9: GSM-Based Security System

ix

4 RESULT AND ANALYSIS

4.1 Introduction 59

4.2 Hardware Result 59

4.3 Explanation Problem 60

4.4 Software Result 63

4.5 The Fully Result 65

4.6 Summary 67

5 CONCLUSION

5.1 Introduction 68

5.2 Conclusion 68

5.3 Suggestion for Further Work 69

REFERENCES 71

APPENDIX A 74

APPENDIX B 76

APPENDIX C 77

APPENDIX D 78

Page 10: GSM-Based Security System

x

LIST OF TABLES

TABLE NO. TITLE PAGE

2.8.1(a) Pin of LCD and its function 24

2.8.1(b) Parallel LCD Protocol 25

2.8.1(c) LCD Command Bit function and value 37

3.4.1.1 PIC Application 30

3.4.2.1 List of Component PIC Circuit 39

3.4.3.2 Limit Switch Functional 42

3.5.3.3 Board Function 54

4.2 Serial port Pin 62

Page 11: GSM-Based Security System

xi

LIST OF FIGURES

FIGURE NO. NO. TITLE PAGE

2.2.1 Maxtrigger Security System 8

2.2.2 Wireless Door Alarm 9

2.3.1 Wavecom GSM Modem 10

2.4(a) PIC microcontroller 12

2.4(b) PIC 16F877A ports 13

2.7.1 PIR Sensor 21

2.7.2 Limit Switch 22

2.8 (a) LCD 23

2.8 (b) Sample Source Code of LCD 23

2.9 Keypad 27

` 2.9.1 (a) Pin Connection 28

2.9.1 (b) Pin Connection of Keypad 28

3.1 Block Diagram of Flow Project 31

3.2 Flow Chart of Program 32

3.3.1 Flow Chart of Project 34

3.3.2 Block Diagram of Project 35

3.4.1.1 Schematic Diagram of Project 37

3.4.2 Circuit for PIC 16F877A Application and Interfacing 38

3.4.2.2 PCB layout of PIC 40

3.4.3.1 Push Button Diagram 40

Page 12: GSM-Based Security System

xii

3.4.3.2 Limit Switch 41

3.4.4.1 (a) Basic LCD Program 43

3.4.4.1 (b) Simulation of LCD 44

3.4.5 Keypad Operation 45

3.5 Basic Program AT Command 46

3.5.2 Programming Flow Chart of System 47

3.5.3.1 CCS Compiler 49

3.5.3.2 UIC00A PIC Programmer 51

3.5.3.3 Board Layout 53

3.5.3.4 (a) PICkit 2.0 Programmer 54

3.5.3.4 (b) PICkit Programmer Application 55

3.5.3.4 (c) Select Device Family 56

3.5.3.4 (d) Write Successful Status 57

3.5.3.4 (e) Write Error Status 57

3.5.3.4 (f) Select Device Dialog 57

4.2 (a) Complete Hardware Project 60

4.2 (b) Home Prototype 60

4.3 DB9 and MAX232 61

4.5 (a) System before ON 65

4.5 (b) System after ON 66

4.5 (c) The Information display on LCD 66

Page 13: GSM-Based Security System

xiii

TABLE OF SYMBOLS

PIC - Peripheral Interface Controller

SMS - Short Message service

PIR - Passive Infra-Red

LED - Light Emitting Diode

LCD - Liquid Crystal Display

EEPROM - Electrically Erasable Programmable Read-Only Memory

CMOS - Complimentary Metal-Oxide Semiconductor

CDMA - Code Division Multiple Access

TDMA - Time Division Multiple Access

3GPP - 3rd

Generation Partnership Project

MMS - Multimedia Messaging Service

WAP - Wireless Application Protocol

PDU - Protocol Data Unit

PCB - Printed Circuit Board

I/O - Input Output

RAM - Random Access Memory

ROM - Read-Only Memory

GSM - Global System for Mobile Communication

Page 14: GSM-Based Security System

xiv

TABLE OF APPENDICES

APPENDIX TITLE PAGE

A Datasheet of Resistor Array 74

B Datasheet of LCD 76

C Datasheet of Keypad 77

D Datasheet of PIC 16F877A 78

Page 15: GSM-Based Security System

xv

Page 16: GSM-Based Security System

xvi

Page 17: GSM-Based Security System

xvii

Page 18: GSM-Based Security System

xviii

Page 19: GSM-Based Security System

1

CHAPTER 1

INTRODUCTION

1.1 Introduction

Nowadays, the GSM technology applied in most our life widely. This

technology was introduces in communication rapidly. The GSM technology now can

apply for many field of life. The examples are access control, sensor, and solution of

environment.

This final year project is to study and understand about the GSM technology

in home security system. Meanwhile, also study how to improve the application and

reduce the cost.

The main component of this system divides by two parts. There are hardware

and software components. The main hardware is LCD, keypad, PIC 16F877A

microcontroller circuit and sensor. While, software components are using CCS

Compiler, PICkit 2.0, and Proteus 7.2. All components are combined together to

make one security system that can be applied for our life.

Page 20: GSM-Based Security System

2

1.2 Project Background

GSM-based Security System is a security system that is capable to

monitoring house and its compound. This system will monitor doors, windows or gate

at the house or any residential users. By using Microcontroller-based interface, two

ways communication can be implemented. Program C (CCS compiler) is use to

develop the specify structure of the security system. Additional supportive devices

such as push button, sensor, Liquid Crystal Display (LCD) and will make this system

more reliable.

The microcontroller will use as main controller to communicate between

device and user. The user can control device by communicate with controller by using

GSM technology. This project will go through part by part where:

i) Choose the microcontroller and programming.

ii) Application of GSM technology

iii) Analyze and reduce cost.

1.3 Problem Statement

At present, the government is focused on the safety of people in each district.

Security guards also are needed to ensure the safety of all the public areas. Recently,

the government urged the police take care of each high-risk crime areas. Security

system in the market is so widespread is required in every home or office. Even the

government requires the installation of CCTV cameras in every corner of the high-

risk areas.

Page 21: GSM-Based Security System

3

However, many more thefts and robberies occur in residential areas and

officials even if the security is in good condition. Every day there are only the cases

occurred in which all the people blaming each other. This means that the security

system in Malaysia is still a lot of weaknesses.

Through this project, we will improve our weaknesses, particularly the

security system that is already on the market. This project will also reduce the burden

on the police to take care of their civil rights, while many more cases pending to be

solved. The project will also provide a great convenience to the user to ensure the

safety of his own, without depending on hope the police or security guards.

The most interesting, this project gives facilities for users to connect directly

to the fire when emergency assistance is not only the police immediately. Consumers

will be more responsible in his area.

1.4 Objective

There are some objectives need to be achieved in order to accomplish this

project. These objectives will act as a guide and will restrict the system to be

implemented for certain situations:

1. To develop security system for standard house, office or residential area.

2. To use GSM as a medium to receive the message from sensor.

3. To develop the security system that must work effectively.

4. C language is use for developing program and system optimization.

Page 22: GSM-Based Security System

4

1.5 Scope Of Study

The scopes of this project are to design and fabricate a security monitoring

system. The project needs an understanding about the way of the connection between

PIC microcontroller to GSM monitoring system. The project need an understanding

about the data communication and will be a platform for that security application.

Proteus 7.2 is an engineering circuit design and drawing software for

electronic circuit designing for PIC 16F877A. The system should design with

standard components that available at market. This software aids us in showing the

reality before do it practically.

Serial data knowledge will be an important part in developing this project.

Programming knowledge is important in optimizing the source code for this project.

C language is a good tool to use for this project because it can be done a lot of

functions and compatible to PIC microcontroller.

The controller unit will send the information to user via short message service

(SMS) by through GSM modem. The user can get the information based on message

sent.

1.6 Project Expectation

Mainly this system will protect our resident such as home or office by

sending message to user that informs them the level of security.

Page 23: GSM-Based Security System

5

For earlier stage, this system will use to monitor doors and windows at our

homes. For future planning, this device can be extending by adding some features like

put the wireless system and display via PC.

This project is divided into two parts. At part 1, it will cover about the

hardware and the part 2 will cover the software. The hardware part is focus on to

develop and design the circuit, sensor device, controller unit, equipment and GSM

modem. Then the software part is on to write the programming for hardware part.

From this programming, it will connect with hardware, so that the controller unit can

communicate with GSM modem, sensor device, and equipment and send message to

handpone.

1.7 Report Structure

Chapter One: This chapter will tell us more detail about the introduction to my

project. The chapter more covering about project background, scope

and finally about projects expectations. This introduction gives a

confident about purpose of developing my project.

Chapter Two: This chapter will give scope of studies and research done in

understanding it more on the project.

Page 24: GSM-Based Security System

6

Chapter Three: This chapter will discuss the methods that use throughout the phases.

It content the types of hardware and software part used. These two

parts was important for each other to develop the project.

Chapter Four: This chapter show the result when the project was function. It includes

the image of the project. The result will show in two part that software

and hardware.

Chapter Five: This chapter is conclusion part. It gives the explanation to the reader

about overall of the project. There is some solution or suggestion of

upgrade the system.

1.8 Summary

The overall of this project is to study and explore the application of the

microcontroller in security system and communication with GSM modem. This

application will give the student for the new knowledge. Besides, let the user can get

the correct data control the equipment or device via short message service (SMS).

Page 25: GSM-Based Security System

7

CHAPTER 2

LITERATURE REVIEW

2.1 Introduction

This chapter reviews about previous system that has been developed and has

similarities with the remote control of a moving vehicle. This topic will also discuss

about the component that will be used in developing this systems.

There are a lot of products currently available in the market. The product

designed with intelligent and integrated but hte cost is expensive and need a contract

to sign. There are still have product more cheper but sometime it not be safe and

limitation monitoring. For this chapter, it will dicuss the security system that existed

in market and review all the component are used for this project. There are PIC

microcontroller, sensor, GSM Modem, AT Command and Handphone / Personal

Computer.

Page 26: GSM-Based Security System

8

2.2 The Security System in Market

2.2.1 Maxtrigger Security System

Figure 2.2.1: Maxtrigger Security System

MAXTRIGGER™ security system is a Malaysian made product and

is designed to be wireless with high pitch siren capable to deter away burglar,

hence save your valuables and life. The product operates at DC 12 V and has

backup rechargeable battery. It applies with wireless system and burglar alarm

system. It used burglar sensor to detect the unknown person. It also has

remote control to setting up this security for anytime. However, it still new in

market and the ordering only used online market.

Although MAXTRIGGER is simple and easy to use product, its

powerful 90dB high pitch siren will awaken you while the intruder panics and

run for his life. This concept is called: PREVENTION. Main Unit is able to

receive its sensor signal, even through concrete and brick walls, within a

radius of 30 meters ( 100 feet).[1] The step to use this security system is:

1) Plug to wall socket and switch ON the Main Unit.

2) Press Remote button 1 second and release for activation.

3) Your house will be protected from intruders.

Page 27: GSM-Based Security System

9

2.2.2 Wireless Door Alarm

Figure 2.2.2: Wireless Door Alarm

This is the fastest way to protect your home, office, apartment, RV

from Intruders and makes a great protection device for yourself. It uses a

magnetic sensor to detect the opening of a protected door or window, and

sounds a super loud alarm to alert you. It can also be used to alert you of an

opening of a Sliding glass door, door, window, Locker, Medicine cabinet,

Refrigerator, Gun cabinet and so on.

Here are 3 steps you can take to prevent a Break in:

1) Install a security system.

2) Post signs to warn criminals that your home is protected.

3) Install surveillance cameras

The operation instruction is, feel off the double sides adhesive tape,

attach the main sensor on the door/window and attach the stick adjacent the

main sensor on the door/window frame. Test the setup by switching on the

system of the main unit and see whether the alarm can be triggered by opening

the door/windows. It uses for secure your doors, windows, cabinets (anything

with a door). Besides, use as your personal security companion - slip one in

your bag. Switch the alarm ON in case of emergency [2].

Page 28: GSM-Based Security System

10

2.3 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 mobile phone, a GSM modem requires a SIM card from a wireless

carrier in order to operate.

2.3.1 Wavecom Fabstack Supreme 10

The Wavecom Fabstack Supreme 10 modem delivers all the power of

WISMO® technology in one unit[3]. This modem is built to withstand the

toughest environments. The figure 2.3.1 is shown the product features.

Figure 2.3.1: Wavecom GSM Modem

Page 29: GSM-Based Security System

11

To communicate with GSM modem, we need to use AT command. By using

this command, the user can communicate either by computer or PIC controller. 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:

Page 30: GSM-Based Security System

12

i. Reading, writing and deleting SMS messages.

ii. Sending SMS message.

iii. Monitoring the signal strength.

iv. Monitoring the charging status and charge level of the battery.

v. Reading, writing and searching phone book entries.

2.4 PIC 16F877A Microcontroller

The name PIC initially referred to "Programmable Interface Controller",

but shortly thereafter was renamed "Programmable Intelligent Computer"[4]. PIC

are popular with developers and hobbyists alike due to their low cost, wide

availability, large user base, extensive collection of application notes, availability of

low cost or free development tools, and serial programming (and re-programming

with flash memory) capability.

Figure 2.4(a): PIC microcontroller

Page 31: GSM-Based Security System

13

Figure 2.4(b): PIC 16F877A ports

PIC 16F877 (Microchip Technology, Inc.) 8-bit microcontroller will be used

for the controller. I was chosen to detect any switch triggered and generate the DTMF

tones according to the predetermined handphone number. This microcontroller has a

25 MHz processor (the current compiler runs the processor at 20 MHz), 33

input/output (I/O) pins, (8K*14words) of Enhanced FLASH program memory,

(368*8bytes) of RAM, (256*8bytes) of data EEPROM [5]. The PIC does not have an

operating system and simply runs the program in its memory when it is turned on.

2.4.1 The PIC architectures have several limitations:

A small instruction set.

Operations and registers are not orthogonal; some

instructions can address Random Access Memory (RAM)

and/or immediate constants, while others can only use the

accumulator.

Page 32: GSM-Based Security System

14

PIC microcontroller perfectly fits many uses, from automotive

industries and controlling home appliances to industrial instruments, remote

sensors, electrical door locks and safety devices. It is also ideal for smart

cards as well as for battery supplied devices because of its low consumption.

2.4.2 Special Features of Microcontroller

PIC 16F877A is a low power, high speed FLASH?EEPROM using

CMOS technology. It also has 100,000 erase or write cycle enhanced FLASH

program memory and has 1,000,000 rase or write cycle data EEPROM

memory typical. The PIC 16F877A provides the following feathers [6]:

(i) Wide operating voltage rage (2.0V-S.SV)

(ii) Programmable code protection

(iii) Power saving sleep mode

(iv) Watchdog Timer (WDT) with its own on-chip RC oscillator for

reliable operation

(v) Self-reprogrammable under software control

(vi) Single supply 5V in-circuit serial programming

(vii) Up to 8K x 14 words of FLASH program memory

(viii) Up to 368 x 8 bytes of data memory (RAM)

(ix) Up to 256 x 8 bytes of EEPROM data memory

(x) Only 35 single word instruction

(xi) Timer 0:8-bit timr/counter with 8-bit prescaler.

(xii) Timer 1:16-bit timer/counter with prescaler can be increment

during SLEEP via external crystal or c

Page 33: GSM-Based Security System

15

2.5 Handphone

The cell phone is the key player in wireless technology in today. The

technology make the possessing of a mobile a basic commodity and the trends in

wireless technology is changing from day-to-day.

2.5.1 Short Message Service (SMS)

This is a technology that enables the sending and receiving of message

between mobile phone. SMS first appeared in Europe in 1992. It was include

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

[7].

SMS text messaging supports languabe 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

provide 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.

Page 34: GSM-Based Security System

16

2.5.2 Example Application of SMS

SMS is a technology for delivering alerts and notification of important

events. There are two reasons:

(i) A mobile phone is a device that carried by its owner most of the

time. Wherenever 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 (spmetimes

with the help of a group of sensor) is constantly monitoring the status of the

remote system [8]. Is a certain condition is satisfid, 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 that the may be hanged.

Page 35: GSM-Based Security System

17

2.5.3 Operating Mode: SMS Text and SMS PDU

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 [9]. Following are the AT commands affected:

(i) +CMGS (Send Message)

(ii) +CMSS (Send Message from Storage)

(iii) +CMGR (Read Message)

(iv) +CMGL (List Message)

(v) +CMGW (Write Message to Memory)

(vi) +CNMA (New Message Acknoledgement to ME/TA)

(vii) +CMGC (Send Command)

2.6 AT Command

Electrically Erasable Programmable Read-Only Memory (EEPROM)

memory makes it easier to apply microcontrollers to devices where permanent storage

of various parameters is needed (codes for transmitters, motor speed, receiver

frequencies, etc.). Low cost, low consumption, easy handling and flexibility make

PIC applicable even in areas where microcontrollers had not previously been

considered (example: timer functions, interface replacement in larger systems,

coprocessor applications, etc.) [10].

Page 36: GSM-Based Security System

18

In System Programmability of this chip (along with using only two pins in

data transfer) makes possible the flexibility of a product, after assembling and testing

have been completed. This capability can be used to create assembly-line production,

to store calibration data available only after final testing, or it can be used to improve

programs on finished products.

2.6.1 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 [11].

2.6.2 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 [12].

Page 37: GSM-Based Security System

19

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>

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>

Page 38: GSM-Based Security System

20

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

Page 39: GSM-Based Security System

21

2.7 Sensor

2.7.1 PIR Sensor

Figure 2.7.1: PIR sensor

This PIC microcontroller based project uses PIC16F876A to interface

PIR sensor and read its status for alarm system. PIR can be used to detect

human motion. It demonstrates the method to interface PIR sensor with

microcontroller. It can further be modified to become alarm system. Cytron

Technologies uploaded this project with the aim to assist hobbyist and

students to pick up embedded system application and development [13].

Page 40: GSM-Based Security System

22

2.7.2 Limit Switch

Figure 2.7.2: Limit Switch

A limit switch is used to limit the activation of an electrical circuit.

When a circuit is “closed,” it allows the flow of electrical current through

the switch to pass to the device being powered. When the switch is “open,”

the switch is disengaged and no electrical power will pass through it. Whether

the limit switch is open or closed is generally determined either by the

position of a device being powered or by a set amount of time a device

requires completing a specific task.

The most common type of limit switch is a mechanical limit switch.

This switch tracks the location of a specific item and opens or closes when

that item reaches a specific location. The switch is activated by physical

contact, or lack thereof. For example, a light inside a car often turns on when

one of the doors is opened.

Page 41: GSM-Based Security System

23

2.8 Liquid Crystal Display (LCD)

Figure 2.8(a): LCD

2x16 character LCD is the most common message display device used to

display ASCII character. By using the SK40C, user is able to complete the circuit for

this project easily. Information which is includes sample source code, schematic and

detail description [14].

Figure 2.8(b): Sample source code of LCD

Page 42: GSM-Based Security System

24

2.8.1 System Overview

In this project, a JHD 162A (with black light) 2x16 character LCD will

be used. It has the same pin configuration with Hitachi HD 44780. LCD

breakout pin and its function are shown below.

Pin Name Pin Function Connection

1 VSS Ground GND

2 VCC Positive Supply for LCD 5V

3 VEE Contrast adjust Connected to a

preset to adjust

contrast

4 RS Select register, select

instruction or data

register

RB4

5 RW Select read or write GND (always write)

6 E Start data read or write RB5

7 DB0 Data bus pin RD0

8 DB1 Data bus pin RD1

9 DB2 Data bus pin RD2

10 DB3 Data bus pin RD3

11 DB4 Data bus pin RD4

12 DB5 Data bus pin RD5

13 DB6 Data bus pin RD6

14 DB7 Data bus pin RD7

15 LED+ Backlight positive input 5V

16 LED- Backlight negative input Connect to JP8

Table 2.8.1(a): Pin of LCD and its function

Page 43: GSM-Based Security System

25

This LCD may be interfaced in either 8 pins (8-bit interface) or 4 pins

(4-bit interface), depend on the I/O pin available. For PIC 16F877A which has

33 I/O pins, there should be no problem using the 8-bit interface which much

easier for software development. Pin 15 and 16 of LCD are for backlight

which is optional by connect or disconnect JP8. Switching on LCD backlight

will consume more energy and further dry up the battery faster. The third pin

(VEE) needs to be connected to a variable resistor to control the LCD

contrast, while the RW (read/write) pin is connected to the ground which

indicates the LCD is in write mode. RS and E are connected to RB4 and RB5

of PIC reactively. For data communication pins, DB0-DB7 (8-bits) is

connected directly to RD0-RD7 of PIC [15].

Before display any ASCII character, LCD needs to be initialized. The

Table 1 below is LCD protocol or function and table 2 LCD command bit

function and the value. Users need both tables to initiate LCD display.

Table 2.8.1(b): Parallel LCD Protocol

Page 44: GSM-Based Security System

26

Table 2.8.1(c): LCD Command Bit function and value

To initiate LCD, RS must be sent to logic 0 (Low) to indicate the data

send trough data pin (8-bit) is command. RS is set to logic 1 (High) to write

an ASCII character to LCD. LCD will need to be initialized in PIC program

according the table [16].

2.9 Keypad

Keypad is an array of switch. There will be 2 wires connected each time a

button is pressed. For example, when button „1‟ is pressed, pin 1 and pin 5 is

connected. There is no connection between rows and also columns. The buttons make

it connect. They are many types of keypad. Different types of keypad sometimes

come from different manufactures. And it maybe as different pin connection. User is

advised to check pin before use [17].

Page 45: GSM-Based Security System

27

Figure 2.9: Keypad

The keypad‟s pins need to be pulled up or pulled down to avoid floating case.

Pull up normally connect to 5V and pull down is connect to ground. 4x3 Keypad pin

can directly connect to microcontroller or keypad decoder IC.

2.9.1 Pin Connection

The figure below shows the internal structure of the 4x3 keypad.

Different brand or manufacturer of keypad has different architecture and

number of pin. For this kind of keypad, it consists of 8 pins. When button 3 is

pressed, the pin C4 and pin R2 will short while the others are open [18].

Page 46: GSM-Based Security System

28

Figure 2.9.1(a): Pin Connection

The figure below shows the internal structure of 4x3 keypad from

other manufacturer. For this kind of keypad, it consists of 8 pins and only 7

pins are used. Pin 8 is unused. When button 3 is pressed, the pin C3 and pin

R1 will short while the others are open.

Figure 2.9.1(b): Pin Connection for Keypad

Page 47: GSM-Based Security System

29

2.10 Summary

The main components of the project are described in this chapter. There are

have two functional in this security system. First, the system can detect unknown

person when the user activated this system. PIC Microcontroller will read the data

when the sensor activated. Then, the GSM get data from PIC Microcontroller to send

message for user by using handphone.

To communicate between GSM modem and hand phone, AT Command is a

basic command need to be study and learning. It is important to apply this project.

Because of that, the GSM modem just only understands AT Command declaration.

From this, it can communicate with hand phone, computer and PIC board.

To accomplish for this project, the entire component must be work effectively

based on objective. The GSM as a medium to receive the message from PIC

microcontroller is the same application with handphone. Programming C is used for

PIC board application to develop program and system optimization. In the simple

application, this security system can be used for our life whether in the house, office

or residential area.

Page 48: GSM-Based Security System

30

CHAPTER 3

METHODOLOGY

3.1 Introduction

This chapter will give an explanation about the method that used in this

project. It will be including the description of the design flow, design architecture and

detail explanations for the software development (compiling process, assign pin

location and run programmer) as well as hardware development Liquid Crystal

Display (LCD), sensors, push button and PICKits downloaded cable. Figure 3.1

shows a phases and project flow for this project. There are five phases to complete

this project:

Page 49: GSM-Based Security System

31

Figure 3.1: Block Diagram of flow project.

3.2 Design Flow

Based on the requirement, the design is divided into two developments;

software development and hardware development. In order to confirm the system is

working, the programming needs to be done correctly.

Page 50: GSM-Based Security System

32

Figure 3.2 shows the complete process that will be covered.

Figure 3.2: Flow Chart of program

END

Design the Circuit are related

Learn about PIC Microcontroller device and

GSM module how it work

Writing the programming C with it source

code

Compile and download source code using

Proteus or MPLAB v7.0

Modified to meet the standard

requirement for security system

START

RUN

OK Troubleshoot and

repair hardware or

software

Optimize the

source code

Page 51: GSM-Based Security System

33

The GSM-based Security System need do a lot of studying, researching and

troubleshooting. The first step, knowledge about PIC Microcontroller and GSM

modem must be studying for the basic function. There must have some circuit to be

design. The programming C must be writing in CCS Compiler for interface. It

become with some source code. The circuit and program have to compile and

download the source code using Proteus 7.2. When the program can be running, the

next step is to modify to meet the standard requirement for security system. If the

program getting error, the source code have to optimized and then try to running

again until successful. If the entire program is no error, we can troubleshoot the

circuit to get the best result. The troubleshoot will repair the hardware and software

component better.

3.3 Project Architecture

3.3.1 Flow Chart

Figure 3.3 shows the project architecture. It has shown the overall

process flow for the software and hardware development. In this project, push

button and sensor are the input of microcontroller. Meanwhile, the hand

phone/PC as the output for this project.

Page 52: GSM-Based Security System

34

Figure 3.3.1: Flow Chart of project

After studying about programming, I need to design some program related to

this system. Every program related are compiled in CCS Compiler. The pin location

placed for each component in Proteus 7.2. The program from CCS Compiler was

running in Proteus to see whether the hardware functions or not. After that, develop

the circuit based on simulation by adding the push button and sensor. Then, combine

it with PIC 16F877A Microcontroller to see the result. For final process, all the

hardware connected to GSM Modem.

Program Design

Compiling Process

Assign Pin

Location

Run Program

Push Button

Sensor

PIC 16F 877A

Microcontroller

GSM

Modem

Page 53: GSM-Based Security System

35

3.3.2 Block Diagram

Description of Block Diagram as followed below.

Figure 3.3.2: Block Diagram of project

There are two function in this program. The PIC 16F877A is a core of

this project. The entire program will be control through the microcontroller.

The limit switch and keypad is the input. First, when the limit switch activate,

will give the signal for PIC. The data from PIC will send to GSM. The

handphone/PC as the output will get the message from GSM modem. Second

operation is when the password entered, the PIC contoller will get the data and

the door will be open. However, when the user enter for the wrong password,

the door is not open. The message will display in LCD as the output. This is

for door security system.

GSM

Buzzer

Limit

Switch

PIC

16F877A

Micro

controller

Handphone

/ PC

Keypad

LCD

Page 54: GSM-Based Security System

36

3.4 Hardware Development

The hardware development for this project mainly referred to the project

architecture block diagram that has been visualized in the beginning of this chapter.

The architecture outlined the inputs and outputs of the system. The hardware

developments include PIC microcontroller, sensors, keypad, LCD and push button.

3.4.1 Controller Unit Design

This hardware is a part of interfacing in between input sensor,

application device, GSM modem and handphone. The controller unit will be

process in the input signal and turn ON/OFF/RESET the application needed

and at the same time, it will give information to handphone/PC through the

GSM modem.

3.4.1.1 Schematic Diagram

The hardware part are sensor (switch), PIC 16F877A

microcontroller, and 3 LEDs represent as output. This simulation is the

basic program to show how PIC 16F877A communicate with sensor as

switching and LED. This represent from input signal send to process

and respond to output signal.

Page 55: GSM-Based Security System

37

Figure 3.4.1.1: Schematic Diagram of Project

The PIC 16F877A is powered by adaptor power supply, 12

VDC 1A. The I/O ports at PIC were used as shown below.

I/O Port Application

C0 LED, Output response for Switch 1

C1 LED, Output response for Switch 2

C2 LED, Output response for Switch 3

A0 Push Button for Switch 1

A1 Push Button for Switch 2

A2 Push Button for Switch 3

Table 3.4.1.1: PIC Application

Page 56: GSM-Based Security System

38

3.4.2 PIC Circuit Design

The circuit is using PIC 16F877A and interfacing in Proteus. The

design PCB layout is shown in figure below. The PIC circuit have the power

supply regulator for 12V DC, and serial port communication.

Figure 3.4.2: Circuit for PIC 16F877A Application and Interfacing

Page 57: GSM-Based Security System

39

3.4.2.1 List of Component PIC circuit

Table 3.4.2.1: List of Component

No Component Quantity

1 IC 16F877A 1

2 IC 7805 1

3 IC MAX 232 1

4 20Mhz Crystal Oscillator 1

5 Capasitor 470 uF 1

6 Capasitor 1 uF 4

7 Capasitor 100 uF 1

8 Capasitor 8 pF 2

9 Capasitor 100 nF 3

10 Resistor 10kΩ 2

11 Resistor 1.5kΩ 4

12 LED 1

13 Serial Port Connector DB9F 1

Page 58: GSM-Based Security System

40

3.4.2.2 PCB Layout Design

Figure 3.4.2.2: PCB layout for PIC 16F877A application

3.4.3 Part List for Switching

3.4.3.1 Push Button

Figure 3.4.3.1: Push button diagram

Page 59: GSM-Based Security System

41

Figure 3.2.3.1 shows push button criteria. When push button

are on release mode, the receive input at port A0 is „1‟ because of

there are current flow at the moment. When the push button are

depressed, port A0 will receive input „0‟. From these criteria, program

can be made by refer to the input came from push button, which is „1‟

or „0‟.

3.4.3.2 Limit Switch

Figure 3.4.3.2: Limit Switch

A limit switch is used to limit the activation of an electrical

circuit. When a circuit is “closed,” it allows the flow of electrical

current through the switch to pass to the device being powered. When

the switch is “open,” the switch is disengaged and no electrical power

will pass through it. Whether the limit switch is open or closed is

generally determined either by the position of a device being powered

or by a set amount of time a device requires completing a specific task.

Page 60: GSM-Based Security System

42

The most common type of limit switch is a

mechanical limit switch. This switch tracks the location of a specific

item and opens or closes when that item reaches a specific location.

The switch is activated by physical contact, or lack thereof. For

example, a light inside home often turns on when one of the doors is

opened.

Part3 Application

Limit Switch

1

“The door 1 is open”

Limit Switch

2

“The door 2 is open”

Limit Switch

3

“The door 3 is open”

Table 3.4.3.2: Limit Switch Functional

3.4.4 LCD

The LCD panel's Enable and Register Select is connected to the

Control Port. The Control Port is an open collector / open drain output. While

most Parallel Ports have internal pull-up resistors, there are a few which

don't. Therefore by incorporating the two 10K external pull up resistors, the

circuit is more portable for a wider range of computers, some of which may

have no internal pull up resistors.

Page 61: GSM-Based Security System

43

It makes no effort to place the Data bus into reverse direction.

Therefore it is hard wire the R/W line of the LCD panel, into write mode.

This will cause no bus conflicts on the data lines. As a result it cannot read

back the LCD's internal Busy Flag which tells us if the LCD has accepted

and finished processing the last instruction. This problem is overcome by

inserting known delays into the program.

The 10k Potentiometer controls the contrast of the LCD panel.

Nothing fancy here. As with all the examples, I've left the power supply out.

So, I can use a bench power supply set to 5v or use a onboard +5 regulator.

Remember a few de-coupling capacitors, especially if you have trouble with

the circuit working properly.

3.4.4.1 Schematic Circuit of the LCD

Figure 3.4.4.1(a): Basic LCD program

Page 62: GSM-Based Security System

44

Figure 3.4.4.1(b): Simulation in LCD and Virtual Terminal

This figure shown the schematic of the LCD based on

Simulation. The figure 3.4.4.1(a) shown the simulation for basic LCD

and the Figure 3.4.4.1(b) shown the simulation with AT command.

When the program running, the result will dispay in LCD. It also

shown in Virtual Terminal at RS 232.

Page 63: GSM-Based Security System

45

3.4.5 Keypad

Figure 3.4.5: Keypad Operation

3.5 Software Development

The flow chart for the system main program is shown in figure 3.00. When

the system in ON, the PIC 16F877A will initialize the modem until the system is

ready. When the system is ready, PIC board will send the SMS to hand phone with

message. Then the PIC will check whether the sensor is activated or not. If it

activated, PIC will send the message to handphone according which sensor is

activated. The system will continue to check and check again. This step will repeat

since the sensor activated.

Page 64: GSM-Based Security System

46

3.5.1 Basic AT Command

Figure 3.5: Example of basic program

AT //test GSM

OK //response

AT+CMGF=1 // define text format

OK // response

AT+CMGS=“phone number”<CR> //OK

Message to send <CTRL>&<Z> //+CMGS: 7

SEND SMS FROM STORAGE

AT+CMSS

Page 65: GSM-Based Security System

47

3.5.2 Software Flow Chart

The flow chart at Figure show complete program of this project.

NO NO

YES YES

Figure 3.5.2: Programming Flow Chart for the system

START

Initialize the

system

System is Ready:

GSM- based

Security System

Sensor

Activated?

Password

Activated?

Send SMS:

The door is OPEN

Door Open:

PASS

END

Page 66: GSM-Based Security System

48

3.5.3 Programming Tool

Programming tools are used to implement the task between hardware

and software. These tools of programming are selected based on the chip

products that are used during this project.

3.5.3.1 CCS Compiler

CCS Compiler is a powerful, feature rich development tool for

PIC microchip provide by CCS, Inc. this software offers a wide variety

of C Embedded Development Tools for Windows or Linux. It support

the PIC 10, PIC 12 PIC 14, PIC 16, PIC 18, PIC 24 microcontrollers

and dsPIC® DSCs. The CCS create this software is to provide the

simplest and most efficient solutions for Microchip PIC® MCU

development needs. The CCS Compiler has a generous library of

useful routines and ready-to-run example programs for hardware

peripherals. Your development productivity levels will easily exceed

all other compilers available [19].

Page 67: GSM-Based Security System

49

Figure 3.5.3.1: CCS Compiler for PIC

PIC and C programming are fit together well: PIC is the most popular

8-bit chip in the world, used in a wide variety of applications, and C, prized

for its efficiency, is the natural choice for developing embedded systems,

microC provide a successful match featuring highly advanced IDE, ANSI

compliant compiler, broad set of the hardware libraries, comprehensive

documentation, and plenty of read-to-run examples. CCS Compiler for PIC

features are:

Built-in libraries that work with all chips for RS-232 serial I/O, I2C,

discrete I/O and precision delays.

Serial I/O functions allow standard functions such as GETC() and

PRINTF() to be used for RS-232 like I/O.

Formatted printf allows easy formatting and display in HEX or

decimal.

Page 68: GSM-Based Security System

50

Multiple I2C and RS232 ports may be easily defined.

#use rs232() offers options to specify a maximum wait time for getc.

Hardware tranceiver used when possible, but for all other occasions

the compiler generates a software serial transceiver.

Microcontroller clock speed may be specified in a PRAGMA to permit

built-in functions to delay for a given number of microseconds or

milliseconds.

Functions such as INPUT() and OUTPUT_HIGH() properly maintain

the tri-state registers.

Compiler directives determine if tri-state registers are refreshed on

every I/O or if the I/O is as fast as possible.

Simple functions like READ_ADC() to read a value from A/D

converter.

Source code drivers included for LCD modules, keypads, 24xx and

94xx serial EEPROM, X10, DS1302 and NJU6355 real time clocks,

Dallas touch memory devices, DS2223 and PCF8570, LTC1298 and

PCF8591 A/D converters, temperature sensors, digital pots, I/O

expander and much more.

133 ready-to-run programs included.

CCS Compiler allows quick development and deployment of

complex applications:

Page 69: GSM-Based Security System

51

3.5.3.2 UIC00A PIC Programmer

Figure 3.5.3.2: UIC00A PIC Programmer

UIC00A offer low cost yet reliable and user friendly PIC USB

programmer solution for developer, hobbyist and students. It is

designed to program popular Flash PIC MCU, On board ICSPTM (In

Circuit Serial Programming) connector offers flexible method to load

program. It supports on board programming which eliminate the

frustration of plug-in and plug-out PIC MCU. This also allow user to

quickly program and debug the source code while the target PIC is on

the development board. Since USB port have become a popular and

widely used on Laptop and Desktop PC, UIC00A is designed to be

plug and play with USB connection. This programmer obtained it

power directly from USB connection, thus NO external power supply

is required, making it a truly portable programmer. This programmer is

ideal for field and general usage. UIC00A offers reliable, high speed

programming and free windows interface software [20]. It is design

with capabilities and features of:

Page 70: GSM-Based Security System

52

Industrial grade PCB with surface mount component to offer

small size yet reliable and quality product.

Every component is soldered properly and programmer is

tested before it is shipped to customer.

USB Plug and Play function

IDC box header for ICSP connection, an IDC cable is included

for external on board programming.

Windows XP compatible software

Compatible with Windows Vista

Auto load program capability

Compatible with Microchip‟s PICkit 2.

Optional external power to target PIC should be +5V

Small size of 5cmx2.5cm.

Powers directly from USB port.

No external power required for UIC00A to function

USB 2.0

Low cost yet reliable solution

Suitable for Laptop and Desktop PC

Optional socket (UIC-S) to program 18 pins, 28 pins and 40

pins PIC microcontroller.

Page 71: GSM-Based Security System

53

3.5.3.3 Board Layout

Figure 3.5.3.3 Board Layout

1. Mini USB port socket “A” is for USB connection to PC

desktop or laptop.

2. Switch at “B” is a push button which may used to initiate the

write device function when programmer> write on PICkit

button is checked.

3. Green LED at “C” is used to indicate the main power supply of

UIC00A. it should ON once USB connection from UIC00A to

computer or laptop is ready.

4. Red LED at “D” is used to indicate busy function such as

UIC00A is in program mode or is alerting that a function is in

progress.

5. IDC box header at “E” is for programming cable. Please

connect one end of programming cable to this header, while the

other end to target board.

Page 72: GSM-Based Security System

54

Label Function

A Mini USB port socket

B Switch to initiate write device programming

C Main power supply indicator LED (green)

D Busy indicator LED (red)

E IDC Box Header for programming connector

Table 3.5.3.3: Board Function

3.5.3.4 PICkit 2 v2.55 for PIC Compiler

PICkit 2 v2.55 Compiler is ready to be used with PICkit 2

programming software. This section gives instruction on how to get

started with UIC00A [21]. With the help of pictures and some simple

instruction, following section illustrates the steps using UIC00A

shown at figure 3.5.3.4.

Figure 3.5.3.4(a): PICkit 2 Programmer Connector Pinout

Page 73: GSM-Based Security System

55

1. Connect the UIC00A as shown in section 5 (hardware installation).

2. Launch PICkit 2 programming software by selecting Start>

Program> Microchip> PICkit 2.

The following programming interface appears and notifies that

the PICkit 2 and target device found and connected.

The programmer is able to automatically detect PIC from

connected target and display it in the Device Configuration

window.

Figure 3.5.3.4(b): PICkit Programmer Application

To connect to the target device once the application software is

already running, select Device Family as shown in Figure 3.18

below.

If device is successfully detected, the model name will

appeared at “Device Configuration” area.

Page 74: GSM-Based Security System

56

Figure 3.5.3.4(c): Select Device Family

3. UIC00A can supply power to the target device. However, users are

advised to power the target device externally to prevent this

programmer exceed from 150mA current unit. For UIC00A, the

“VDD target” will automatically be 5.0. user should powered +5V

to the target PIC.

4. Go to File and select Import Hex. Browse for the Hex file location

and open to start import the Hex file.

5. After Hex file has been successfully imported, the target device

can be programmed by clicking on Write. The PIC will be erased

and programmed with the new Hex code imported. The operation

status will display on the Status Bar and the status bar will turn to

GREEN if writing is successful shown as Figure. Now the PIC is

ready to use.

Page 75: GSM-Based Security System

57

Figure 3.5.3.4(d): Write Successful Status

Figure 3.5.3.4(e): Write Error Status

Figure 3.5.3.4 (f): Select Device Dialog

Page 76: GSM-Based Security System

58

3.6 Summary

In this chapter it shown the methodology process for to hardware development

and software development to make the project is successful. The hardware

development more focuses on circuitry that will use according to sensor device and

microcontroller. This is for achieving the objective that develop the simple security

system at home, office and residential area.

GSM modem as a medium to send message can be program the source code at

CCS Compiler. Hyperterminal code can be applied to this software for stored data at

GSM modem.

The software development more focuses on creates programming software

that will transfers or load into PIC microcontroller. It shown the step start with

program flow chart and design the program using C language and compile into HEX

file format and then load into PIC 16F877A by using PICkit 2 software and UIC00A

PIC Programmer device to achieve the objective of project effectively. C language is

to develop the program and system by using CCS Compiler source code.

Page 77: GSM-Based Security System

59

CHAPTER 4

RESULT

4.1 Introduction

This chapter discusses the result of the project. It shows that the GSM-based

Security System was developed. This chapter also discusses the major problem

structured. All problems were solved.

4.2 Hardware Result

The GSM-based Security System has been successfully implemented. For

hardware construction and interfacing, tests have been carried out to verify the circuit

correctly. The figure has shown the hardware that has been development.

Page 78: GSM-Based Security System

60

Figure 4.2(a): Complete Hardware Project

1. LCD – display instruction

2. Keypad – press password and phone number. It also can changed any

information related.

3. Limit Switch / Sensor – activated system

4. Controller Unit (in casing) – stored data

5. GSM Modem (in casing) – receive and send message

Figure 4.2 (b): Home Prototype

1

2

4

3

5

Home Model – Detect the unknown person at door

Page 79: GSM-Based Security System

61

4.3 Explanation Problem

The hardware starts with ON the power supply and all the information

display at LCD. There are no problem when to construct the limit switch and sensor.

However, the system cannot detect the PIR sensor properly even this sensor is

function. The main problem on this hardware is the GSM Modem (Wavecom model)

cannot be function. So, the message cannot be send to user. Besides, I have problem

with serial port controller unit using MAX 232 [22]. This serial port is used to

communicate with GSM modem.

Female

Male

Figure 4.3: DB9 and MAX 232

The pin 25 (Transmitter) and pin 26 (Receiver) of PIC are connect to pin 11

(T1 in) and pin 12 (R1 out) of MAX232 respectively. Pin 14 (T1 out) and pin 13 (R1

in) of MAX232 are connect to pin 2 (Rx) and pin 3 (Tx) of DB9 connector (female).

Pin 5 of DB 9 connector connect to ground. Then pin 1,4,6 of DB9 connector need to

shorted each other and pin 7, 8 also need be shorted. Mostly, it is not working at all.

The solution is to do some modification at the circuit.

Page 80: GSM-Based Security System

62

The problem are solving in three step:

(1) Short pin 4 and 7 of the DB9 connector and connect to pin 7 of Max

232 IC.

(2) Connect pin 10 of MAX232 to ground.

(3) Connect pin 8 of MAX232 to VCC through 1K resistor.

The step 1 and 2 are make DTR and RTS will be enabled high (10V) for

GSM modem. This will ensure that the status of PC‟s connector pins match with the

controller connector. Step 3 is for (Rx) gate is not left open.

Pin Number Description

1 CD – Carrier Detect

2 RXD – Receive Data

3 TXD – Transmit Data

4 DTR – Data Terminal Ready

5 GND – Signal Ground

6 DSR – Data Set Ready

7 RTS – Request To Send

8 CTS – Clear To Send

9 R1 – Ring Indicator

Table 4.2: Serial Port Pin

After the modification, the PIC and GSM modem can communicate

successfully.

Page 81: GSM-Based Security System

63

4.4 Software Result

There was having some problems when do the simulation in Proteus. During

the simulation, I faced main problem for LCD and keypad. The hardware in Proteus

cannot get the result based on programming done. It is difficult to compare with

actual hardware.

The other problem is, the GSM Modem cannot detect the data from PIC. So,

the user cannot get the message if the system is activated. There was a problem when

I try to transfer data to Visual Basic for upgrade. The system cannot function when it

connect with VB.

For solving with these three problems, it must do some troubleshooting and

checking error.

Problem 1: The GSM Modem cannot detect the data from PIC.

Solution: After transfer program into PIC at the controller unit, the data is

connecting to PC and communicate using hyperterminal to verify connection on

serial port. The result shows that the connection is “OK”. Then the same step is

followed by replace the controller unit with GSM modem. The result also shows

“OK”. Here, the problem may cause by the main program, there need to do

initialize the GSM modem first before can send SMS to handphone/ PC.

Page 82: GSM-Based Security System

64

Problem 2: The PIC cannot process the SMS when received.

Solution: This problem is because the GSM cannot be read with PIC data. I have

to find the error in programming. From the reading some information about AT

command, I found the solution. In my system, bound rate of GSM is 115200, so

the PIC circuit cannot be communicate with larger value. After that, I changed the

GSM modem with lower value that 9600. Finally, the data successfully can be

sent.

Problem 3: The system cannot function in Visual Basic.

Solution: I‟m still new in Visual Basic knowledge. It must do a lot of reading and

study. The system is now can function for handphone. I want to upgrade this

system to PC. However, there were the problem when transfer data to VB. For

this solution, I just do some program in Visual Basic without do as my system. I

need to study a lot with this program. So, for the future plan, I will upgrade this

system myself and tell the next student to try this application.

Page 83: GSM-Based Security System

65

4.5 The Result in Fully Function

In this part, there will display and show how the system is function. The

result will show based on picture and explanation.

Figure 4.5(a): System before ON

The system is already finished by using prototype. The system placed in

casing and the application used in home model.

Figure 4.5(b):System after ON

Page 84: GSM-Based Security System

66

Figure 4.5 (c): The information that display in LCD

When the push button ON, the LCD will display “PRESS: #, SECURITY

OFF”. Press the „*‟ button, the LCD shows “SECURITY ON”. When press „#‟, the

LCD were display “ENTER PASSWORD”. The password must be entered in 6

digits. When the password entered is true, the LCD will display “SECURITY

DISABLE”. Then, pressed „*‟ to change the LCD with “SECURITY ENABLE”. The

system has been activated. When keypad presses „#‟, it will show “PHONE

NUMBER”. It means that, we enter the phone number for sending the message.

The limit switch is closed the door. There is having 3 doors to be detected

from the system. When the door is open, the limit switch will be activated. It will

send the data to PIC 16F877A for storing. The PIC will send the data to GSM

Modem. Lastly, the GSM will send the message to phone number that entered. The

user will get the message “WARNING! Someone is in your home. Door 1 is Open”.

For adding information, the user can get message if all three doors is open. For

example, the system will send the message “Door 1 is Open, Door 2 is Open, Door 3

is Open”.

System is

activated

Enter the

password

System

is ON

The door

is open

User get

message

Example

message

WARNING,

someone in your

home.

Door 1 is Open

SECURITY:

ENABLE

Example

password

ENTER

PASSWORD:

123456

SYSTEM

ON:

PRESS #

Page 85: GSM-Based Security System

67

4.6 Summary

This chapter show the fully result of the project development. The operations

for this system have two main functions. First, when user activated this system, the

sensor will activate. The information to user‟s handphone received when the sensor

detect unknown person. This operation including three main hardware that GSM

modem, PIC microcontroller and switch. The switching is to ON the sensor, PIC

microcontroller and GSM modem stored data before send message to handphone.

Second application is, the user can activated the password when they want to

leave the house. They just press keypad button for activated password. The password

can changed for anytime time same goes with the user‟s phone number. It is more

effectively for user when they felt not secure with older password setting.

For problem solving, it will give take advantages for me to know more about

the project and operation‟s system, problem happened and action taken. The problems

faced in both of part that hardware and software. The entire core problems have been

successful fixed. This is important how to troubleshoot any problem existed. After do

trying and error, this system can be development follow the planning.

The main solution I taken to solve the problem is to trying and error the GSM

modem connection between PIC microcontroller and Hyperterminal. Second, I was

changed the boundrate of GSM with lower value to get the ideal result. After finished

the system, I try to upgrade the system for PC application. However, it cannot to be

done because of limitation time. Besides, I faced many time of problem when to

develop the circuit for each component.

For limitation issues are, I have to study about the communication knowledge

besides electronic. It is take some time to understand properly. I have to research

more how to connect PIC with GSM. To upgrade the system, it is not enough to learn

more about Visual Basic. Lastly, I applied this system for handphone and not to PC.

Page 86: GSM-Based Security System

68

CHAPTER 5

CONCLUSION

5.1 Introduction

This chapter will discuss the conclusion of the project. There are some

solution needs to discuss about it weakness in this project and how to solve it later.

The suggestion of further work to upgrade the system is also for this chapter.

5.2 Conclusion

In conclusion, it can be claimed that the project of GSM to handphone

provide benefits in developing the security system for standard house, office and

residential area. By only power supply 12 V, low-cost PIC Microcontroller and sensor

circuit, this security can be applied at any houses, offices or shops as long as they

have the handphone or PC. This is used GSM modem as a medium to receive the

message from sensor detection.

Page 87: GSM-Based Security System

69

This system are work effectively in simple function but practical. Hopefully,

this project can be commercialized for new application. For example this security

system can be applied to police station and fire bridget. It is because in Malaysia, we

have not yet any security information for them to secure our home. We do not need

calling to police when the robber entered our home. It takes time than we create a

system to tell them via GSM system. Lastly, the application by using program C is

very useful for developing program and system optimization.

5.3 Suggestion for Further Work

This GSM-based Security System has been successfully function and

developed with the basic application. However, this system can be upgrade with new

component and application. At present, we can see that the technology very rapidly

change and develop. Then, this project must have better application in the next stage

of research. For future improvement, there are several suggestions can be continued

in my project:

i. Instead of security system using GSM modem can apply with several

user number phones to send the message in one application.

ii. Add this project with send and reply message. It means that the user

can send the message back after he/she get the message. For example,

he can send the message to close the door immediately.

Page 88: GSM-Based Security System

70

iii. Add another sensor for the system like smoke sensor, temperature

sensor and burglar alarm system. It also can add any sensor that can

apply in home security.

iv. Upgrade the system with placed the CCTV and recorded the situation

in several time. After that, the video can send the user for information.

v. Make the system can communicate with the PC by using Visual Basic

or Web Server. It can inform the user in another place or used for

police and fire bridget.

Page 89: GSM-Based Security System

71

REFERENCE

[1] Home Security System, Wireless Alarm System

http://www.maxtrigger.com/

[2] GSM project, the sample of project by using GSM modem

http://www.epemay.com/

[3] GSM modem – Wavecom Fastrack Supreme 10.

http://www.mobitek.com.my/Wafecom/Supreme10.html

[4] Martin Bates, Interfacing PIC Microcontroller: Embeded Design by

Interactive Simulation, Elsevier 2006.

Problem with PIC16F877A, CCS Compiler – View topic.

http://www.ccsinfo..com/forum/view topic.html

[5] Julio Sanchez, Microcontroller Programming, CRC Press, 2007.

Richard Barnett, Larry O‟Cull and Sarah Cox, Embeded C Programming

and the Microchip PIC, Thomson Delmar Learning, 2004.

[6] Yashavant P. Kanetkar. Let Us C Fifth Edition, Kicit, 2004.

How to use PIC, PIC lesson.

http://www.shahrulnizam.com/piclesson/

PIC 16F877A Manual Datasheet, Microchip Technology Inc.

http://www.microchip.com/manual/pic16f877a

Page 90: GSM-Based Security System

72

[7] Forum, Communication between GSM modem and PIC

microcontroller.

http://www.edaboard.com/gsm+pic/forum

[8] Stuart R. Ball PE, Analog Interfacing Embeded microprocessor: Real

World Design, Second Edition, Elsevier, 2004.

[9] How To Use HyperTerminal, Hyperterminal in using for GSM.

http://www. developershome.com /howToUseHyperTerminal.asp.htm

[10] [11] Wavecom Fabstrack 20 GSM Modem

http://www.messaging4education.com

[12] [13] Password Access, PIC 16F877A with keypad.

http://www.edaboard.com/thread168002.html

[14] [16] LCD, Liquid Crystal Display Operation and the function.

http://www.cytron.com.my/usr_attachment/SIM300_ATC_V1.03.pdf

[15] LCD Application, Relationship between CGRAM Addresses,

Character Codes (DDRAM) and Character Patterns (CGRAM Data)

Initializing the LCD by Instruction

http://www.electronic-

engineering.ch/microchip/datasheets/lcd/lcd_data_sheets.html

[17] [18] Keypad, Datasheet and how it work.

http://www.cubloc.com/download/etc/keypad.pdf

http://www.comfiletech.com

[19] CCS Compiler IDE, Custom Customer Service Inc.

http://www.ccsinfo.com

Page 91: GSM-Based Security System

73

[20] UIC00A USB ICSP PIC Programmer, Cytron Technologies Sdn.

Bhd.

http://www.cytron.com.my/datasheet/Programmer/UIC00A_&_UIC-

S_Users_Manual

[21] PICkit 2.0 Programmer/Debugger User‟s Manual

http://www.pickit.com/

[22] Pctel.ATCommand Guide – MAX 232.

http://www.pctel.com/guide

Page 92: GSM-Based Security System

74

APPENDIX A

Page 93: GSM-Based Security System

75

Page 94: GSM-Based Security System

76

APPENDIX B

Page 95: GSM-Based Security System

77

APPENDIX C

Page 96: GSM-Based Security System

78

Page 97: GSM-Based Security System

79

APPENDIX D

Page 98: GSM-Based Security System

80