You are on page 1of 87

GSM BASED WIRELESS HOME APPLIANCES CONTROL AND SECURITY SYSTEM

KHAIRUL MUSLIM BIN NORDIN

A report submitted in partial fulfillment of the requirement for the award of the degree of Bachelor of Engineering (Electrical Mechatronic)

Faculty of Electrical Engineering Universiti Teknologi Malaysia

APRIL 2010

ii

iii

Dedicated, in thankful appreciation for support, encouragement and understandings to my beloved mother and father, brother and sister, and as well as my supportive friends

 

iv

 

ACKNOWLEDGEMENT

 

First

and foremost, I would

like

to

take this

opportunity to

express my

grateful to ALLAH because give me a good health and destiny to me finish this project.

Secondly, I would like to express my warmest gratitude to my supportive supervisor, En. Mohd Ariffanan Bin Mohd Basri who has provided immeasurable support and guidance toward the completion of my research project. His remarkable ideas and suggestions will be much appreciated in the long run of my career.

My sincere appreciation also goes to my family especially my father Nordin Bin Sani and my beloved mothers Salmiah Binti kamal who has been so tolerant and supportive in all these years either morally or financially. Thanks for their continuous encouragement, love and emotional supports that they had given to me all this while.

I also would like thank to all my friends who had given me helps technically and mentally throughout my journey in completing my project. I thank you from the bottom of my heart. I wish you all the best in life and hope that our friendship will last forever.

v

ABSTRACT

In Malaysia, almost every day house theft cases reported in local newspapers. These cases have been one of the most serious problems that happen in our country, Malaysia. Not like other previous cases, thieves nowadays are too aggressive and brutal. This is because today, the thieves use a variety of ways, including killing. Many people use criminal methods to sufficient their need of life, theft and robbery when the home owners are not in the house. Therefore, various methods can be used to overcome this problem. Based on the events above, the project can be developing to make our home secure and safe. So the purpose of project is to design and develop a home security system that can provide security against intrusion and other emergency situation using a wireless technology. In addition to the house theft cases, today many people are facing difficulties to control home appliances, especially for the elderly and disabled. Therefore, this project is developed to control a home appliance. The main component to develop the project is using PIC 16F877A. The two detectors of motion sensor and magnetic contact sensors are used as the input of PIC and two home appliances are a fan and a lamp as home appliances to be controlled using a mobile phone.

vi

ABSTRAK

Di Malaysia, hampir setiap hari kes kecurian rumah dilapor dalam akhbar- akhbar tempatan. Peningkatan kes ini amat membimbangkan kerana ia boleh mendatangkan bahaya kepada orang ramai. Ini adalah kerana pada zaman sekarang pencuri menggunakan pelbagai cara termasuklah dengan cara membunuh asalkan ia dapat memenuhi kemahuan mereka. Disamping itu pencuri pada zaman sekarang sering bertindak secara agresif dan brutal. Kes kecurian rumah juga sering berlaku jika seseorang tiada di rumah.Oleh yang demikian, pelbagai cara boleh digunakan bagi mengatasi masalah ini. Antaranya adalah dengan menghasilkan satu sistem yang boleh menjaga dan mengawasi rumah walaupun ia ditinggalkan. Dengan ini, tujuan utama projek ini dihasilkan adalah untuk mengatasi masalah tersebut. Projek ini adalah untuk menghasilkan satu sistem keselamatan rumah menggunakan teknologi tanpa wayar. Selain kes kecurian rumah, pada zaman sekarang banyak kesulitan dihadapi untuk mengawal peralatan rumah terutama sekali bagi golongan tua dan cacat anggota. Oleh itu, projek ini juga dihasilkan untuk memudahkan mengawal peralatan rumah.Projek ini dihasilkan dengan menggunakan PIC 16F877A sebagai peranti utama. Dua pengesan iaitu “motion sensor” dan “magnetic contact sensordigunakan sebagai masukan PIC dan dua jenis alat rumah iaitu kipas dan lampu dijadikan sebagai alat untuk dikawal dengan menggunakan telefon.

vii

TABLE OF CONTENTS

CHAPTER

TITLE

PAGE

DECLARATION

ii

DEDICATION

iii

ACKNOWLEDGEMENT

iv

ABSTRACT

v

ABSTRAK

vi

TABLE OF CONTENTS

vii

LIST OF TABLES

xi

LIST OF FIGURES

xii

LIST OF ABBREVIATIONS

xiv

LIST OF APPENDICES

xvi

1

INTRODUCTION

1

  • 1.1 Chapter Overview

1

  • 1.2 Background

1

  • 1.3 Problem Statement

2

  • 1.4 Objective

3

  • 1.5 Scope of Project

4

  • 1.6 Thesis Outline

4

viii

2

LITERATURE REVIEW

 

5

  • 2.1 Chapter Overview

5

2.2.Previous Project

6

 

2.2.1 Similar Research Done by UTM Student

6

 
  • 2.2.1.1 Wireless Home Security System by LOGESWARAN A/L ARUMUGAM

6

  • 2.2.1.2 Wireless Alarm System Using

7

Microcontroller by MOHD ARIF BIN MD KURDI

  • 2.2.1.3 Sistem

Penggera

Keselamatan

8

 

Rumah Kediaman Mudah Dan Pintar” by MOHD ROSLI BIN MAMAT 2.2.2 Others Related Projects

9

 

2.2.2.1 Home Security System by CHUN-PAI

9

JIMMY HSIEH AND YANG CAO from Cornell University 2.2.2.2 Monitoring and Controlling of Device Using GSM by PRIYANKA from India

9

  • 2.3 Reviews The Software and Hardware

 

10

 

2.3.1

Hardware Review

10

 
  • 2.3.1.1 PIC 16F877A Microcontroller

 

10

  • 2.3.1.2 Sensor

11

  • 2.3.1.2.1 Magnetic Contact Sensor

11

  • 2.3.1.2.2 Motion Sensor

 

12

  • 2.3.1.3 Mobile Phone

13

  • 2.3.1.4 MAX232 and D9

 

14

  • 2.3.1.5 RS-232 Serial Port

15

ix

 
  • 2.3.2.1 MikroC

16

  • 2.3.2.2 Visual Basic 2008

Microsoft

17

  • 2.3.2.3 Overview of GSM Technology

17

  • 2.3.2.4 Advantages of GSM

18

  • 2.3.2.5 GSM Modem

18

  • 2.3.2.6 AT COMMAND

19

3

METHODOLOGY

21

  • 3.1 Chapter Overview

21

  • 3.2 Stage of Methodology and Approach

21

  • 3.3 The Work Flow For The Whole Project

22

  • 3.3.1 Make a Research and Study

22

 
  • 3.3.2 Planning

24

  • 3.3.3 Hardware Implementation

27

 
  • 3.3.3.1 Voltage Regulator

27

  • 3.3.3.2 Reset (MCLR)

28

3.3.3.3 Interface PIC16F877A With Motion Sensor

29

  • 3.3.3.4 Interface PIC16F877A With Magnetic Contact Sensor

30

  • 3.3.3.5 Interface PIC16F877A With Fan and Lamp

31

  • 3.3.3.6 Interface PIC16F877A With Buzzer

31

  • 3.3.3.7 In Circuit Serial Programming (ICSP) for Programming PIC Microcontroller

32

  • 3.3.3.8 Serial Communication Interface Circuit

32

3.3.4 Software Implementation

35

 
  • 3.3.4.1 Programming the hardware using MicroC

36

x

  • 3.3.4.2 Motion sensor programming

38

  • 3.3.4.3 Magnetic Contact Sensor Programming

40

  • 3.3.4.4 Home Appliances (Fan and Lamp) Programming

42

  • 3.3.4.5 Graphic User Interface

43

  • 3.3.5 Analysis and Testing

44

  • 3.3.5.1 Testing the AT COMMAND

44

  • 4 RESULTS AND DISCUSSIONS

47

  • 4.1 Chapter Overview

47

  • 4.2 The Block Diagram for This Project

47

  • 4.3 How Does it Work?

48

  • 4.4 The Result for This Project

49

  • 4.4.1 For The Security System

49

  • 4.4.2 For The Wireless Home Appliances Control

54

  • 4.4.3 To Exit The System

