Вы находитесь на странице: 1из 56

SECURITY AND CONTROL SYSTEM

AFZAHANIFF HUSSIN

This thesis is submitted as partial fulfillment of requirement for award of the Bachelor Degree in Electrical Engineering (Electronic)

Faculty of Electrical Engineering Universiti Teknologi Malaysia

MAY 2008

iii

Dedicated with deepest love to: My beloved family for their support, guidance and love. My dearest friends for being there whenever I needed them.

iv

ACKNOWLEDGEMENT

First of all, I would like to thank Allah for HIS firm hands in guiding me in the course of completing this thesis writing. Alhamdulillah.

I would like to show my highest gratitude to my supervisor, PM Harun Ismail for his invaluable support, patient, assistance and especially his encouragement to this project. I truly have learnt a lot and all this would not be without his guidance.

I also would like to thank all my fellow friends for their contribution in giving me a moral support throughout my project development period. Last but not least, to all my beloved family members who were always, stand by my side to encourage, advice, comfort, cherish, and support me during this entire project.

Lastly, I really appreciate to have this responsibility to finish this project. This task has taught a lot of lesson and knowledge which is much valuable for me in the future.

ABSTRACT

This project focuses on the programming of microcontrollers using a highlevel language. The PIC family of microcontrollers is chosen as the target microcontroller because of the low power consumption which made this microcontroller popular in portable application. This project entitles Security and Control System provides security to the house owner from any intruders or any form of robbery by automatically activating the alarm and mobile phone connected to the microcontroller device. Through SMS, the microcontroller unit can immediately advise house owners that the house is being robbed or an intruder has illegally trespassed their respective home.

vi

ABSTRAK

Fokus utama yang diketengahkan dalam projek ini ialah pengaturcaraan pengawal mikro menggunakan bahasa tahap tinggi. Pengawalmikro famili PIC ini dipilih sebagai sasaran pengawalmikro disebabkan penggunaan kuasa rendah yang mana menjadikan pengawalmikro ini terkenal dalam aplikasi yang mudah dibawa.Tajuk projek ini ialah Sistem Keselamatan dan Kawalan yang menyediakan keselamatan kepade pemilik rumah daripada sebarang pencerobohan dan kecurian dengan megaktifkan sistem keselamatan secara automatik dan telefon disambungkan kepada pengawalmikro.Melalui mesej,pengawalmikro dapat menyedarkan pemilik rumah bahawa rumah berlaku kecurian atau pencerobohan dengan pantas.

vii

TABLE OF CONTENT

CHAPTER

TOPIC

PAGE

TITLE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK TABLE OF CONTENTS LIST OF TABLES LIST OF FIGURES LIST OF ABBREVATION LIST OF APPENDICES

i ii iii iv v vi vii x xi xii xiii

INTRODUCTION

1.1

Project Background

1 2 3 3

1.2 Project Objective 1.3 Project Scope 1.4 Thesis Outline

viii

LITERATURE REVIEW

2.1 PIC 16F877A Microcontroller 2.1.1 Special Features of Microcontroller 2.2 Sensor 2.2.1 Magnetic Contact 2.3 Mobile Phone 2.3.1 Short Message Service (SMS) 2.3.1.1 Example Application of SMS 2.3.1.2 Operating Mode: SMS Text and SMS PDU 2.4 GSM Modem

5 6 7 8 10 10 11 12 13 14 15 15

2.5 AT commands 2.5.1 Basic commands and Extended commands 2.5.2 General Syntax of Extended AT commands

METHODOLOGY

3.1 Design Overview 3.2 Hardware Development 3.2.1 Magnetic Contact (Sensor) 3.2.2 L7805 Voltage Regulator 3.2.3 Mobile Phone (Nokia 9300i) 3.3 Software Development 3.3.1 Programming Tools 3.3.1.1 MicroC for PIC 3.3.1.2 MicroC for PIC Features 3.3.1.3 PIC Programmer

18 20 22 23 24 26 27 27 29 30

ix

RESULT

4.1

Hardware Result

32 33 35 36 36

4.2 Software Result 4.3 Result Discussion 4.3.1 Hardware Part 4.3.2 Software Part

CONCLUSION

5.1 Conclusion 5.2 Suggestion for Future Work

38 39

REFERENCES

40

