Upload
dinhngoc
View
252
Download
4
Embed Size (px)
Citation preview
UNIVERSITI TEKNIKAL MALAYSIA MELAKA
HOME SECURITY WITH GAS AND FIRE DETECTOR
This report submitted in accordance with requirement of the Universiti Teknikal
Malaysia Melaka (UTeM) for the Bachelor of Electronics Engineering Technology
(Industrial Electronics) (Hons.)
by
SITI FATIMAH BINTI MOHD AMIN
B071210223
910129-10-5536
FACULTY OF ENGINEERING TECHNOLOGY 2015
UNIVERSITI TEKNIKAL MALAYSIA
MELAKA BORANG PENGESAHAN STATUS LAPORAN PROJEK SARJANA MUDA
TAJUK: HOME SECURITY WITH GAS AND FIRE DETECTOR
SESI PENGAJIAN: 2015/16 Semester 1
Saya SITI FATIMAH BINTI MOHD AMIN
mengaku membenarkan Laporan PSM ini disimpan di Perpustakaan Universiti
Teknikal Malaysia Melaka (UTeM) dengan syarat-syarat kegunaan seperti berikut:
1. Laporan PSM adalah hak milik Universiti Teknikal Malaysia Melaka dan penulis. 2. Perpustakaan Universiti Teknikal Malaysia Melaka dibenarkan membuat salinan
untuk tujuan pengajian sahaja dengan izin penulis. 3. Perpustakaan dibenarkan membuat salinan laporan PSM ini sebagai bahan
pertukaran antara institusi pengajian tinggi.
4. **Sila tandakan ( )
SULIT
TERHAD
TIDAK TERHAD
(Mengandungi maklumat yang berdarjah keselamatan
atau kepentingan Malaysia sebagaimana yang termaktub
dalam AKTA RAHSIA RASMI 1972)
(Mengandungi maklumat TERHAD yang telah ditentukan
oleh organisasi/badan di mana penyelidikan dijalankan)
(TANDATANGAN PENULIS)
Alamat Tetap:
154 Jalan Parit Omar
Kg. Bukit Kuching
45800 Jeram, Selangor
Tarikh: ________________________
Disahkan oleh:
(TANDATANGAN PENYELIA)
Cop Rasmi:
Tarikh: _______________________
** Jika Laporan PSM ini SULIT atau TERHAD, sila lampirkan surat daripada pihak berkuasa/organisasi
berkenaan dengan menyatakan sekali sebab dan tempoh laporan PSM ini perlu dikelaskan sebagai
SULIT atau TERHAD.
FAKULTI TEKNOLOGI KEJURUTERAAN Tel : +606 234 6623 | Faks : +606 23406526
Rujukan Kami (Our Ref) : Rujukan Tuan (Your Ref) :
28 JAN 2016 Pustakawan Perpustakaan UTeM Universiti Teknikal Malaysia Melaka Hang Tuah Jaya, 76100 Durian Tunggal, Melaka. Tuan/Puan, PENGKELASAN LAPORAN PSM SEBAGAI SULIT/TERHAD LAPORAN PROJEK SARJANA MUDA TEKNOLOGI KEJURUTERAAN PEMBUATAN (ELEKTRONIK INDUSTRI) : SITI FATIMAH BINTI MOHD AMIN Sukacita dimaklumkan bahawa Laporan PSM yang tersebut di atas bertajuk “Home Security with Gas and Fire Detector” mohon dikelaskan sebagai *SULIT / TERHAD untuk tempoh LIMA (5) tahun dari tarikh surat ini. 2. Hal ini adalah kerana IANYA MERUPAKAN PROJEK YANG DITAJA OLEH SYARIKAT LUAR DAN HASIL KAJIANNYA ADALAH SULIT. Sekian dimaklumkan. Terima kasih. Yang benar, ________________ Tandatangan dan Cop Penyelia * Potong yang tidak berkenaan
NOTA: BORANG INI HANYA DIISI JIKA DIKLASIFIKASIKAN SEBAGAI SULIT DAN TERHAD. JIKA LAPORAN DIKELASKAN SEBAGAI TIDAK TERHAD, MAKA BORANG INI TIDAK PERLU DISERTAKAN DALAM LAPORAN PSM.
v
DECLARATION
I hereby, declared this report entitled “Home Security with Gas and Fire Detector” is
the results of my own research except as cited in references.
Signature :………………………
Name : ………………………
Date : ………………………
vi
APPROVAL
This report is submitted to the Faculty of Engineering Technology of UTeM as a
partial fulfillment of the requirements for the degree of Bachelor of Engineering
Technology (Industrial Electronics) (Hons.). The member of the supervisory is
as follow:
……………………………….
(Project Supervisor)
vii
ABSTRACT
Nowadays, so many alarm system and security systems are emerging in our markets
using high-tech techniques, but in this design use implementing a home automation
and security systems using GSM, GSM is one of the latest mobile technology using
smart MODEM which can easily interfaced to embedded microcontrollers. Now
everything is going to be automated using this technology, using this technology can
access the devices remotely. The common problem is always happened in the house
are the incident such as Gas Leak, Fire and Intruders. In any, of the above three cases
any one met while user are out of their home than the device sends SMS to user’s
phone. When gas leak it detected by gas sensor, for fire detected by flame sensor and
intruders detected by PIR sensor. I produce this project “Smart Home Plan”. This
project is aimed at developing the security. This project uses three circuits, namely,
PIC16F877A, MAX 232 and power supply.
viii
ABSTRAK
Pada masa kini, banyak sistem penggera dan keselamatan sistem yang baru muncul
dalam pasaran kita menggunakan teknik berteknologi tinggi, tetapi dalam reka
bentuk ini, saya melaksanakan automasi rumah dan sistem keselamatan
menggunakan GSM, GSM adalah salah satu teknologi mudah alih terkini dengan
menggunakan MODEM pintar yang boleh dengan mudah saling berkait bagi
pengawal mikro terbenam. Kini semuanya akan automatik menggunakan teknologi
ini, menggunakan teknologi ini kita boleh mengakses peranti dari jauh. Masalah
biasa yang selalu berlaku di dalam rumah adalah kejadian seperti gas bocor,
kebakaran dan penceroboh. Dalam mana-mana, satu daripada tiga kes di atas mana-
mana satu bertemu ketika pengguna berada di luar rumah mereka, daripada peranti
menghantar SMS ke telefon pengguna. Apabila gas bocor itu dikesan oleh sensor
gas, kebakaran dikesan oleh sensor api dan penceroboh dikesan oleh sensor PIR.
Saya menghasilkan projek “Pelan Pintar Rumah”. Projek ini bertujuan untuk
membangunkan keselamatan. Projek ini menggunakan tiga litar iaitu PIC16F877A,
MAX 232 dan kuasa bekalan.
ix
DEDICATIONS
Firstly, thanked to Allah for let me to finish this proposal. I thanked to my beloved
parents and friend for help and give a support and idea to do this project. This
dedication also give to my supervisor Mr Tengku Mohd Faisal Bin Tengku Wook for
guide from the first draft until presentation first in this subject.
x
ACKNOWLEDGMENTS
Firstly, we thanked to Allah for let us to finish our final project. We thanked to our
parents and friend for help and give a support and idea to us to do this project. This
appreciation also we give to our supervisor Mr. Tengku Mohd Faisal Bin Tengku
Wook for giving the guidance and support by sharing his expertise and knowledge
also some new idea in my project. I am very thankful for his advices and guidance
until the successfulness of the project. Lastly, not forget thanked to all those time,
concern and supports were given by my parents and friends during the process of
completing this report. I am thankful to everyone who always inspires me directly
and indirectly during the milestone of completing my final project.
xi
TABLE OF CONTENTS
DECLARATION ................................................................................................................... v
APPROVAL ......................................................................................................................... vi
ABSTRACT ........................................................................................................................ vii
ABSTRAK ......................................................................................................................... viii
DEDICATIONS ................................................................................................................... ix
ACKNOWLEDGMENTS ..................................................................................................... x
TABLE OF CONTENTS ..................................................................................................... xi
LIST OF FIGURES ........................................................................................................... xiv
LIST OF TABLE ............................................................................................................... xvi
LIST OF SYMBOLS AND ABBREVIATIONS ............................................................ xviii
CHAPTER 1 : INTRODUCTION ......................................................................................... 1
1.0 Introduction to Project ............................................................................................. 1
1.1 Background ............................................................................................................. 2
1.2 Problem Statement .................................................................................................. 2
1.3 Objectives ................................................................................................................ 3
1.4 Scope ....................................................................................................................... 4
1.5 Conclusion ............................................................................................................... 4
CHAPTER 2 : LITERATURE REVIEW .............................................................................. 5
2.0 Introduction ............................................................................................................. 5
2.1 Related Theory ........................................................................................................ 6
xii
2.2 Literature Theory ..................................................................................................... 7
2.3 Software Design Info ............................................................................................... 8
2.4 Basic System Interfacing ....................................................................................... 10
2.5 How to Program PIC Microcontroller ................................................................... 11
2.6 Data Sheet of the Components .............................................................................. 13
2.6.1 The MAX232 & MAX232A ................................................................... 13
2.6.2 Alternatives ............................................................................................. 16
2.6.2.1 Data Cables ............................................................................ 16
2.6.3 Comparison Wireless Transmission Media ............................................. 19
2.6.4 LM35 Sensor Datasheet and Circuit Schematic Overview ..................... 19
2.6.5 Push Technology ..................................................................................... 21
2.6.6 General Use ............................................................................................. 21
2.6.6.1 AT Command Supporting GSM Mobile Phone ..................... 22
2.6.6.2 AT Command Set .................................................................. 24
2.6.7 Smoke Detector ....................................................................................... 24
2.7 Conclusion ............................................................................................................. 26
CHAPTER 3 : METHODOLOGY ...................................................................................... 27
3.0 System Operation Flow Diagram .......................................................................... 27
3.0.1.1 Explanation of the Block Diagram ........................................ 27
3.1 Block Diagram ...................................................................................................... 28
3.1.1 Description .............................................................................................. 28
3.2 System Flow Chart ................................................................................................ 30
3.3 Conclusion ............................................................................................................. 30
xiii
CHAPTER 4 : RESULT & DISCUSSION .......................................................................... 31
4.0 Software Development .......................................................................................... 31
4.1 Hyper Terminal ..................................................................................................... 31
4.1.1.1 Testing GSM Modem with Hyper Terminal .......................... 33
4.1.1.2 Testing Virtual Basic with Program and GSM Modem ........ 31
4.1.1.3 Testing the Basic Program with the Circuit ........................... 43
4.1.1.3.1 Programming Testing ......................................... 43
4.1.1.4 Testing and Result the Full Programming .......... 44
4.2 Result ..................................................................................................................... 46
4.3 Discussion ............................................................................................................. 46
4.4 Conclusion ............................................................................................................. 47
CHAPTER 5 : CONCLUSION & FUTURE WORK .......................................................... 48
5.0 Conclusion ............................................................................................................. 48
5.1 Future Work .......................................................................................................... 49
APPENDIX A ...................................................................................................................... 51
REFERENCES ..................................................................................................................... 75
xiv
LIST OF FIGURES
Figure 2.1: Differences between the project .......................................................................... 6
Figure 2.2: Design of the PIC Microcontroller ...................................................................... 7
Figure 2.3: Flowchart of the Basic Concept for Interfacing between GSM and PIC .......... 10
Figure 2.4: How to detect PIC.............................................................................................. 11
Figure 2.5: How to Select Baseline Flash Device ................................................................ 11 Figure 2.6: How to Import Hex File..................................................................................... 12
Figure 2.7: Programming Succesful Status .......................................................................... 12 Figure 2.8: Programming Error Status ................................................................................. 13 Figure 2.9: A MAX232 Integrated Circuit ........................................................................... 13
Figure 2.10: MAX232(A) DIP Package Pin Layout ............................................................ 15 Figure 2.11: Model of GSM 2000 ........................................................................................ 17
Figure 2.12: LM35 Sensor ................................................................................................... 20
Figure 2.13: LM35 Sensor Pin Outs and Packaging ............................................................ 21
Figure 2.14: Diagram Optical Smoke Detector.................................................................... 25
Figure 3.1: System Operation Flow Diagram ...................................................................... 27
Figure 3.2: System Block Diagram ...................................................................................... 28
Figure 3.3: System Flowchart .............................................................................................. 30
Figure 4.1: ‘AT Command’.................................................................................................. 31 Figure 4.2: Software Testing ................................................................................................ 32 Figure 4.3: Sim Card put inside the GSM Modem .............................................................. 33 Figure 4.4: Connect the GSM Modem to the Laptop........................................................... 33
Figure 4.5: Setting the Port of GSM Modem ....................................................................... 33
Figure 4.6: Setting the Baud Rate of GSM Modem ............................................................. 34
Figure 4.7: Hyper Terminal and AT Command ................................................................... 34
Figure 4.8: PIC 16F877A ..................................................................................................... 36
Figure 4.9: Crystal 20MHz .................................................................................................. 36
Figure 4.10: Capacitor .......................................................................................................... 37
Figure 4.11: Max 232 ........................................................................................................... 37
Figure 4.12: Design of the PIC16F877A Microcontroller Circuit ....................................... 38
Figure 4.13: Design of the MAX232 Interface Circuit ........................................................ 38 Figure 4.14: Design of the Power Supply Circuit ................................................................ 39
Figure 4.15: Data Transmission ........................................................................................... 41 Figure 4.16: Data Receiver .................................................................................................. 41
Figure 4.17: Flame Sensor Signal ........................................................................................ 42
Figure 4.18: Signal Detect from Sensor ............................................................................... 42
xv
Figure 4.19: Feedback from Phone ...................................................................................... 43
Figure 4.20: Build Project File ............................................................................................. 43
Figure 4.21: Build Failed because the Error in Command................................................... 44 Figure 4.22: Build Successful .............................................................................................. 44
Figure 4.23: GSM Modem with Full Hardware Circuit ....................................................... 45 Figure 4.24: Data Flow Path in Hardware Testing .............................................................. 45 Figure 4.25: Data Flow Path in Software Testing ................................................................ 45
Figure 4.26: The Mobile Phone Receive the SMS when GSM Connected ......................... 46
Figure 4.27: The Mobile Phone Receive SMS when a Motion Detected ............................ 46
Figure 4.28: The Mobile Phone Receive the SMS when Gas Detected............................... 46
Figure 4.29: The Mobile Phone Receive the SMS when Fire Detected .............................. 46
xvi
LIST OF TABLE
Table 2.1: Differences Between Programmer Language ....................................................... 8
Table 2.2: Features of pin MAX232 .................................................................................... 15
Table 2.3: MAX232(A) External Capacitor ........................................................................ 16
Table 2.4: Comparison between GSM, Bluetooth and Wi - Fi ............................................ 19
Table 2.5: Description of AT Command.............................................................................. 24
Table 4.1: AT Command and Explanation .......................................................................... 35 Table 4.2: SMS Command ................................................................................................... 47 Table 4.3: SMS Feedback .................................................................................................... 47 Table 4.4: Summary of Objectives ...................................................................................... 48
xvii
LIST OF SYMBOLS AND ABBREVIATIONS
PIC = Programmable Integrated Circuit
GSM = Global System for Mobile Communications
SMS = Short Message Service
DSM = Defect Shape Matching
1
CHAPTER 1 INTRODUCTION
1.0 Introduction to Project
“Home Security with Gas and Fire Detector” implements the emerging
applications of the GSM technology. Using GSM networks, a control system has
been proposed that will act as an embedded system which can monitor and control
appliances and other devices locally using built-in input and output peripherals.
Remotely the system allows the user to effectively monitor and control the
house/office appliances and equipment via the mobile phone set by sending
commands in the form of SMS messages and receiving the appliances status.
The main concept behind the project is receiving the sent SMS and processing it
further as required to perform several operations. The type of the operation to be
performed depends on the nature of the SMS sent. The principle in which the project
is based is fairly simple. First, the sent SMS is stored and polled from the receiver
mobile station and then the required control signal is generated and sent to the
intermediate hardware that have designed according to the command received in
form of the sent message. I have selected a particular Nokia mobile set for this
project. The messages are sent from the mobile set that contain commands in written
form which are then processed accordingly to perform the required task. A
microcontroller based system has been proposed for this project.
There are several terminologies that are used extensively throughout this project
report GSM (Global System for Mobile Communications): It is a cellular
communication standard. SMS (Short Message Service): It is a service available on
most digital mobile phones that permit the sending of short messages (also known as
text messaging service).
2
1.1 Background
The new age of technology has redefined communication. Most people nowadays
have access to mobile phones and thus the world indeed has become a global village.
At any given moment, any particular individual can be contacted with the mobile
phone. But the application of mobile phone cannot just be restricted to sending SMS
or starting conversations. New innovations and ideas can be generated from it that
can further enhance its capabilities. Technologies such as Infra-red, Bluetooth, etc.
which has developed in recent years goes to show the very fact that improvements
are in fact possible and these improvements have eased our life and the way we live.
Remote management of several home and office appliances is a subject of
growing interest and in recent years we have seen many systems providing such
controls. These days, apart from supporting voice calls a mobile phone can be used
to send text messages as well as multimedia messages (that may contain pictures,
graphics, animations, etc.). Sending written text messages is very popular among
mobile phone users. Instant messaging, as it is also known, allows quick transmission
of short messages that allow an individual to share ideas, opinions and other relevant
information. We have used the very concept to design a system that acts a platform
to receive messages which in fact are commands sent to control different appliances
and devices connected to the platform. We have designed a control system which is
based on the GSM technology that effectively allows control from a remote area to
the desired location. The application of suggested system is immense in the ever
changing technological world. It allows a greater degree of freedom to an individual
whether it is controlling the household appliances or office equipment. The need to
be physically present in order to control appliances of a certain location is eliminated
with the use of the system.
1.2 Problem Statement
Technology has advanced so much in the last decade or two that it has made
life more efficient and comfortable. The comfort of being able to take control of
devices from one particular location has become imperative as it saves a lot of time
3
and effort. Therefore there arises a need to do so in a systematic manner which I have
tried to implement with this system. The system I have proposed is an extended
approach to automating a control system. With the advancement and breakthroughs
in technology over the years, the lives of people have become more complicated and
thus they have become busier than before. With the adoption of this system, can gain
control over certain things that required constant attention. The application of the
system comes in handy when people who forget to do simple things such as turn ON
or OFF devices at their home or in their office, they can now do so without their
presence by the transmission of a simple text message from their mobile phone. This
development, I believe, will ultimately save a lot of time especially when people
don’t have to come back for simple things such as to turn ON/OFF switches at their
home or at their office once they set out for their respective work.
The objective of this project is to develop a device that allows for a user to
remotely control and monitor multiple home/office appliances using a cellular phone.
This system will be a powerful and flexible tool that will offer this service at any
time, and from anywhere with the constraints of the technologies being applied.
Possible target appliances include (but are not limited to) climate control system,
security systems, lights; anything with an electrical interface. The proposed approach
for designing this system is to implement a microcontroller-based control module
that receives its instructions and command from a cellular phone over the GSM
network. The microcontroller then will carry out the issued commands and then
communicate the status of a given appliance or device back to the cellular phone.
1.3 Objectives
To detect the gas and fire.
To detect intruders.
To build a system that rely on mobile phone system.
4
1.4 Scope
Nowadays, this project can be used for main systems at the house. It also can be
used in the office, private room and etc. To show this technology to the user so their
will get the advantages. Other than that, this project is produce to show the
modernization of the country is comparable to other countries.
5
CHAPTER 2 LITERATURE REVIEW
2.0 Introduction
Literature review and research is done prior to undertaking the project. This will
critically provide as much information as needed on the current technologies
available in the market. Besides, a proper methodology is also can be planned in
reference to the other research’s counter parts performed on the related topics.
This chapter presents background information of the project that have been
studied, observed and analysed. For this project, a study on the GSM communication
is being done in order to find the suitable way to develop for the purpose of the
projects. Besides that, a study on developing the circuit of the microcontroller and
gas sensor has been also studied in looking for the best result. On the other hand, a
study on the software such as programming is not left behind in order to achieve the
purpose of the project.
6
2.1 Related Theory
Smart Home Plan Inform Gas Leak & Fire Detector
To detect the gas and fire.
To detect intruders.
To build a system that rely on
mobile phone system.
Report the incident using the SMS
service to the keeper laboratory.
Increase the security features of the
existing laboratory by adding a gas
detector circuit.
Displaying the temperature of the
gas content in the environment
using LCD display.
Figure 2.1: Differences between the Projects.
7
2.2 Literature Theory
Figure 2.2: Design of the PIC Microcontroller.
A microcontroller is a single integrated circuit (IC) which is small enough but
containing all the integrated circuits such as CPU, EPROM program memory, RAM
memory and an Input / Output interfaces. All of these functions are included within
one single package, making them cost effective and easy to use. PIC Microcontroller
is a programmable microcontroller ICs manufactured by MICROCHIP.
2.2.1 Programming language:
High Level language:
C language, C++
Basic, QBasic
Low Level Language:
Assembly
Software tools to write program:
MPLAB IDE (can be download from microchip website)
Burning Software
PICkit2 software
8
2.3 Software Design Info
a) MPLAB software – can be download from www.microchip.com
Use to write microcontroller coding
b) Programming language
Assembly
- Also known as low level language
- The Instruction code comprise of a short form of words (e.g.
move – mov )
High Level Language
- Just like human language
- Easy to understand by non-technical person
Why use assembly language for this project?
Table 2.1: Differences between Programmer Languages.
Assembly Others (High Level Language)
Built in assembler in MPLAB
software
Proof working compiler – need to buy
(too expensive)
MPLAB can be download
without any prices
Using freeware compiler – Limited
function and need to confirm the
functionality
Documentation to refer – Only
Datasheet
Limited references and sample code to
study
So many references – Note,
Sample, Instruction code
details, datasheet and etc.
Need to study the compiler
documentation.
Reduce development time Increase development time