57

  • 5 CONCLUSION AND SUGGESTION

58

  • 5.1 Conclusion

58

  • 5.2 Limitations

59

  • 5.3 Suggestion and Future Development

59

60

REFERENCES Appendices A D

61- 69

xi

LIST OF TABLES

TABLE NO.

TITLE

PAGE

  • 2.1 Example of AT COMMAND

20

  • 3.1 Baud Rate Formula

34

xii

LIST OF FIGURES

FIGURE NO.

TITLE

PAGE

  • 2.1 The Overall System

7

  • 2.2 Overall Wireless Home Security System

8

  • 2.3 Pin Out of PIC 16F877A

11

  • 2.4 The Picture Shows the Magnetic Sensor with Magnet

12

  • 2.5 This Picture Shows the Installation of Sensor and Magnet on the Door

12

  • 2.5 Motion Sensor

13

  • 2.6 Pin Assignments of MAX232 IC

14

  • 2.7 D-9 Connecter Configuration

14

  • 2.8 RS-232 PC Connector

15

  • 3.1 Flow of Methodology

21

  • 3.2 The Grant Chart for FYP 1

26

  • 3.3 The Grant Chart for FYP 2

26

  • 3.4 The Circuit of Voltage Regulator

27

  • 3.5 The Placement of Motion Sensor in a Hardware Prototype

29

  • 3.6 The Circuit of Motion Sensor to PIC

29

  • 3.7 The Placement of Magnetic Contact Sensor in a Hardware Prototype

30

  • 3.8 The Circuit of Magnetic Contact Sensor to PIC

30

  • 3.9 The Placement of Fan and Lamp in a Hardware Prototype

31

3.10

The Circuit of Fan and Lamp to PIC

31

xiii

  • 3.12 The Serial Communication Interface Circuit

33

  • 3.13 The Hardware Prototype

34

  • 3.14 PICkit 2 Software Interface

37

  • 3.15 USB ICSP Programmer Device

37

  • 3.16 Flow Chart for Motion Sensor Programming

39

  • 3.17 Flow Chart for Magnetic Sensor Programming

41

  • 3.18 Flow Chart for ON/OFF Lamp

42

  • 3.19 Flow Chart for ON/OFF Fan

43

  • 3.20 Main of Graphic User Interface

43

  • 3.21 Output of Graphic User Interface

44

  • 3.22 The Hyper Terminal Connection Setup

45

  • 3.23 Hyper Terminal Com Port Setup

45

  • 3.24 The Interface for write AT command

46

  • 3.25 Testing The AT Command

46

  • 4.1 The Block Diagram for

Security System

47

  • 4.2 The Block Diagram for Home Appliances Control

48

  • 4.3 The Main System

49

  • 4.4 The Login This System

50

  • 4.5 The Output Graphical User Interface

50

  • 4.6 The System Show User Chosen the Com Port

51

  • 4.7 The Hardware Prototype

52

  • 4.8 The System Show When the Magnetic Contact Sensor is Active

52

  • 4.9 The System Show When the Motion Sensor is Active

53

  • 4.10 The Hardware Prototype Show a Lamp is Light

54

  • 4.11 The System Show a Lamp is Light

54

  • 4.12 The System Show a lamp is non active

55

  • 4.13 The Hardware Prototype Show a fan is Active

55

  • 4.14 The System Show a fan is Active

56

  • 4.15 The System Show a Fan is Non Active

56

xiv

LIST OF ABBREVIATIONS

BOR

 

Brownout Reset

BRG

Baud Rate Generator

CTS

Clear To Send

DCD

Data Carrier Detect

DSR

Data Set Ready

DTE

Data Terminal Equipment

DTR

Data Terminal Ready

EEPROM

Electrically Erasable Programmable Read Only

Fosc

Memory Oscillator’s Frequency

GUI

Graphical User Interface

GSM

Global System For Mobile Communications

IC

Integrated Circuit

ICSP

In-Circuit Serial Programming

LCD

Liquid Crystal

LED

Light Emitter Diode

NC

Normally Closed

PDU

Protocol Data Unit

PIC

Peripheral Interface Controller

xv

PIR

 

Passive Infrared

POR

Power-On Reset

RAM

Random Access Memory

RF

Receiver Frequency

RI

Ring Indicator

ROM

Read-Only Memory

RSCR

Receive Status And Control Register

RTS

Request to Send

RXD

Received Data

SIM

Subscriber Identity Module

SCI

Serial Communication Interface

SMS

Short Message Service

TDMA

Time Division Multiple access

TXD

Transmitted Data

USART

Universal Synchronous Asynchronous Receiver

UTM

Transmitter Universiti Teknologi Malaysia

xvi

LIST OF APPENDICES

APPENDIX

TITLE

PAGE

A

Main Board Circuit Schematic

61

B

Programming For Hardware

62

C

Programming For Interfacing

65

D

Project Prototype

69

CHAPTER 1

INTRODUCTION

  • 1.1 Chapter Overview

This chapter will briefly discuss on the project background. This chapter also discusses the problem statement, the objective of this project, the scope of the project and the thesis outline.

  • 1.2 Background

Home wireless security systems are becoming increasingly popular and it is being a necessary nowadays. There are many benefits to using these compared to conventional systems. There are many products of Wireless Home Security Systems in the market. The price depends on how advance the system is. Normally today home security system is in wireless form rather than wired form. The reasons are wireless can saves cost of wiring, easy to install, occupy lesser space, easy for maintenance and more reliable.

2

Besides that, the wireless also capability become as an appliances control in the home. The capability of controlling home appliances in a wireless and remote fashion has provided a great convenience to many people in life. Through a wireless remote controller, people can do remote operation without directly accessing the host of a home appliance. The home appliances like fan, lamp, television, washing machines and others.

Therefore in this project the GSM is the type of wireless that chooses. It is because it's the GSM is better than others wireless. It is suitable to install the systems that need a wide range. It also can monitor the signal strength and more adaptable. So it is suitable to become a controller for home appliances and for security system.

  • 1.3 Problem Statement

Nowadays, most couples leave for work early in the morning and get back only in the evening. Most people also have to travel to other cities for their work. When they are away, their house is empty and unguarded. Therefore case like theft and robbery is easy to occur because the home owners are not in the house. The Multidimensional crisis like theft and robbery is one of the most serious problems that happen in this country. The based solution is to develop home security system using a wireless to keeps your house safe from intruders and enables you to work in peace.

Based on the events above, the project can be developing to make our home secure and safe. We never anxious and worried anymore even we leave the house. So this project is to design and develop a home security system that can provide security against intrusion and other emergency situation by alarm via short message service (SMS).

3

Today there are a many wireless home security alarm system available in the market. Some are designed for very high security level protection and some are basic type. Most of the alarm systems are very expensive and therefore not affordable by poor or middle class families. Some systems which cheaper in cost do not provide reliable features like status checking. To provide the public with a cost effective wireless security system, it is important to design a low cost system with advanced features which ease the residents' life and benefits the public and also will decrease the crime rate of Malaysia.

Besides that, to develop and the system that can control and monitor the device in our home is a good matter. It is can be easy to simplify the daily works. It is important because the system can be help the disabled and elderly through the realization of a fully automated home. So this project will develops and design the home appliances that can control and monitoring the lamp and fan in the house.

1.4

Objective

The main objective of this project is to design and develop a home security system that can provide security against intrusion and other emergency situation by alarm via short message service (SMS). The primary objective of this project is to design and develop a system that can control home appliances remotely with hand phone through SMS. The system can control two numbers of home appliances are lamp and fan only. Another objective of this project is to produce the system that an inexpensive, user- friendly, small of size and easy to install.

4

  • 1.5 Scope of Project

The scope of this projects are divide by two part that hardware and software. In the hardware part is to design circuit for the overall systems include the component, 16F877A microcontroller and sensor that used. And then, design circuit to make a connection to computer interface and mobile phone device.

In software part are programming the PIC microcontroller using MicroC compiler. To make interface in computer by using visual basic 2008. Lastly, to make a connection between computer and hardware to mobile phone that support GSM modem by using AT command and suitable software.

  • 1.6 Thesis Outline