APPENDICES

42

LIST OF TABLES

NO. OF TABLES

TITLE

PAGE

3.1

Description of port at the mobile phone

25

xi

LIST OF FIGURES

NO. OF FIGURES

TITLE

PAGE

1.1 2.1 2.2 2.3 2.4 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 4.1 4.2 4.3 4.4

Flow of sending message PIC 16F877A and its port Magnetic contact Installation magnetic contact on the door or window Magnetic contact with NC and NO contact Project development flow chart Basic block diagram of the project Schematic diagram of the project Miniature magnetic contact sensor (MMC 38) Sensor circuit Schematic diagram of voltage regulator 14 pin Nokia pop-port at the mobile phone Programming flow chart for the system MicroC IDE PIC boot loader device IC programmer graphical user interface (GUI) Hardware that has been build Data shown in the virtual terminal Virtual terminal connect to PIC port

2 6 8 9 9 19 20 21 22 23 24 25 26 28 31 31 33 34 35

The flow of communication between man and a microcontroller 37

xii

LIST OF ABBREVIATIONS

A DC EEPROM GUI RAM RFID ROM V SMS PDA IR PIC GSM 3GPP PDU IDE

Ampere Direct current Electricity Erasable Read-Only Memory Graphic User Interface Read Access Memory Radio Frequency Identification Read Only Memory Voltage Short Message Service Personal Digital Assistant Infrared Programmable Intelligent Computer Global System for Mobile Communication Third Generation Partnership Project Protocol Data Unit Integrated Drive Electronics

xiii

LIST OF APPENDICES

NO. OF APPENDIX

TITLE

PAGE

Schematic Diagram of Security and Control System 42 43 44

B C

Programming Source Code Data Sheet and Manual for PIC 16F877A

CHAPTER 1

INTRODUCTION

This chapter will briefly discuss on the project overview. The objective, scope, and thesis outline will be presented in this chapter.

1.1

Project Background

The widespread use of information technology is dramatically improving both the quality and the efficiency of different services offered to people. The large deployment of wireless networks and increased use of handheld devices like the personal digital assistant (PDA) and mobile phones have encouraged developer to build different kind of applications and systems in all domains. We can find, for example, IR remote control which is an application that can be installed on a mobile phone to use it as a remote control via Infrared; this application can be used in a small area and needs a line of sight [1]. Figure 1.1 shows the flow of sending messages; the GSM module will send SMS that has been programmed in the PIC when the door is open, then house owner will receive message from GSM terminal.

Microcontroller

GSM module

Door

Figure 1.1: Flow of sending message

1.2

Project Objective

The main objective of this project is to design and develop a security system for house owner that is capable of monitoring any intruders and other emergency situation by alarming the house owners via short message service (SMS).

1.3

Project Scope

There are a few scopes and guidelines listed to unsure the project is conducted within its intended boundary. This is to ensure the project is heading in the right direction to achieve its intended objectives.

i.

To design circuitry for the overall system

ii.

To develop the program that can integrate and control the overall system.

1.4

Thesis Outline

This thesis is divided into five chapters. In chapter one, an introduction of Security and Control System is presented along with the project objective and scope in order to achieve the desired goal.

Chapter two provides a review on the research of the components that are

used in the project.

Chapter three describes the overall project that has been identified along with an explanation of programming and hardware design.

Chapter four shows the results that have been obtained along with the discussion.

Finally, chapter five concludes the overall of the Security and Control System. The suggestions for future work also are stated.

CHAPTER 2

LITERATURE REVIEW

This chapter reviews the components that are used in the project, which are PIC microcontroller, sensor, and mobile phone.

2.1

PIC 16F877A Microcontroller

PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument's Microelectronics Division. The name PIC was originally an acronym for "Programmable Intelligent Computer"[10].

PICs 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 reprogramming with flash memory) capability. Microchip recently announced the shipment of its five billionth PIC processor. Figure 2.1 shows PIC 16F877A and its pin out.

Figure 2.1: PIC 16F877A and its pin out

2.1.1

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 erase or write cycle data EEPROM memory typical. The PIC 16F877A provides the following features [9]:

i.