This thesis is divided into five chapters. In chapter 1, an introduction of project is presented along with the project objective, scope of this project and the expected outcome for this project. In chapter 2 is begin with the literature review the previous project or thesis that related with this project. Then in this chapter also provides a review on the research of the components and software that are used in this project. The chapter 3 are discusses the methodology and approach that used to develop this project. The chapter 4 are discusses the result and discussion. And the last chapter are summarizes this project, discusses of the limitation of this project and suggests possible future works.

CHAPTER 2

LITERATURE REVIEW

  • 2.1 Chapter Overview

Literature review was carried out throughout the whole project to gain knowledge and skills needed to complete this project. The main sources for this project are the previous project and thesis that is related to this project. And the other sources are books, journals and articles obtained from internet. So this chapter discusses the projects and theses related to this project. This chapter also discusses a related researches conducted by previous UTM students.

Therefore, by analysis the project did by other researchers, there is a possibility to know what features are lacking in their projects. It is very important to improve and to develop a successful project. This project also will recommend some future works that could be done to improve the same project. So there are some useful ideas that can be implemented in this project from other similar projects.

Besides that, when reviewing the previous works or project a proper expect how this project can be conducted and the features that have to be added to make this project reliable and marketable are enlightened. By reviewing the previous works or

6

project also have been referred to carefully before kick start this project to produce a better and more relevant system to the targeted market.

Then, the theories and related knowledge are also important matter to develop this project. It has been acquired and implemented in achieving the objectives of this project. So the books, journals and articles are the right source to get it. The knowledge is very important as guideline to determine the component and what software that be used for this project.

  • 2.2 Previous Project

    • 2.2.1 Similar Research Done by UTM Student

2.2.1.1 Wireless Home Security System by LOGESWARAN A/L ARUMUGAM

The project is to design the home security by alarm system. The alarm system should check the status of the transmitter of the system regularly to ensure that the system could function without any failure. The failure of the transmitter will be indicated at the receiver through LEDs and the buzzer beeping sound. The project is to develop an alarm system for a house. The system can be operated through a password secured remote control. The remote can arm and disarm the whole system or each individual zone. The components that the project used are PIC16F877A microcontroller, encoder HT12E, LCD, 4X4 keypad, transmitter and receiver module.

7

There are some limitations in this project is only one transmitter and one receiver is built for this project so the system cannot perform bi-directional communication which allowed the receiver to send signals to transmitter to request the status of the transmitter because the communication between the transmitter and the receiver is only one way communication.

2.2.1.2 Wireless Alarm System Using Microcontroller by MOHD ARIF BIN MD KURDI

The project is to build an alarm system that can cover all places in the house and alert home owner instantly. The house will be divided to eight different zones and each zone will have its own signal frequency. If there happened to be a security breach in the house which trigger a sensor at any one of the eight zones, the transmitter will send a signal to the receiver. The receiver is connected to the microcontrollers which will automatically triggers the output siren and flash a LED that will indicate the zone of the security breach. So that the owner will know at which zone the theft is hiding. The siren and the flashing LED can be disarmed by using either remote control button or onboard disarming button. The project are using PIC 16F877A microcontroller as a main controller.

The figure below show the overall system conducted by Mohd Arif Bin Md Kurdi :

Transmitter control Remote Keypad Buzzer Receiver PIC 16F877A LCD LED Sensor from 8 zones
Transmitter
control
Remote
Keypad
Buzzer
Receiver
PIC
16F877A
LCD
LED
Sensor from
8 zones
Transmitter control Remote Keypad Buzzer Receiver PIC 16F877A LCD LED Sensor from 8 zones

Figure 2.1: The Overall System

8

2.2.1.3 ‘Sistem Penggera Keselamatan Rumah Kediaman Mudah dan Pintar’ by MOHD ROSLI BIN MAMAT

The project used the RF transmission and the project cover 4 to 5 zones. The components that this project used are encoder, voltage regulator, RF module, Antenna, decoder, PIC 16F877A microcontroller and alarm. The project limitations are:

  • 1. Expensive due to the voltage regulator is an end product purchased from the market.

  • 2. Big in size.

  • 3. Encoder-decoder not fully utilized; 15 data only used for 5 zones.

  • 4. The PIC micro-controller which can do more functions beside trigger alarm.

  • 5. Difficult to control because the system can be activated and deactivated through switching the power supply only.

The figure below show the overall system conducted by Mohd Rosli in Mamat :

8 2.2.1.3 ‘ Sistem Penggera Keselamatan Rumah Kediaman Mudah d an Pintar’ by MOHD ROSLI BIN

Figure 2.2: Overall Wireless Home Security System

9

  • 2.2.2 Others Related Projects

2.2.2.1 Home Security System by CHUN-PAI JIMMY HSIEH AND YANG CAO from Cornell University.

The project is a digital home security system with voice feature which can monitor room temperature, smoke, motion, windows and doors. This project built a wired home security system using different type of sensors. The project using the traditional magnetic switch equipped on doors and windows. Besides that, the project also using the temperature sensor, smoke detectors, and motion sensor. In this project the security system will sound an alert when there is an attempt of break-in or if there is possible smoke or fire. This project is built without considering how the owner of the system could switch off the system when he enters the armed house from outside. This is because the main control unit of the system is attached inside the house.

2.2.2.2 Monitoring and Controlling Of Device Using GSM by PRIYANKA from India

The project is designed and developed a wireless communication link to monitor and control equipments that are far away from user and also develop a higher security system to keep a check on them. This project are using ATMEL 89S52 microcontroller as an IC microcontroller. In this project at the transmitter is a mobile phone which uses certain codes corresponding to a particular relay to which the device is connected. And at the receiver the GSM modem receives the massage from the mobile phone and gives it to the microcontroller which act to control the devices.

10

  • 2.3 Reviews the Software and Hardware

    • 2.3.1 Hardware Review

2.3.1.1 PIC 16F877A Microcontroller

PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Programmable Interface Controller.

It has two types of internal memories. These memories are program memory and data memory. Program memory is provided by 8K words of flash Memory, and data memory has two sources. One type of data memory is a 368-byte RAM (random access memory) and the other is 256-byte EEPROM (Electrically erasable programmable ROM). The core feature includes interrupt capability up to 14 sources, power saving sleep mode, and single 5V In-Circuit Serial Programming (ICSP) capability. The sink/source current, which indicates a driving power from I/O port, is high with 25mA. Power consumption is less than 2mA in 5V operating condition.

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. PIC16F877A is so popular because it is very cheap. Apart from that, it is also very easy to be assembled. The additional components that you need to make this IC work are just a 5V power supply adapter, a 20MHz crystal oscillator and 2 units of 22pF capacitors. This IC can be

11

reprogrammed and erased up to 10,000 times. Therefore it is very good for new product development phase.

Below shows PIC 16F877A and its pin out.

11 reprogrammed and erased up to 10,000 times. Therefore it is very good for new product

Figure 2.3: Pin Out of PIC 16F877A

2.3.1.2

Sensor

  • 2.3.1.2.1 Magnetic Contact Sensor

Magnetic contacts are usually NC (Normally Closed) and are used on doors and windows. It is 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,

12

the magnet will be a distance away from the reed switch and hence the switch will open.

12 the magnet will be a distance away from the reed switch and hence the switch

Figure 2.4: The Picture Shows the Magnetic Sensor with Magnet

12 the magnet will be a distance away from the reed switch and hence the switch

Figure 2.5: This picture shows the installation of Sensor and magnet on the door.

2.3.1.2.2 Motion Sensor

This Motion/ PIR Sensor Switch can detect the Infrared rays released by Human Body Motion within the Detection Area (6 Meters). The PIR (Passive Infrared) sensor can sense even at night time. The sensor can fix near the door to

13

check the motion near to the door. So if someone enters into the detection area of the sensor, the microcontroller will read it and inform the mobile and you can hear a voice alarm "Motion Detected".

13 check the motion near to the door. So if someone enters into the detection area

Figure 2.6: Motion Sensor

2.3.1.3 Mobile Phone

Today’s 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 is possible. So this project used the mobile phone as a GSM Modem. It is a multi-functional, ready to use, rugged unit that can be embedded or plugged into any application. The mobile phone can be controlled and customized to various levels by using the standard AT Command. For this project K770i Sony Ericson are chosen as a mobile phone. This mobile phone is support with GSM.

14

2.3.1.4 MAX232 and D9

MAX232 was created for one purpose, to interface between Data Terminal Equipment (DTE) and Data Communications Equipment (DCE) employing serial binary data interchange. So as stated the DTE is the terminal or computer and the DCE is the modem or other communications device. MAX232 is an IC which is used to change signals from a RS-232 serial to match the circuit it interfaces with.

14 2.3.1.4 MAX232 and D9 MAX232 was created for one purpose, to interface between Data Terminal

Figure 2.8: Pin Assignments of MAX232 IC

The D-subminiature-9 or D-sub-9 is an electrical connector which is commonly used in computers. The RS-232 serial port is using D-sub-9 to connect with PC. In this case, the D-sub-9 female is used to connect with male D-sub-9 connector at PC.

14 2.3.1.4 MAX232 and D9 MAX232 was created for one purpose, to interface between Data Terminal

Figure 2.9: D-9 Connecter Configuration

15

2.3.1.5 RS-232 Serial Port

RS-232 is a popular communication protocol for connecting modems and data acquisition devices to computer. RS-232 is limited to point-to-point connection between PC serial ports and devices. Its hardware can be used for serial communication up to distances of 50 feet. A nine pin D plug has become the standard fitting for the serial ports of PC. The pin connection uses are shown in Table 2.2. The connector on the PC has male pins. Therefore the mating cable needs to terminate in a DB9/F (female pin) connector.

In RS-232, user data is sent as a time-series of bits. Both synchronous and asynchronous transmissions are supported by the standard. Each data or control circuit only operates in one direction, which is, signaling from a Data Terminal Equipment (DTE) to the attached Data Circuit-terminating Equipment (DCE) or the reverse.

15 2.3.1.5 RS-232 Serial Port RS-232 is a popular communication protocol for connecting modems and data

Figure 2.10: RS-232 PC Connector

Pin1 = Input, Data Carrier Detect (DCD) Pin2 = Input, Received Data (RXD) Pin3 = Output, Transmitted Data (TXD) Pin4 = Output, Data Terminal Ready (DTR) Pin5 = Signal Ground Pin6 = Input, Data Set Ready (DSR) Pin7 = Output, Request to Send (RTS) Pin8 = Input, Clear To Send (CTS) Pin9 = Input, Ring Indicator (RI)

16

  • 2.3.2 Software Review

2.3.2.1 MikroC

MikroC is an advanced and comprehensive C compiler for PIC MCUs. It supports languages such as assembly, ANSI (with minor modifications) and so on. The output format is usually in assembly, Binary or Hex. Applications for PIC can be developed quickly and easily with many practical examples provided in MikroC. The MikroC includes a number of useful implemented tools to help in developing the application more quickly and comfortably.

For example:

  • 1. USART Terminal MikroC includes USART (Universal Synchronous Asynchronous Receiver Transmitter) terminal for RS232 communication - baud rate control, RTS and DTR commands.

  • 2. EEPROM Editor

Built-

in EEPROM Editor allow

you

to

easily

manage EEPROM of PIC

microcontroller.

 
  • 3. ASCII Chart ASCII Chart is a handy tool, particularly useful when working with LCD display.

  • 4. MicroBootloader This

is

a

function to burn the program in

hex file

into

the PIC through the

specified Boot loader to the respective PIC.

17

2.3.2.2 Microsoft Visual Basic 2008

The traditional languages are considered as procedural language where the program specifies the exact sequence of all operations. Program logic determines the next instruction to execute in response to response to conditions and user request. Microsoft Visual Basic uses a different approach, which is object oriented programming. It is an event driven programming language where programs are no longer procedural or does not follow a sequential logic. This software allows the designed programs run under the windows without complexity associated with windows programming. Standard windows buttons can be hold on design screen such as command buttons, text boxes and so on. Each of these windows objects produces a standard user interface that makes the program becomes user friendly.

2.3.2.3 Overview of GSM Technology

GSM stands for Global System for Mobile communication. It is a huge, rapidly expanding and successful technology. During the period of Evolution of mobile communication technologies various systems were introduced and deployed to achieve standardization in mobile industry but all the efforts were failed. Multiple issues were sustained like incompatibility of systems, development of digital radio frequency. That is when GSM Technology was introduced and problems like standardization, incompatibility etc were overcame. TDMA solution was chosen in 1987, it is narrowband system and TDMA standards for Time Division Multiple access.

18

  • 2.3.2.4 Advantages of GSM

The advantages of GSM are:

  • 1. GSM uses radio frequencies efficiently and due to the digital radio path, the system tolerates more intercell disturbances.

  • 2. The average speech quality is better than in analogue system.

  • 3. Data transmission is supported throughout the GSM system.

  • 4. Speech is encrypted and subscriber information security is guaranteed.

  • 5. With ISDN compatibility new services are offered.

  • 6. International roaming is technically possible within all country using the GSM system.

  • 7. The large market increases competition and lowers prices both for investment and usage.

  • 2.3.2.5 GSM Modem

A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem is similar to a dial up modem. The main differences between them is that a dial-up modem sends and receives data through a fixed copper telephone line while a wireless modem sends and receives data through radio waves or wireless networks.

There are three different types of GSM Modem, and it can be categorized as follows:

19

use depends on the capability of the GSM modem. Need to insert a GSM Subscriber Identity Module (SIM) card into this modem.

  • 2. A GSM modem can be a PC Card/PCMCIA Card installed in a notebook computer, such as the Nokia Card Phone.

  • 3. A GSM modem could also be a standard GSM hand phone with the appropriate cable and software driver to connect to a serial port on your computer.

2.3.2.6 AT COMMAND

AT command is the command uses to control the GSM modem or mobile phone to perform task for example SMS sending or phone calling. In this project, AT command is only used to send out the SMS. The AT commands held a very important role in this project as the project key advantage is focus on the auto SMS function.

The AT command can be write and tested through the hyper terminal. Before the writing of AT command, the mobile has to test in order to determine which type of SMS mode it is supporting. The SMS mode is divided is into 2 types, one is called PDU mode and another is called text mode. For PDU mode, the message content that wish to send has to convert to HEX code before sending is made. For text mode, SMS can simply be the alphabet format that we written normally. There are also mobile phones that support type of SMS mode. Therefore it’s easier if mobile phone that supports both modes is used.

20

The AT command set was developed by Hayes Microcomputer Products and this command is recognized by virtually all modems. The modem supports the standard and extended Hayes AT command set. In addition to this common set of standard AT commands, mobile phones and GSM modems support an extended set of AT commands. One use of the extended AT commands is to control the sending and receiving of SMS messages. These extended AT commands are defined in the GSM standards.

Extended AT commands allow us to:

  • 1. Reading, writing and deleting SMS messages.

  • 2. Sending SMS messages.

  • 3. Monitoring the signal strength.

  • 4. Monitoring the charging status and charge level of the battery.

  • 5. Reading, writing and searching phone book entries.

Table 2.1: Example of AT COMMAND

20 The AT command set was developed by Hayes Microcomputer Products and this command is recognized

CHAPTER 3

METHODOLOGY

  • 3.1 Chapter Overview

Before starting the project, it is important to determine the methodology used to make sure this project is a success. So in this chapter will discuss about the methods and approaches that have been used from the beginning until the end of this project.

  • 3.2 Stage of Methodology and Approach Below show the methodology and approach for this project: Make a research and study

CHAPTER 3 METHODOLOGY 3.1 Chapter Overview Before starting the project, it is important to determine the

Software implementation

Analysis and test

CHAPTER 3 METHODOLOGY 3.1 Chapter Overview Before starting the project, it is important to determine the
CHAPTER 3 METHODOLOGY 3.1 Chapter Overview Before starting the project, it is important to determine the

Planning

CHAPTER 3 METHODOLOGY 3.1 Chapter Overview Before starting the project, it is important to determine the

Hardware implementation

Figure 3.1: Flow of Methodology

22

  • 3.3 The work flow for the whole project

    • 3.3.1 Make a research and study

In this stage, gather the information about the project via Internet, journals, magazines, published work and reference books. So searching more information relating wireless home security system is very important for begin this project. From there, the important features of good wireless home security system can be indentifying. Besides that, Full understanding and literature review on wireless home system are needed.