Wide operating voltage rage (2.OV-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 timer/counter with 8-bit prescaler.

xii.

Timer 1: 16-bit timer/counter with prescaler, can be increment during SLEEP via external crystal or clock.

2.2

Sensor

A sensor is a device which measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument. For example, a mercury thermometer converts the measured temperature into expansion and contraction of a liquid which can be read on a calibrated glass tube. A thermocouple converts temperature to an output voltage which can be read by a voltmeter. For accuracy, all sensors need to be calibrated against known standards.

2.2.1 Magnetic Contact

Figure 2.2: Magnetic contact

Figure 2.2 shows the sample of the magnetic contact. Magnetic contacts are usually NC (Normally Closed) and are used on doors and windows. They consists of two parts, namely a magnet and a reed switch. When the reed switch is in close proximity to the magnet, the switch will close and vice versa. Usually the magnet is fitted to the door and the reed switch is fitted to the door frame in close proximity to one another such that when the door is closed, the two parts are in close contact and hence the switch is closed. When the door is opened, the magnet will be a distance away from the reed switch and hence the switch will open. Figure 2.3 shows an installation of magnetic contact on the door or window.

Figure 2.3: Installation of magnetic contact on the door or window

Figure 2.4 shows the types of magnetic contact which are NC (Normally Close) and NO (Normally Open)

Figure 2.4: Magnetic Contact with NC and NO contact

10

2.3

Mobile Phone

In the present world of wireless technology every thing is going to be digital and wireless, and the cell phone is the key player in wireless technology today. Todays technology make the possessing of a mobile a basic commodity and the trends in wireless technology is changing from day-to-day. Today the emphasis is on how to develop remote devices operate without the presence of man in order to reduce the time factor and labor, and thus making the controlling of any electronic devices through a touch cell phone with one SMS, possible.

2.3.1

Short Message Service (SMS)

SMS stands for Short Message Service. It is a technology that enables the sending and receiving of messages between mobile phones. SMS first appeared in Europe in 1992. It was included in the GSM (Global System for Mobile Communications) standards right at the beginning. Later it was ported to wireless technologies like CDMA and TDMA. The GSM and SMS standards were originally developed by ETSI. ETSI is the abbreviation for European Telecommunications Standards Institute. Now the 3GPP (Third Generation Partnership Project) is responsible for the development and maintenance of the GSM and SMS standards [11].

As suggested by the name "Short Message Service", the data that can be held by an SMS message is very limited. One SMS message can contain at most 140 bytes (1120 bits) of data, so one SMS message can contain up to:

11

i.

160 characters if 7-bit character encoding is used. (7-bit character encoding is suitable for encoding Latin characters like English alphabets.)

ii.

70 characters if 16-bit Unicode UCS2 character encoding is used. (SMS text messages containing non-Latin characters like Chinese characters should use 16-bit character encoding.)

SMS text messaging supports languages internationally. It works fine with all languages supported by Unicode, including Arabic, Chinese, Japanese, and Korean. Besides text, SMS messages can also carry binary data. It is possible to send ringtones, pictures, operator logos, wallpapers, animations, business cards (e.g. VCards) and WAP configurations to a mobile phone with SMS messages. One major advantage of SMS is that it is supported by 100% GSM mobile phones. Almost all subscription plans provided by wireless carriers include inexpensive SMS messaging service. Unlike SMS, mobile technologies such as WAP and mobile Java are not supported on many old mobile phone models.

2.3.1.1 Example Application of SMS

SMS is a very suitable technology for delivering alerts and notifications of important events. This is because of two reasons:

i.

A mobile phone is a device that is carried by its owner most of the time. Whenever an SMS text message is received, the mobile phone will notify you by giving out a sound or by vibrating. You can check what the SMS text message contains immediately.

12

ii.

SMS technology allows the "push" of information. This is different from the "pull" model where a device has to poll the server regularly in order to check whether there is any new information. The "pull" model is less suitable for alert and notification applications, since it wastes bandwidth and increases server load.

In a remote system monitoring application, a program (sometimes with the help of a group of sensors) is constantly monitoring the status of a remote system. If a certain condition is satisfied, the program will send a text message to the system administrator to notify him/her of the situation. For example, a program may be written to "ping" a server regularly. If no response is received from the server, the program can send an SMS alert to the system administrator to notify him/her that the server may be hanged.

2.3.1.2 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. Following are the SMS AT commands affected:

i.

+CMGS (Send Message)

ii.

+CMSS (Send Message from Storage)

iii.

+CMGR (Read Message)

13

iv.

+CMGL (List Messages)

v.

+CMGW (Write Message to Memory)

vi.

+CNMA (New Message Acknowledgement to ME/TA)

vii.

+CMGC (Send Command)

2.4

GSM Modem

A 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 sends and receives data through a fixed telephone line while a wireless modem sends 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 [12].

Computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. You can use a GSM modem just like a dial-up modem. In addition to the standard AT commands, GSM modems support an extended set of AT commands. These extended AT commands are defined in the GSM standards. With the extended AT commands, you can do things like:

14

i.

Reading, writing and deleting SMS messages.

ii.

Sending SMS messages.

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

AT command

AT commands are instructions used to control a modem. AT is the abbreviation of ATtention. Every command line starts with "AT" or "at". That's why modem commands are called AT commands. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones [13].

Besides this common AT command set, GSM/GPRS modems and mobile phones support an AT command set that is specific to the GSM technology, which includes SMS-related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages).

15

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

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

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, you can press the Enter key on the keyboard to output a carriage return character. Example: To list all unread inbound SMS messages 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>

16

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 messages stored in the 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", like this:

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 extended AT command +CMGL, like this:

AT+CMGL="ALL"<CR>

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

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

17

The first line is the information response of the AT command +CGMI and the second line is the final result code. <CR> and <LF> represent a carriage return character and a linefeed character 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 / 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 Nokia

OK

18

CHAPTER 3

METHODOLOGY

This chapter discusses the hardware and software development including the hardware design and software programming.

3.1

Design Overview

This section briefly discusses the overall project design including the workflow of activities, device design and program development. Initial construction of circuit is done on a project board for easier testing and modification. It is then transferred to a donat board after the circuit is found to be working. Software development includes the programming of the PIC16F877A, which interfaces to all the hardware part. A set of instruction code is written to indicate the microcontroller performs the function required. In the interfacing stage, hardware and software work together as a complete system. Figure 3.1 shows the project flow chart and figure 3.2 shows the overall block diagram of the project.

19

Research and Study

Planning

Write program for PIC microcontroller using MicroC for PIC

Assemble hardware- sensor, PIC16F877A, regulated power supply

TEST

Modify programming and hardware/troubleshoot NO

OK YES Finalize and complete Figure 3.1: Project development flow chart

20

Motion Detector

PIC16F877A

GSM Terminal/Mobile phone

Figure 3.2: Basic block diagram of the project

3.2

Hardware Development

The complete schematic diagram of the project is shown in the Figure 3.3 where all the hardware part such as sensor, PIC16F877A microcontroller, and 5V voltage regulator are combined together. The hardware part will be discussed in the following section.

21

Figure 3.3: Schematic diagram of the project

The system is powered by one, 12 VDC 7Ah, lead heavy duty battery. The mobile phone is controlled by a PIC microcontroller (PIC16F877A TM, Microchip Technology Inc., USA), which is programmed using C programming language. Magnetic contact is used as a sensor. It sends the signal to PIC microcontroller which subsequently send message to the house owner.

22

3.2.1 Magnetic Contact (Sensor)

Magnetic contact has been used in this project as a sensor to detect intruder. This sensor is connected to pin number 33 at PortB of PIC 16F877A as an input. Figure 3.4 below show the magnetic contact that is used in the project.

Figure 3.4: Miniature magnetic contact sensor (MMC38)

The function of the magnetic contacts is similar to a switch. When the contact is not close to each other, it will send a signal to the PIC microcontroller. During a test using the ISIS 6 Professional, the magnetic contact has been replaced with push button. When the button is pushed, a signal of 5V is detected, and the PIC will send SMS to the mobile phone. Figure 3.5 shows the sensor circuit that has been designed and tested using ISIS 6 Professional.

23

For testing, magnetic contact has been replace with the push button

Figure 3.5: Sensor circuit

3.2.2 L7805 Voltage Regulator

The L7805 voltage regulator has three positive terminals with several fixed output voltages to endure wide range application. The L78XX in the series number of regulator means that it is applicable to be used with any positive input while the LXX05 in the series number means that the regulator is appropriate for 5V voltage. The 12V power supply is directly connected to pin 1 (voltage input) of the regulator and pin 3 is voltage output. By using this configuration circuit, 12V power supply can be reduced to 5V so that the PIC can function.