Then in this stage, Survey has been done on wireless home security system and wireless home appliances control products available in the market. It is very important because their features are deeply analyzed and then it can be implemented in my project. Below are the wireless home security system products in the market:

1. Night GUARDIAN Motion Sensor Light

22 3.3 The work flow for the whole project 3.3.1 Make a research and study In

Night GUARDIAN Motion Light Sensors enhance convenience and security by automatically turning on one or more lights or other devices whenever presence is detected. They are designed for use with one or more lights up to 600 watts. With no minimum load requirement they can be used with low wattage appliances such as fluorescent lamps, alarms and video cameras.

23

  • 2. Techko Solar Powered Magnetic Sensor Entry Alarm

23 2. Techko Solar Powered Magnetic Sensor Entry Alarm Features 1. Use on non-tinted transparent windows,

Features

  • 1. Use on non-tinted transparent windows, sliding non-tinted transparent doors facing sunlight

  • 2. Built in 90dB alarm

  • 3. No tools installation

  • 4. Ultra thin design

  • 3. Hi-Res Varifocal Indoor Day/Night Dome Camera

23 2. Techko Solar Powered Magnetic Sensor Entry Alarm Features 1. Use on non-tinted transparent windows,

This camera offers crisp clear images designed for most interior security applications. This camera is a UN Ultra Low Light Camera offering Back Light compensation, Automatic Gain control, Auto White Balance, Motion detection, and Programmable Privacy Zones.

24

  • 4. Glass Break Detector

24 4. Glass Break Detector Features 1. Adjustable and shock sensitive. 2. Cover a large area

Features

  • 1. Adjustable and shock sensitive.

  • 2. Cover a large area of windows.

  • 3. Radius coverage is 50 Feet.

  • 4. Range: 240 feet restricted - 450 feet unrestricted.

Next, the concept of Global System of Mobile Communication (GSM) needs to be understood. This concept is very important because the project will be used the system as a main system. Furthermore, theory in how SMS is being transmitted and the protocol of mobile phone also needed to be understood. This can be done by doing a lot of literature reviews. Therefore also went through the relevant thesis done by previous graduates in UTM and other projects that are related with this project.

3.3.2

Planning

In this

stage, the previous works related to this project

are studied and

analyzed in order to determine the disadvantages in their researches or projects. Then, the lacking features in their works are improved and implemented in this project.

25

Next, search more information about the suitable components that will be used in this project. This process really takes a time since need to decide the exact components for the project. In this step, facing difficulty in getting some of the desired components.

Then, make analyzed the information about the component and choose the suitable component for this project.

After the analyzed below the important component that will be used for this

project:

  • 1. PIC 16F877A

  • 2. IC MAXIM 232

  • 3. MAX 232 converter

  • 4. Mobile Phone

  • 5. Magnetic contact sensor

  • 6. Motion sensor

  • 7. Fan

  • 8. LED as a lamp

Therefore to planning the process or step for my project is very important. The planning process is creating by using the grant chat.

26

Below the grant chart that show the planning.

FINAL YEAR PROJECT 1 (FYP 1)

July August September No Tasks/activities 3 4 5 6 7 8 9 10 11 1 Briefing
July
August
September
No
Tasks/activities
3
4 5
6 7
8 9
10 11
1 Briefing on FYP
2 Determine topic of interest
  • 4 Literature review

  • 5 Submit proposal

  • 6 Study on technology related

3

Discuss topic with supervisor

   
4 Literature review 5 Submit proposal 6 Study on technology related 3 Discuss topic with supervisor
  • 8 Determine hardware to purchase

  • 9 Thesis writing

  • 10 Submit thesis for FYP 1

7

Presentation preparation

 

HARI RAYA BREAK

HARI RAYA BREAK 12
HARI RAYA BREAK 12
HARI RAYA BREAK 12
12
12
HARI RAYA BREAK 12
July August September No Tasks/activities 3 4 5 6 7 8 9 10 11 1 Briefing
October 13 14 15
October
13
14
15

Figure 3.2: The Grant Chart for FYP 1

FINAL YEAR PROJECT 2 (FYP 2)

No

Tasks/activities

December

 

January

   

February

 

March

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

1

Project overview

                           

2

Hardware develop

                           

3

Software develop

                           

4

Hardware and

                           

software

       

implementation

5

Analysis and test

                           

6

Thesis writing

                           

7

Final presentation

                           

Figure 3.3: The Grant Chart for FYP 2

27

  • 3.3.3 Hardware Implementation

To design this project, the circuit design and hardware development play an important role. Where, all the hardware part such as sensor, PIC16F877A microcontroller and voltage regulator are combined together.

Besides that, the availability of the hardware and its cost are considered in choosing the components. Cost is important in this project since this system is targeted on a low cost product.

Then, the hardware is studied based on the theories and its interfacing with other components.

3.3.3.1 Voltage regulator

Switch ON/OFF LM 7805 Voltage regulator Power Indicator Power Supply Button master reset
Switch ON/OFF
LM 7805
Voltage regulator
Power Indicator
Power Supply
Button master reset

Figure 3.4: The Circuit of Voltage Regulator

28

The main component to design the voltage regulator is LM 7805 voltage regulator. The LM7805 will generate some heat at the power supply. The power source is from the battery or AC to DC adaptor. Normally the power supply is from 9V to 12V. LM7805 (1A maximum) will regulate the given voltage to 5V (VCC) to supply to the PIC16F877A and pull-up the push button (input). The purpose of using diode IN4007 (D1) is for circuit protection in case the polarity of the power source is incorrect. All the capacitor is use to stabilize the voltage input and output of the LM7805. D2 is a green Light Emitter Diode (LED) as power indicator.

3.3.3.2 Reset (MCLR)

The PIC 16F877A differentiates various kind of reset which includes:

  • 1. Power-on Reset (POR)

  • 2. MCLR Reset during normal operation

  • 3. MCLR Reset during Sleep

  • 4. WDT Reset (during normal operation)

  • 5. WDT Wake-up (during Sleep)

  • 6. Brown-out Reset (BOR)

Some registers are not affected in any Reset condition. Their status is unknown on POR and unchanged in any other Reset. Most other registers are reset to a “Reset state” on Power-on Reset (POR), on the MCLR and WDT Reset, on MCLR Reset during Sleep and Brownout Reset (BOR). They are not affected by a WDT wake-up which is viewed as the resumption of normal operation.

29

From the various kind of reset available in the microcontroller, MCLR is concerned in this project. The PIC 16F877A has a noise filter in the MCLR Reset path. The filter will detect and ignore small pulses. It should be noted that a WDT Reset does not drive MCLR pin low. Voltages applied to the pin that exceed its specification can result in both Resets and current consumption outside of device specification during the Reset event. For this reason, it is recommended that the MCLR pin no longer be tied directly to VDD.

3.3.3.3 Interface PIC16F876A with PIR Sensor

29 From the various kind of reset available in the microcontroller, MCLR is concerned in this

Figure 3.5: The Placement of Motion Sensor in a Hardware Prototype

29 From the various kind of reset available in the microcontroller, MCLR is concerned in this
29 From the various kind of reset available in the microcontroller, MCLR is concerned in this

Figure

3.6:

The

Circuit

Motion Sensor to PIC

of

30

Output pin from PIR sensor can be connected to Port B I/O pin 2 from PIC16F877A while the Vcc pin and GND pin should be connected to 5V and GND respectively. In this project, the PIR sensor is function as to detect the intruder in the home. This is part for the security system in the home.

3.3.3.4 Interface PIC16F876A with magnetic contact sensor

30 Output pin from PIR sensor can be connected to Port B I/O pin 2 from

Figure 3.7: The Placement of Magnetic Contact Sensor in a Hardware Prototype

30 Output pin from PIR sensor can be connected to Port B I/O pin 2 from
30 Output pin from PIR sensor can be connected to Port B I/O pin 2 from

Figure 3.8: The Circuit of Magnetic Contact Sensor to PIC

31

The function of magnetic sensor is same with motion sensor. But the magnetic sensor is connected to Port B I/O pin 1 from PIC16F877A. The magnetic sensor is installed at the door in the home.

  • 3.3.3.5 Interface PIC16F877A with fan and lamp