24

Figure 3.6: Schematic diagram of voltage regulator

3.2.3 Mobile Phone (Nokia 9300i)

Mobile phone used in the project as a GSM module. It can send SMS to the house owner. The command that has been programmed in the PIC will send the message that has been store in the mobile phone. The configuration of port of the mobile phone is shown in the figure 3.7.Table 3.1 shows the description of each port at the mobile phone.

25

Figure 3.7: 14 pin Nokia pop-port at the mobile phone

Table 3.1: Descriptions of port at the mobile phone

26

3.3

Software Development

The flow chart for the system main program is shown in figure 3.8. When the system is powered on, the microcontroller will initialize. The first task is to check whether the sensor is activated or not. When there are intruders, the system will send message to the house owner. If there are no intruders, the system will continue to check again. This step will repeat until sensor is activated.

Start

No

Sensor activated? Yes Send SMS

End
Figure 3.8: Programming Flow chart for the system

27

3.3.1

Programming Tools

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.3.1.1 MicroC for PIC

MikroC is a powerful, feature rich development tool for PICmicros. It is designed to provide the programmer with the easiest possible solution for developing applications for embedded systems, without compromising performance or control. Figure 3.9 shows the MicroC Integrated Drive Electronics (IDE).

28

Figure 3.9: MicroC IDE

PIC and C 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. MikroC provides a successful match featuring highly advanced IDE, ANSI compliant compiler, broad set of hardware libraries, comprehensive documentation, and plenty of ready-to-run examples.

29

3.3.1.2 MicroC for PIC Features

MikroC allows quick development and deployment of complex applications:

i.

C source code is written using the built-in Code Editor (Code and Parameter Assistants, Syntax Highlighting, Auto Correct, Code Templates, and more)

ii.

MikroC libraries are used to dramatically speed up the development: data acquisition, memory, displays, conversions, and communications. Practically all P12, P16, and P18 chips are supported.

iii.

Monitor program structure, variables, and functions in the Code Explorer.

iv.

Generate commented, human-readable assembly, and standard HEX compatible with all programmers.

v.

Inspect program flow and debug executable logic with the integrated Debugger.

vi.

Get detailed reports and graphs: RAM and ROM map, code statistics, assembly listing, calling tree, and more.

vii.

Provided plenty of examples to expand, develop, and use as building blocks in the projects.

30

3.3.1.3 PIC Programmer

IC prog was developed by Bonny Gijzen as a tool to load a program into microcontroller's EEPROM. This specially design software fit with any version of Microchip microcontroller. The procedure for using the IC prog is as follows:

i.

Switch on the PC.

ii.

Connect the microcontroller board to the parallel port of the PC.

iii.

Run the IC prog.

iv.

Set the device for the microcontroller.

v.

Set the oscillator and the write enable.

vi.

Click file open and select.HEX file.

vii. Click program all to burn the entire HEX file into EEPROM.

viii. IC prog will verify the code.

ix.

If there is no error, the HEX file is successfully loaded to the chip.

x.

Release the cable that attach to PC parallel port.

xi.

Chip is ready to use.

31

Figure 3.10 below show the PIC bootloader device. This is Universal Serial Bus (USB) type which can be directly attached to the computer. The other type is the serial communication type. Figure 3.11 shows the process of burning program onto the PIC microcontroller using GUI.

Figure 3.10: PIC bootloader device

Figure 3.11: IC programmer graphical user interface (GUI)

32

CHAPTER 4

RESULT

This chapter discusses the result of the design and development of a security and control system.

4.1

Hardware Result

A security and control system has been successfully implemented. For hardware construction and interfacing, tests have been carried out to verify that the circuit functions correctly. Figure 4.1 shows the hardware that has been built.

33

Magnetic contact

PIC 16F877A that has been programmed to send SMS

Mobile phone that receive data from PIC and send message to house owner Figure 4.1: Hardware that has been build

4.2

Software Result

The programming for PIC has been done and simulated using ISIS 6 Professional. Figure 4.2 shows the command that is sent to mobile phone using virtual terminal in ISIS 6 Professional.

34

Data that will be sent from PIC to the mobile phone