31 The function of magnetic sensor is same with motion sensor. But the magnetic sensor is

Figure 3.9: The Placement of Fan and Lamp in a Hardware Prototype

The 8 LED is to combine as a lamp is connected to port d with PIC16F877A and a fan is connected to port B at pin 4. In this project both are as appliances to control using mobile phone. Both will be function if the mobile phone gives the command.

  • 3.3.3.6 Interface PIC16F877A with Buzzer

31 The function of magnetic sensor is same with motion sensor. But the magnetic sensor is
31 The function of magnetic sensor is same with motion sensor. But the magnetic sensor is

Figure 3.10: The Circuit of Fan and Lamp to PIC

32

The base of 2N2222 (transistor) can be connected to any I/O pin through a 1K Ohm resistor and the emitter should be connected to GND. Negative terminal (black wire) of buzzer should be connected with collector transistor (2N2222) and positive terminal (red wire) should be connected to Vcc as shown in schematic diagram.

3.3.3.7 In circuit Serial Programming (ICSP) for Programming PIC Microcontroller

32 The base of 2N2222 (transistor) can be connected to any I/O pin through a 1K
32 The base of 2N2222 (transistor) can be connected to any I/O pin through a 1K

Figure 3.11: The Connected of USB Programmer

In Circuit Serial Programming (ICSP) is used for loading program in this project. ICSP offers a convenience way to load program into PIC microcontroller without removing the PIC from the circuit board. So pin 1 (Vpp), pin 27 (PGC) and pin 28 (PGD) from PIC should be connected to USB In Circuit Programmer (UIC00A) through the external cable. Besides, GND from the circuit board also should be connected with GND from UIC00A and pin 34 (PGM) should be pulled to GND through a 10K resistor as shown Figure 3.11.

33

3.3.3.8 Serial Communication Interface Circuit DB-9 To PIC (Female) IC MAX 232
3.3.3.8 Serial Communication Interface Circuit
DB-9
To PIC
(Female)
IC
MAX 232

Figure 3.12: The Serial Communication Interface Circuit

The Universal Synchronous Asynchronous Receiver Transmitter (USART) module is one of the two serial I/O modules. USART is also known as a Serial Communication Interface (SCI). The USART can be configured as a full-duplex asynchronous system that can communicate with peripheral devices such as CRT terminals and personal computer, or it can be configured as a half duplex synchronous system that can communicate with peripheral devices such as A/D or D/A integrated circuits, serial EEPROM, and others.

The USART can be configured in the following modes:

  • 1. Asynchronous (full-duplex)

  • 2. Synchronous Master (half-duplex)

  • 3. Synchronous Slave (half-duplex)

34

Bit SPEN in Receive Status and Control Register (RCTA) and bit TRISC have to be set in order to configure pins RC6/TX/CK and RC7/RX/DT as the Universal Synchronous Asynchronous Receiver Transmitter. The Baud Rate Generator (BRG) supports both the asynchronous and synchronous modes of the USART. It is a dedicated 8-bit baud rate generator. Given the desired baud rate and oscillator’s frequency (Fosc), the nearest integer value for the SPBRG register in the microcontroller can be calculated using the formula in Table 3.1.

Table 3.1: Baud Rate formula

34 Bit SPEN in Receive Status and Control Register (RCTA) and bit TRISC have to be
34 Bit SPEN in Receive Status and Control Register (RCTA) and bit TRISC have to be

Figure 3.13: The Hardware Prototype

35

  • 3.3.4 Software Implementation

The software is used for simulation and programming purposes. Besides that, software is required to program the microcontroller. The software is very important so that the system can be operated. Therefore it is take time to determine the software goanna be used.

Besides that, this project is designed to enable it to communicate with the computer and the mobile phone device. So the suitable software is needed to communicate there. Then, in this stage also the programming for this project must be written and simulated to the hardware.

Therefore, below is the software used in this project:

  • 1. For PIC microcontroller the MicroC is used to the hardware with create programming.

  • 2. The Proteus (ISIS 6 Professional) used to design the circuit for hardware part.

  • 3. To design the Graphic User Interface with the Visual Basic 2008.

  • 4. To make a connection between computer and hardware to mobile phone (GSM modem) is Using AT command and need know the protocol of this mobile phone.

36

  • 3.3.4.1 Programming the Hardware using MicroC

Below is the step to make programming the hardware:

Step 1: Open the microC compiler for PIC

36 3.3.4.1 Programming the Hardware using MicroC Below is the step to make programming the hardware:

Step 2: Create the programming and save

36 3.3.4.1 Programming the Hardware using MicroC Below is the step to make programming the hardware:

37

Step 3: After the program had successfully been compiled, a .hex file will appear for both software. This file format then will be used in PICkit 2 Programmer to be “burn” into the microcontroller by using suitable programmer device preferred by the user.

37 Step 3: After the program had successfully been compiled, a .hex file will appear for

Figure 3.14: PICkit 2 Software Interface

37 Step 3: After the program had successfully been compiled, a .hex file will appear for

Figure 3.15: USB ICSP Programmer Device

38

3.3.4.2 Motion Sensor Programming

Programming

38 3.3.4.2 Motion Sensor Programming Programming

39

Start Switch No button pressed? Yes Delay 15 Seconds Alarm set (LED blink in low frequency).
Start
Switch
No
button
pressed?
Yes
Delay 15
Seconds
Alarm set (LED
blink in low
frequency). Wait
for PIR set.
No
PIR
sensor
set?
Yes
Alarm (Buzzer)
active
Transmitted 1 byte
data (B) to PC
PC sends Message
(SMS) to phone
Reset
No
button
pressed?
Yes
Alarm (Buzzer) still active
but data not send to PC
Figure 3.16: Flow Chart for Motion Sensor programming

40

  • 3.3.4.3 Magnetic Contact Sensor Programming

Programming

40 3.3.4.3 Magnetic Contact Sensor Programming Programming

41

  • Start