Figure 4.2: Data shown in the virtual terminal

The data displayed on the virtual terminal is AT+CMSS=1. It is the command to the mobile phone that it will send the SMS stored in the mobile phone. Figure 4.3 shows the connection of virtual terminal to the PIC.

35

Virtual terminal are connected to the Tx and Rx port of PIC

Figure 4.3: Virtual terminal connect to PIC port

4.3

Result Discussion

This section briefly discusses the results obtained during the project development and simulated test based on the programming of the PIC microcontroller.

36

4.3.1 Hardware Part

When 12V power supply is connected to the circuit, the circuit operates successfully. These include the magnetic contact and mobile phone. When the magnetic contact is not close to each other, the input voltage will be 5V and PIC is able to detect the signal and send SMS to the house owner using the mobile phone. Unexpected result happens when the mobile phone could not send the SMS when the sensor was activated. However, connection has been established between mobile phone and PIC.

Once the problem has been identified, troubleshooting has been done to determine the cause of failure. The first step is to check the input pin at PORTB and output pin at PORTC. It should have a 5V voltage when 12V power supply is connected to the system. It appears to have no problem with input and output pins. It was finally determined that the problem is the mobile phone. The model used could not recognize the data sent from PIC. The solution to this problem is to configure or program the mobile phone to accept incoming AT command. This shortcoming has yet to be overcome.

4.3.2

Software Part

The programming has been found to be working successfully. It has been simulated and tested using the ISIS 6 Professional. Once a source code has been written, it is compiled to generate the HEX file. The programmer is used to burn the code into the PIC. Figure 4.4 shows the flow of the PIC programming.

37

Figure 4.4: The flow of communication between a man and a microcontroller

Once the program has been loaded into PIC, the virtual terminal of ISIS is used to test the overall programming. The data to be sent to mobile phone will be displayed in virtual terminal.

38

CHAPTER 5

CONCLUSION

As a conclusion, this chapter discusses the outcome of the project and provides solution or suggestion of further work.

5.1

Conclusion

The ultimate aim of this project has not been completely achieved where by the Security and Control System has not been able to alert the house owner through SMS. Failures to do so have been pointed out in the previous chapter. The solution is to configure or program the mobile phone to accept incoming AT command. Alternatively is to use another model of mobile phone that readily accepts incoming AT command.

39

5.2

Suggestion for Future Work

This project has been successfully developed and implemented. However, it can be improved to target more advanced and better application in the next stage of research. For future improvement, there are several suggestions stated below:

i.

Another sensor could be added to the system like smoke detector or motion detector

ii.

Instead of using mobile phone as GSM module, the GSM modem can be used.

iii.

To implement the capability of receiving the SMS from house owner.

iv.

Since this project has not successfully achieved its goal to send SMS, it is recommended for others to continue this project so that the Security and Control System can be commercialized either in home appliances or industrial applications.

40

REFERENCES

1.

John W.Muchow, CORE J2ME Technology & MIDP, Sum Microsystems Press A Prentice Hall Title, 2002.

2.

John Iovine, PIC microcontroller project book, McGraw-Hill, New York, 2000.

3.

Steve Heath, Embedded systems design, Newnes, Oxford, 2003.

4.

Ian Sommervile, Software Engineering, Addison-Wesley, Reading, 2001.

5.

Siegmund M.R., Matthias K.W., Malcolm W.O., An Introduction to GSM, Artech House Publishers, London 1995.

6.

Schiller J., Mobile Communications, Second Edition, Addison-Wesley, 2003.

7.

Peter Spasov (2005). Microcontroller Technology. Fifth edition. Sir Sandford Fleming College: Prentice Hall.

8.

Han-Way Huang (2001). MC68HC11 an Introduction - Software and Hardware Interfacing. Second edition: Delmar Thompson Learning.

9.

PIC 16F877A Manual Datasheet, Microchip Technology Inc. www.microchip.com

10.

"1977 Data Catalog", Micro Electronics from General Instrument Corporation http://www.rhoent.com/pic16xx.pdf

41

11.

http://www.developershome.com/sms/smsIntro.asp

12.

http://www.developershome.com/sms/GSMModemIntro.asp

13.

http://www.developershome.com/sms/atCommandsIntro.asp

Вам также может понравиться