button No Yes Yes Delay 15 Seconds sensor Magnetic set? Alarm set (LED blink in low
button
No
Yes
Yes
Delay 15
Seconds
sensor
Magnetic
set?
Alarm set (LED
blink in low
frequency). Wait
for Magnetic set.
No
Switch
Transmitted 1 byte
data (B) to PC
pressed?
Yes
No
Alarm (Buzzer) still active
but data not send to PC
Alarm (Buzzer)
active
PC sends Message
(SMS) to phone
Reset
button
pressed?

Figure 3.17: Flow Chart for Magnetic Contact Sensor Programming

42

3.3.4.4 Home Appliances ( Fan and Lamp) Programming

Programming

42 3.3.4.4 Home Appliances ( Fan and Lamp) Programming Programming Flow chart Start Start Type “ON

Flow chart

 
Start
Start
Start
Start

Type “ON Lamp”

 

Type OFF

 

from Mobile

Lamp”

Start Start Type “ON Lamp” Type “ OFF from Mobile Lamp” Send to number Phone Send
Start Start Type “ON Lamp” Type “ OFF from Mobile Lamp” Send to number Phone Send
 

Send to number Phone

   

Send to number Phone

 
Start Start Type “ON Lamp” Type “ OFF from Mobile Lamp” Send to number Phone Send
Start Start Type “ON Lamp” Type “ OFF from Mobile Lamp” Send to number Phone Send

Lamp in hardware and GUI will light

Lamp in hardware and GUI will light

Figure 3.18: Flow Chart for ON/OFF Lamp

43

 
Start
Start
Start
Start

Type ON Fanfrom Mobile

 

Type OFF Fanfrom Mobile

 
Start Start Type “ ON Fan ” from Mobile Type “ OFF Fan ” from Mobile
Start Start Type “ ON Fan ” from Mobile Type “ OFF Fan ” from Mobile
 

Send to number Phone

   

Send to number Phone

 
Start Start Type “ ON Fan ” from Mobile Type “ OFF Fan ” from Mobile
Start Start Type “ ON Fan ” from Mobile Type “ OFF Fan ” from Mobile

Lamp in hardware and GUI will light

Lamp in hardware and GUI will light

Figure 3.19: Flow Chart for ON/OFF Fan

3.3.4.5 Graphic User Interface

43 Start Start Type “ ON Fan ” from Mobile Type “ OFF Fan ” from

Figure 3.20: Main of Graphic User Interface

44

44 Figure 3.21: Output of Graphic User Interface 3.3.5 Analysis and Testing In this final stage,

Figure 3.21: Output of Graphic User Interface

  • 3.3.5 Analysis and Testing

In this final stage, the system hardware is analysed and tested to improve the system. Besides that, this system is imagined as a real system to figure out the problems that could face when implemented in a home.

3.3.5.1 Testing the AT COMMAND

The AT commands can

be written and

tested through the use of hyper

terminal. The setup of hyper terminal has to be done like shown in Figure 3.22,

Figure 3.23 and Figure 3.24.

45

45 Figure 3.22: The Hyper Terminal Connection Setup Figure 3.23: Hyper Terminal Com Port Setup

Figure 3.22: The Hyper Terminal Connection Setup

45 Figure 3.22: The Hyper Terminal Connection Setup Figure 3.23: Hyper Terminal Com Port Setup

Figure 3.23: Hyper Terminal Com Port Setup

46

46 Figure 3.24: The Interface for Write AT Command Figure 3.25: Testing the AT Command AT

Figure 3.24: The Interface for Write AT Command

46 Figure 3.24: The Interface for Write AT Command Figure 3.25: Testing the AT Command AT

Figure 3.25: Testing the AT Command

AT command that written and tested will then being written into the visual basic program in order to control using the mobile phone.

CHAPTER 4

RESULT AND DISCUSSIONS

  • 4.1 Chapter Overview

This chapter discusses the result and discussion for this project. These chapters also discuss how the project works.

  • 4.2 The Block Diagram for This Project

CHAPTER 4 RESULT AND DISCUSSIONS 4.1 Chapter Overview This chapter discusses the result and discussion for

Hardware

Computer

Mobile Phone

Figure 4.1: The Block Diagram for Security System

48

Lamp

48 Lamp Mobile Phone Fan Figure 4.2: The Block Diagram for Home Appliances Control 4.3 How
48 Lamp Mobile Phone Fan Figure 4.2: The Block Diagram for Home Appliances Control 4.3 How

Mobile Phone Computer Fan Figure 4.2: The Block Diagram for Home Appliances Control

  • 4.3 How Does it Work?

    • 1. If the intruder through the door the magnetic sensor will work and the buzzer will sound.

    • 2. The hardware will send the 1 byte data (A) using USART programming to the GUI in the computer.

    • 3. Then from GUI in the computer will send the SMS to home owner mobile phone to inform the thief is occur.

    • 4. If the thief not through the door the motion sensor will work and the buzzer will sound. The process is same like magnetic sensor.

    • 5. While for case to control a lamp by using the mobile phone also, When the

home owner type “ON LAMP” in the create message at the mobile phone

and send to the mobile phone (is connected with computer using usb cable)

so the switch “ON” for a lamp in the system will become a green colour,

49

the lamp in a hardware and in a GUI will light and “ON LAMP” the textbox in the system show “ON LAMP”.

  • 6. For case off a lamp also, but the textbox will show “OFF LAMP” and lamp in a hardware and in a GUI will non active.

  • 7. While the process for the cases of on and off fan are same with the on and off lamp.

  • 4.3 The Result for This Project

    • 4.3.1 For the security system

49 the lamp in a hardware and in a GUI will light and “ON LAMP” the

Figure 4.3: The Main System

This

is

a

main

system for this project. When the system is run the figure

4.3.will appears.

 

50

50 Enter your username and password Figure 4.4: The Login This System The user must be
Enter your username and password
Enter your
username and
password
50 Enter your username and password Figure 4.4: The Login This System The user must be

Figure 4.4: The Login This System

The user must be fill in the username and the password to login this system.

50 Enter your username and password Figure 4.4: The Login This System The user must be

Figure 4.5: The Output Graphical User Interface

51

The system was in the output interfacing. In the figure the sensor are motion and magnetic is one group. While the home appliances are grouped in a one group. The home appliances are a lamp and a fan. Both has one button for on and off respectively. The system also has a message box and a com port to determine the value of serial port. The run and stop button is for timer. The exit button is to exit this system.

51 The system was in the output interfacing. In the figure the sensor are motion and

Figure 4.6: The System show user chosen the Com Port

The user must to choose the com port for serial port to run this system.

52

52 Figure 4.7: The Hardware Prototype Figure 4.8: The System Show When the Magnetic Contact Sensor

Figure 4.7: The Hardware Prototype

52 Figure 4.7: The Hardware Prototype Figure 4.8: The System Show When the Magnetic Contact Sensor

Figure 4.8: The System Show When the Magnetic Contact Sensor is Active

53

Button on power supply in the hardware is pressed and then pressed the pushbutton. If the intruders open the door the button of magnetic contact sensor will become a green colour. In the message box is appear message “ Perhatian!!! Rumah anda telah dicerobohi.Sila ambil tindakan lanjut.” . Then the systems send this message to the owner number of mobile phone. When the owner received this

message the message “Message Sent!” appears in the system.

Figure… ..
Figure… ..

Figure 4.9: The System Show When the Motion Sensor is Active

Button on power supply in the hardware is pressed and then pressed the pushbutton. If the thief occur which the intruder entered the house through the roof or other doors, the button of motion sensor will become a green colour. In the message box is appear message “ Perhatian!!! Rumah anda telah dicerobohi.Sila ambil tindakan lanjut.” . Then the systems send this message to the owner number of mobile phone. When the owner received this message the message “Message Sent!”

appears in the system.

54

4.3.2 For the Wireless Home Appliances Control

54 4.3.2 For the Wireless Home Appliances Control Figure 4.10: The Hardware Prototype Show a Lamp

Figure 4.10: The Hardware Prototype Show a Lamp is Light

54 4.3.2 For the Wireless Home Appliances Control Figure 4.10: The Hardware Prototype Show a Lamp

Figure 4.11: The System Show a Lamp is Light

These Figure 4.10 and Figure 4.11 are show both a lamp in hardware and in

system light when the home owners send message “ON LAMP” from the mobile

phone.

55

55 Figure 4.12: The System Show a lamp is non active The Figure 4.12 show a

Figure 4.12: The System Show a lamp is non active

The Figure 4.12 show a lamp in the system is non active when the home owners send message “OFF LAMP” from a mobile phone. It also occurs at a lamp in the hardware.

55 Figure 4.12: The System Show a lamp is non active The Figure 4.12 show a

Figure 4.13: The Hardware Prototype Show a fan is Active

56

56 Figure 4.14: The System Show a fan is Active These Figure 4.13 and Figure 4.14

Figure 4.14: The System Show a fan is Active

These Figure 4.13 and Figure 4.14 show both a fan in the hardware and in the system is active when the home owners send message “ON FAN” from the mobile phone.

56 Figure 4.14: The System Show a fan is Active These Figure 4.13 and Figure 4.14

Figure 4.15: The System Show a Fan is Non Active

57

The Figure 4.15

show a

fan

in

the

system is

non active when the home

owners send message “OFF FAN” from a mobile phone. It also occurs at a fan in the

hardware.

4.3.3 To Exit the System

57 The Figure 4.15 show a fan in the system is non active when the home

Figure 4.16: The System Show When the Exit Button Pressed

When the home owner pressed the exit button the message is appear. In the message the yes button for closed the system and no button for go to main of the system.

CHAPTER 5

CONCLUSION AND SUGGESTION

5.1

Conclusion

This project can be concluded that the target to control home appliances remotely using the SMS-based system and develop the security system based GSM has achieved. GSM technology capable solution has proved to be controlled remotely, provide home security and is cost-effective as compared to the previously existing systems. Hence we can conclude that the required goals and objectives of GSM-based wireless home appliances control and security system have been achieved. The security and home appliances control has been implemented.

To summary the project that the project was developed to make a home security from the intruder. The system in this project will be informed to home owners if the theft is occurred. This project also was developed that could be used to control electrical appliances through a mobile phone. The appliances are a lamp and a fan.

59

  • 5.2 The Limitations

The limitations of this project are this project only has two sensors to detect the intruder. So this project can be implementing in a small house that have a narrow space. Besides that, others limitation is the project only control not real appliances.

  • 5.3 Suggestion and Future Development Since this project

is

important to reduce the theft and robbery cases in

Malaysia by providing advanced feature at low cost, some recommendations to improve this project are hereby proposed. Some of the suggestions to future development are listed as below:

  • 1. Connecting more device To develop the system that connecting to more devices. So the system can improve this project. It is because these projects are connected to two sensor and two appliances.

  • 2. Can control more appliances. To develop that project to control more of appliances like washing machine, television, air condition and others of electrical appliances.

  • 3. Another sensor could be added to the system More of sensor can be installed to home like smoke detector, motion detector, light sensor and other sensor.

60

REFERENCES

  • 1. AFZAHANIFF HUSSIN ( MAY 2008 ). Security and control system. degree, Universiti Teknologi Malaysia, Skudai.

Bachelor

  • 2. LOGESWARAN A/L ARUMUGAM ( MAY 2009 ). Wireless home security system. Bachelor degree, Universiti Teknologi Malaysia, Skudai.

  • 3. MOHD ROSLI BIN MAMAT ( 2007 ). ‘Sistem Penggera Keselamatan Rumah Kediaman Mudah Dan Pintar’. Bachelor degree. Universiti Teknologi Malaysia, Skudai.

  • 4. CHAN HWOH CHUENG ( MAY 2009 ). Wireless home security system. Bachelor degree, Universiti Teknologi Malaysia, Skudai.

  • 5. CHUN-PAI JIMMY HSIEH AND YANG CAO ( 2004). Home security system. Cornell University.

  • 6. PRIYANKA. Monitoring and controlling of device using GSM. India

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

  • 8. PIC 16F877A Manual Datasheet, Microchip Technology Inc.

10. http://en.wikipedia.org

61

APPENDIX A

Main Board Circuit Schematic

61 APPENDIX A Main Board Circuit Schematic

62

APPENDIX B

The Programming for Hardware

#define magnetic_sensor PORTB.F1 #define motion_sensor PORTB.F2 #define switch_button PORTA.F0 #define lamp PORTD #define fan PORTB.F4 #define LED PORTC.F4 #define buzzer PORTC.F0 void main () { unsigned int mode; unsigned int mode_1,mode_2; unsigned long temp1,temp2; unsigned char data; ADCON1 = 0x06; TRISA = 0b11111111; // set Port A as Input TRISB = 0b11101111; // set Port B as Input except port 4 TRISC = 0b00000000; // set Port C as Output TRISD = 0b00000000; // set Port D as Output Usart_Init (9600);

delay_ms(100);

/*RESET ALL OUTPUT*/

mode = 0;

mode_1=0;

mode_2=0;

lamp=0;

LED=0;

buzzer=0;

fan=0;

do { if(Usart_Data_Ready ()) { data = Usart_Read(); if(data=='L') { lamp = 255;

63

delay_ms(2000);

} else if(data =='P') { lamp = 0; } else if (data =='F') { fan = 1;

delay_ms(2000);

} else if (data == 'N') { fan =0; }

} if(switch_button == 0) { while(switch_button == 0);

Delay_ms(500);

mode = 1; } if ((mode == 1)&&(mode_1!=3)) {

mode_1=1;

temp1=0;

mode = 0; } if ((motion_sensor==1)&&(mode_1==2)) { Usart_Write ('A');

Delay_ms(50);

mode_1=3;

} if ((magnetic_sensor==1)&&(mode_1==2)) { Usart_Write ('B');

Delay_ms(50);

mode_1=3;

}

switch(mode_1)

{

 

case 1:

LED=1;

temp1+=1;

if(temp1<40000) buzzer=1; else if(temp1>60000) {

//Buzzer is funtion

64

temp1=0;

mode_1=2;

}

else buzzer=0;

break;

case 2:

temp2+=1;

//PORTD.F2 = 0; /*test funtion*/ buzzer = 0;

if(temp2<10000)

LED=1;

//LED blink

else if(temp2<100000)

LED=0;

else temp2=0;

break;

case 3:

temp2+=1;

//PORTD = 0xFF;

/*test funtion*/

//PORTD.F5 = 0; PORTD.F6 = 0;

/*test funtion*/

if(temp2<40000)

{

LED=1;

//LED blink & buzzer are funtion

buzzer=1;

} else if(temp2<60000) {

LED=0;

buzzer=0;

}

else temp2=0;

break;

}

default:

}

}

while(1);

break;

65

APPENDIX C

The Programming for Interfacing

Public Class OUTPUT

Private Sub OUTPUT_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load MAIN.Hide() Dim COMPort As String() COMPort = System.IO.Ports.SerialPort.GetPortNames() For Each port In COMPort

ComboBox1.Items.Add(port)

Next

End Sub

Private Sub control_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles control.Enter

End Sub Dim Q As Queue(Of String) = New Queue(Of String) Dim DataRead As String = 0 Dim objSMS As mCore.SMS Dim strmyMessage As String

Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles

SerialPort1.DataReceived

Timer1.Start()

DataRead = SerialPort1.ReadExisting If (DataRead = "A") Then MOTION.BackColor = Color.Green End If If (DataRead = "B") Then MAGNETIC.BackColor = Color.Green End If

objSMS = CreateObject("mCore.SMS") If objSMS.LogSize > 100 Then

objSMS.ClearLog(10)

End If

66

objSMS.LogType = 2 objSMS.Port = "COM6" objSMS.BaudRate = 9600 objSMS.Character = 0 objSMS.LongMessage = 3 strmyMessage = "Perhatian!!! Rumah anda telah diceroboh.Sila ambil tindakan lanjut. " objSMS.SendSMS("+60129215921", strmyMessage) If Not objSMS.IsError(True) Then MessageBox.Show("Message Sent!") End If objSMS = Nothing

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick SyncLock DataRead If DataRead.Equals("A") Then Dim strInput As String = "Perhatian!!! Rumah anda telah diceroboh.Sila ambil tindakan lanjut. " TextBox1.Text = strInput DataRead = 0 End If If DataRead.Equals("B") Then Dim strInput As String = "Perhatian!!! Rumah anda telah diceroboh.Sila ambil tindakan lanjut. "

TextBox1.Text = strInput DataRead = 0 End If End SyncLock End Sub Dim iResponse As Integer

Dim LampOn As String = 0 Dim LampOff As String = 0 Dim FanOn As String = 0 Dim FanOff As String = 0

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

SerialPort1.Close()

SerialPort1.PortName = ComboBox1.SelectedItem.ToString()

If SerialPort1.IsOpen() Then

SerialPort1.Close()

Else

SerialPort1.Open()

MessageBox.Show("Port1 Open")

67

End If

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Timer1.Stop()

SerialPort1.Close()

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Timer1.Start()

End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Button5.BackColor = Color.Green LampOn = "L" TextBox1.Text = "ON LAMP"

SerialPort1.Write(LampOn)

PictureBox1.Visible = False PictureBox3.Visible = True End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Button5.BackColor = Color.Empty PictureBox3.Visible = False PictureBox1.Visible = True

TextBox1.Clear()

Button6.BackColor = Color.Red LampOff = "P" TextBox1.Text = "OFF LAMP"

SerialPort1.Write(LampOff)

PictureBox1.Visible = True PictureBox3.Visible = False End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Timer2.Start()

Timer3.Start()

Timer4.Start()

Timer3.Enabled = False Timer4.Enabled = False Button1.BackColor = Color.Green FanOn = "F" TextBox1.Text = "ON FAN"

SerialPort1.Write(FanOn)

68

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Timer2.Stop()

Timer3.Stop()

Timer4.Stop()

Button2.BackColor = Color.Red FanOff = "N" TextBox1.Text = "OFF FAN"

SerialPort1.Write(FanOff)

PictureBox2.Visible = True End Sub

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick PictureBox2.Visible = False PictureBox4.Visible = True Timer4.Enabled = True Timer3.Enabled = False

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick PictureBox5.Visible = False PictureBox2.Visible = True Timer3.Enabled = True Timer2.Enabled = False

End Sub

Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick PictureBox4.Visible = False PictureBox5.Visible = True Timer2.Enabled = True Timer4.Enabled = False End Sub End Class

69

APPENDIX D

The Project Prototype

69 APPENDIX D The Project Prototype