50
DEDAN KIMATHI UNIVERSITY OF TECHNOLOGY SCHOOL OF ENGINEERING DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING NAMES: NYAGWA GEORGE OTULA E020-0446/2008 AMENYA SAMWEL OTWORI E020-0397/2008 OMONDI JAMES OGINGO E020-0348/2007 COURSE: BSC TELECOMMUNICATIONS AND INFORMATION ENGINEERING PROJECT TITLE: PIR AND GSM BASED BUGLAR SECURITY SYSTEM SUPERVISOR: MR EVANS MAGEMBE AUGUST 2013 This project is submitted to the department of Electrical and Electronic Engineering in partial fulfilment for the award of Bachelor of Science degree in Telecommunication and Information Engineering.

PIR Based Security System-libre

Embed Size (px)

Citation preview

  • DEDAN KIMATHI UNIVERSITY OF TECHNOLOGY

    SCHOOL OF ENGINEERING

    DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING

    NAMES:

    NYAGWA GEORGE OTULA E020-0446/2008

    AMENYA SAMWEL OTWORI E020-0397/2008

    OMONDI JAMES OGINGO E020-0348/2007

    COURSE: BSC TELECOMMUNICATIONS AND INFORMATION ENGINEERING

    PROJECT TITLE: PIR AND GSM BASED BUGLAR SECURITY SYSTEM

    SUPERVISOR: MR EVANS MAGEMBE

    AUGUST 2013

    This project is submitted to the department of Electrical and Electronic Engineering in partial fulfilment for the award of Bachelor of Science degree in Telecommunication and Information Engineering.

  • i

    DECLARATION

    This project is our original work, except where due acknowledgement is made in the text, and to the best of our knowledge has not been previously submitted to Dedan Kimathi University of Technology or any other institution for the award of a degree or diploma.

    NAMES: REG.No. SIGNATURE

    NYAGWA GEORGE OTULA E020-0446/2008 .......................................

    AMENYA SAMWEL OTWORI E020-0397/2008 .......................................

    OMONDI JAMES OGINGO E020-0348/2008 .......................................

  • ii

    SUPERVISOR CONFIRMATION

    This is to certify that the above named students have completed their final year project as per partial fulfillment of the degree in BSc Telecommunication and Information Engineering, and that the project has been submitted with my authority as the university project supervisor.

    Name: Mr. Evans Magembe

    Signature

    Signature.. Date

    Project supervisor

    Department of Electrical and Electronics Engineering

  • iii

    DEDICATION

    To our colleague students, our families, lecturers and friends for the support they gave us to pursue

    our dream career in Telecommunications and Information engineering. Their encouragement,

    prayers, motivation and financial support have made us complete this project.

  • iv

    ACKNOWLEDGEMENT

    We are greatly indebted to Mr. Evans Magembe for all his guidance and assistance in accomplishment of this project. His kind encouragement, motivation and guidance during the implementation of this project are highly appreciated. We are particularly thankful to Mr. Asaph and Mr. Mathenge who assisted us in accessing some of the required fabrication equipment in within the University laboratories and developing the software.

    Our sincere thanks go to our parents for their encouragement, understanding and patience during the project implementation period.

    Thank you all and God bless.

  • v

    ABSTRACT

    A PIR and GSM based burglar security system is a system designed to reduce the high rates of insecurity in most personal and business premises. It uses the principle of infrared radiation generated by a human body then sends a signal to the microcontroller system. The interface between the sensing element and the microcontroller is an amplifier and a comparator, which will boost the signal level, which is sent to the microcontroller. The microcontroller processes the received signal, then triggers the alarm, camera and alerts the homeowner through an SMS. The overall project consists of three major parts; the input part that consists of sensors, the software part that operates the entire hardware structure, and the output part, which consists of camera, alarm system, LCD display and secure digital (SD) card. Once triggered, the camera will capture and record the image of the intruder. Compared to the existing security systems, which are inefficient, and expensive to use PIR and GSM is user friendly and affordable. Its design is cost effective and simple.

  • vi

    Table of Contents Pages

    1. INTRODUCTION.... 1 1.1 Background... 1 1.2 Budget 1 1.3 Time Schedule 1 1.4 Problem Statement. 1 1.5 Problem Justification..... 2 1.6 Objectives...2

    2. LITERATURE REVIEW..... 3

    2.1 Sensors........ 3

    2.2 Passive Infrared Radiation and Measurement........................................ 4

    2.3 Arduino Microcontroller......... 6

    2.4 The GSM Module... 7

    2.5 IP Camera.. 16

    2.6 Alarm....... 20

    2.7 Liquid Crystal Display (LCD)...... 21

    3. EXISTING TECHNOLOGY...... 23

    3.1 GSM safety security alarm system... 23

    3.2 CCTV Cameras. 23

    3.3 Radio-Frequency Identification (RFID)................................................23

  • vii

    4. INTENDED APPROACH..25

    5. METHODOLOGY..26

    5.1 Introduction..26

    5.2 Flow chart for Arduino Programming..27

    6. RESULTS AND DISCUSSION..29

    6.1 PIR Motion Detector.29

    6.2 LCD Display..30

    6.3 GSM System.........30

    6.4 Alarm System....31

    6.5 Software Development.......31

    6.6 IP Camera Configurations.....31

    7. CONCLUSION AND SCOPE OF FUTURE WORK....... 33

    7.1 Conclusion.....33

    7.2 Problems Encountered..33

    7.3 Recommendations and Scope of Future work..33

  • viii

    LIST OF FIGURES

    Fig.1 PIR sensor...4

    Fig.2 GSM block diagram..............................................................................................................10

    Fig.3 Mobile Switching Center..................................................................................................... 11

    Fig.4 Stand-alone DedicatedControl Channels (SDCCH)............................................................ 15

    Fig.5 RFID Access Control and Security System with Voice Acknowledgement... 24

    Fig.6 Block Diagram of the Entire Security System..................................................................... 27

    Fig.7 Flow Chart Explaining the Operation of the Security..28

    Fig.8 Set up of the Project..29

    Fig.9 LCD Display.....30

    Fig.10 GSM Display..31

    Fig.11 IP Camera and Router Setup......32

  • ix

    LIST OF TABLES

    Basic Specification in GSM.... 9

    Budget estimate.. 35

    Time Schedule.... 36

  • x

    LIST OF ABBREVIATIONS

    GSM Global System for Mobile Communications.

    SMS Short Message Service

    MMS Multimedia messaging service.

    H.S.S Home Security System

    P.I.R Passive infra-red sensor

    R.F.I.D Radio-frequency identification

    IR Infrared

    LED Light emitting diode

    SD Secure Digital

    CCTV Closed Circuit Television

    MSC Mobile Switching Center

    PSTN Public Switch Telephone Network

    PCM Pulse Code Modulation

    EFR Enhanced Full Rate

    PFCA Planar Fourier Capture Array

    TDMA Time Division Multiple Access

    SIM Subscriber Identity Module

    BTS Base Transceiver Station

  • 1

    1. INTRODUCTION

    1.1 Background

    Security to modern human life and property is of great importance, especially in our surrounding. There are cases that have has been reported in the recent past where property of high value has been stolen by unknown people without the awareness of anyone. An example is the recent raid of Krep bank in Nyeri where millions of unknown amount of money was stolen by unknown people. It is with this reason therefore that we have designed a system called Passive infrared (PIR) and GSM Based Security system. The system will monitor the accessibility to any point of concern and possibly alert the owner about the availability of the intruder at the point where the system will be installed. For example, we can install the system in main entry points of a building. Whenever the target appears in the coverage area of the sensor it emits infrared energy, which is visible to the PIR sensor but invisible to a naked human eye.

    1.2 Budget

    We used the following components in this project; Arduino board, motion sensors, IP Camera, GSM Module, bazar, LCD displays, resistors and LEDs. See appendix 1.

    1.3 Time Schedule

    The entire project took seven months; four months for proposal research and presentation and the last three months for implementation, final documentation and the final presentation. See appendix 2.

    1.4 Problem Statement

    The security of our homes and property is a major concern to everyone in the society. Therefore, there is a need to come up with a security system that provides maximum protection to our homes and premises even with our absences.

  • 2

    1.5 PROBLEM JUSTIFICATION

    There are various approaches, which have been implemented to provide security to homes and premises. Some of these approaches include employment of security officers and installation of CCTV cameras. However, these approaches have proved to be ineffective and expensive. In an event of theft or burglary, there is a need to raise an alarm and alert the relevant persons instantly so that they can take the necessary security actions. The process needs to be cheap and very effective so that an ordinary person can afford. In our project the entire burglary process is recorded by the camera and stored in the SD card for future reference.

    1.6 OBJECTIVES

    1.6.1 Main Objective

    To design, construct and test a PIR and GSM Based burglar security system.

    1.6.2 Specific Objectives:

    To design a system that can alert owner through SMS about access to specific points of a building. To program the arduino software to receive signal from PIR motion sensor and trigger the

    alarm.

    . To design a system that can be accessed remotely through the use of an IP camera.

  • 3

    2. LITERATURE REVIEW

    2.1 SENSORS

    A sensor is a device that measures a physical quantity and converts it into a signal, which can be read by an observer or by an instrument. For accuracy, all sensors need to be calibrated against known standards. The sensitivity of a sensor indicates how much the sensor's output changes when the measured quantity changes. Sensors that measure very small changes must have very high sensitivities [2].

    2.1.1 Types of Sensors

    i. Continuous Wave Radar Motion Detector (CW)

    They use microwave signals to emit frequencies to bounce off the surrounding area. The sensor is able to detect when there are subtle changes in these frequencies since it creates a signal disruption. When an intruder passes through the range of the CW microwave sensor, it disrupts the frequency, which sets off the alarm connected to the sensor. They are usually more expensive and very reliable over longer distances than other types of sensors [9].

    ii. Ultrasonic motion detector

    This type of sensor is able to use sound energy in order to detect movements in specific regions. The ultrasonic sound energy is emitted in waves, which come from quartz crystal transducers. When the sensor detects movement, the sound waves are disrupted which triggers the sensor. They are commonly used in automatic doors. It has one main disadvantage in that it can be blocked by any material hence can be easily disrupted [9].

    iii. Vibration motion detectors.

    These detect simple vibration through the use of piezoelectric effect i.e. the ability of a material to generate an electric field. It detects motion by use of lever that activates a switch when a motion is detected [2].

    iv. Active Infrared motion detectors (IR)

  • 4

    It uses an IR sensor as a source of radiation. The sensor is able to detect interruptions in the radiation it receives from the radiation source. If it senses any blockage of the signal between the transmitter and the receiver, then it triggers an alarm connected at its output [9].

    2.2 PASSIVE INFRARED RADIATION AND MEASUREMENT

    Passive infrared sensors work by measuring incoming infrared energy. They do not emit energy themselves, which is why they are called "passive." Infrared energy is released when heat is created [2]. Humans and animals both release infrared energy. Passive infrared sensors (sometimes called pyro electric detectors) detect this energy and measure it against previous, or standard, levels. In this manner, they can monitor changes in the environment. On average, humans emit 9 to 10 micrometers of infrared energy [1].

    Passive infrared sensors are used in the motion detectors that are commonly used for security reasons by businesses and residential homeowners [2].

    Fig 1

  • 5

    2.2.1 Photo Detectors

    Passive infrared sensors are made to detect infrared energy emissions of 8 to 12 micrometers. The tool they use to detect these energy levels is called a photo detector. A photo detector takes incoming light and measures its wavelengths, or levels of infrared energy. A mirror within the sensor (Fresnel lens) is what is used to capture the energy, which is then projected onto a computer chip (Microcontroller). As the subject emitting the energy moves, the hot spot on the chip moves also, which allows the microcontroller to monitor and measure the variations and speeds of the infrared energy being emitted [1].

    The level amounts are then converted into an electrical current, which is sent through a minuscule computer contained in the sensor. The computer determines if these levels are standard levels for the supervised area or if they vary widely from normal levels [2].

    If there are large variations in the levels, the computer may trigger an alarm, which is how many

    home security systems work. In fact, normal human movement can release enough variation in a

    supervised area to trigger such an alarm in most cases. Most passive infrared sensors will ignore any smaller emissions or slower variations in the emissions as those are usually caused by the movement of animals or by the slow rise of heat in the environment during the day [2].

    2.2.2 Motion Detectors

    It is common for passive infrared sensing systems to be combined with a photo-sensor detector. These motion detectors are often located near the entrance to many businesses. They consist of a light sensor in the form of a laser beam. When the beam of light is blocked, such as when a person walks through it, the infrared sensor will notice a drop in the light emission and alert a nearby control box. The control box will then react accordingly [1]. This reaction can be something as simple as emitting a soft tone to alert shopkeepers that someone has entered the store. The reaction might trigger an alarm, as in cases where the light beam is used to monitor and protect an area such as in a museum [2].

  • 6

    2.3 ARDUINO MICROCONTROLLER

    Arduino is a single-board microcontroller designed to make the process of using electronics in multidisciplinary projects more accessible. The hardware consists of a simple open source hardware board designed around an 8-bit Atmel AVR microcontroller, though a new model has been designed around a 32-bit Atmel ARM. The software consists of a standard programming

    language compiler and a boot loader that executes on the microcontroller [10].

    An Arduino board consists of an Atmel 8-bit AVR microcontroller with complementary components to facilitate programming and incorporation into other circuits. An important aspect of the Arduino is the standard way that connectors are exposed, allowing the CPU board to be connected to a variety of interchangeable add-on modules known as shields. Some shields communicate with the Arduino board directly over various pins, but many shields are individually addressable via an IC serial bus, allowing many shields to be stacked and used in parallel [10]. Official Arduino BOARDS have used the mega-AVR series of chips, specifically the ATmega8, ATmega168, ATmega328, ATmega1280, and ATmega2560. Most boards include a 5-volt linear regulator and a 16 MHz crystal oscillator (or ceramic resonator in some variants). An Arduino microcontroller is also pre-programmed with a boot loader that simplifies uploading of programs to the on-chip flash memory, compared with other devices that typically need an external programmer [11].

    The Arduino board exposes most of the microcontroller's I/O pins for use by other circuits. The Diecimila, Duemilanove, and current Uno provide 14 digital I/O pins, six of which can produce pulse-width modulated signals, and six analog inputs. These pins are on the top of the board, via female 0.1-inch headers [11].

    The Arduino integrated development environment (IDE) is a cross-platform application written in Java, and is derived from the IDE for the Processing programming language and the Wiring projects. It is designed to introduce programming to artists and other newcomers unfamiliar with software development. It includes a code editor with features such as syntax highlighting, brace matching, and automatic indentation, and is capable of compiling and uploading programs to the

  • 7

    board with a single click. There is typically no need to edit make files or run programs on a command-line interface. A program or code written for Arduino is called a sketch [11].

    Arduino programs are written in C or C++. The Arduino IDE comes with a software library called "Wiring" from the original Wiring project, which makes many common input/output operations much easier. Users only need define two functions to make it possible to cyclic executive program [10]:

    setup(): a function run once at the start of a program that can initialize settings loop(): a function called repeatedly until the board powers off

    2.4 THE GSM MODULE

    The GSM module consist of Wireless CPU, SIM cardholder and power LED. It helps to transmit and receive the SMS with Arduino [4].

    GSM has been the backbone of the phenomenal success in mobile telecom over the last decade. Now, at the dawn of the era of true broadband services, GSM continues to evolve to meet new demands. GSM is an open, nonproprietary system that is constantly evolving. One of its great strengths is the international roaming capability. This gives consumers seamless and same standardized same number contactability in more than 212 countries [4]. This has been a vital driver in growth, with around 300 million GSM subscribers currently in Europe and Asia. In the Americas, today's 7 million subscribers are set to grow rapidly, with market potential of 500 million in population, due to the introduction of GSM 800, which allows operators using the 800 MHz band to have access to GSM technology too. GSM satellite roaming has extended service access to areas where terrestrial coverage is not available [3].

    GSM differs from first generation wireless systems in that it uses digital technology and time division multiple access transmission methods. Voice is digitally encoded via a unique encoder, which emulates the characteristics of human speech. This method of transmission permits a very efficient data rate/information content ratio [5].

  • 8

    Cellular mobile communication is based on the concept of frequency reuse. That is, the limited spectrum allocated to the service is partitioned into, for example, N non-overlapping channel sets, which are then assigned in a regular repeated pattern to a hexagonal cell grid [3]. The hexagon is just a convenient idealization that approximates the shape of a circle (the constant signal level contour from an omni directional antenna placed at the center) but forms a grid with no gaps or overlaps. The choice of N is dependent on many tradeoffs involving the local propagation environment, traffic distribution, and costs. The propagation environment determines the interference received from neighboring channel cells, which in turn governs the reuse distance, that is, the distance allowed between co-channel cells (cells using the same set of frequency channels) [4].

    The cell size determination is usually based on the local traffic distribution and demand. The more the concentration of traffic demand in the area, the smaller the cell has to be sized in order to avail the frequency set to a smaller number of roaming subscribers and thus limit the call blockingprobability within the cell [5]. On the other hand, the smaller the cell is sized, the more equipment will be needed in the system as each cell requires the necessary transceiver and switching equipment, known as the base station subsystem (BSS), through which the mobile users access the network over radio links. The degree to which the allocated frequency spectrum is reused over the cellular service area, however, determines the spectrum efficiency in cellular systems. That means the smaller the cell size, and the smaller the number of cells in the reuse geometry, the higher will be the spectrum usage efficiency. Since digital modulation systems can operate with a smaller signal to noise (i.e., signal to interference) ratio for the same service quality, they, in one respect, would allow smaller reuse distance and thus provide higher spectrum efficiency [4]. This is one advantage the digital cellular provides over the older analogue cellular radio communication systems. It is worth mentioning that the digital systems have commonly used sectored cells with 120-degree or smaller directional antennas to further lower the effective reuse distance. This allows a smaller number of cells in the reuse pattern and makes a larger fraction of the total frequency spectrum available within each cell. Currently, research is being done on implementing other enhancements such as the use of dynamic channel assignment strategies for raising the spectrum efficiency in certain cases, such as high uneven

    traffic distribution over cells [5].

  • 9

    Table 1

    S.N. Parameter Specifications

    1 ReverseChannelfrequency 890-915MHz

    2 ForwardChannelfrequency 935-960 MHz

    3 TX/Rx Frequency Spacing 45 MHz

    4 TX/Rx Time Slot Spacing 3 Time slots

    5 Modulation Data Rate 270.833333kbps

    6 Frame Period 4.615ms

    7 Users per Frame 8

    8 Time Slot Period 576.9microsec

    9 Bit Period 3.692 microsecond

    10 Modulation 3.692 microsecond

    11 ARFCN Number 0 to 124 & 975 to 1023

    12 ARFCN Channel Spacing 200 kHz

    13 Interleaving 40 ms

    14 Voice Coder Bit Rate 13.4kbps

  • 10

    Fig 2

    2.4.1 GSM NETWORK

    A GSM network is composed of several functional entities, whose functions and interfaces are specified. The GSM network can be divided into three broad parts.The Mobile Station is carried by the subscriber. The Base Station Subsystem controls the radio link with the Mobile Station. The Network Subsystem, the main part of which is the Mobile services Switching Center (MSC), performs the switching of calls between the mobile users, and between mobile and fixed network users [3].

    The MSC also handles the mobility management operations. Not shown is the Operations and Maintenance Center, which oversees the proper operation and setup of the network. The Mobile Station and the Base Station Subsystem communicate across the Um interface, also known as the air interface or radio link. The Base Station Subsystem communicates with the Mobile services Switching Center across the A interface [5].

  • 11

    Fig 3

    2.4.2 Mobile Station

    Mobile Equipment (ME) such as hand portable and vehicle mounted unit. Subscriber Identity Module (SIM), which contains the entire customer related information (identification, secret key for authentication, etc.). The SIM is a small smart card, which contains both programming and information. The A3 and A8 algorithms are implemented in the Subscriber Identity Module (SIM). Subscriber information, such as the IMSI (International Mobile Subscriber Identity), is stored in the Subscriber Identity Module (SIM). The Subscriber Identity Module (SIM) can be used to store user-defined information such as phonebook entries. One of the advantages of the GSM architecture is that the SIM may be moved from one Mobile Station to another. This makes upgrades very simple for the GSM telephone user. The use of SIM card is mandatory in the GSM world, whereas the SIM (RUIM) is not very popular in the CDMA world [3].

    2.4.3 Base Station Subsystem (BSS):

    All radio-related functions are performed in the BSS, which consists of base Station controllers (BSCs) and the base transceiver stations (BTSs) [3].

  • 12

    2.4.4 Base Transceiver Station (BTS):

    The Base Transceiver Station (BTS) contains the equipment for transmitting and receiving of radio signals (transceivers), antennas, and equipment for encrypting and decrypting communications with the Base Station Controller (BSC). A group of BTSs are controlled by a BSC. Typically a BTS for anything other than a picocell will have several transceivers (TRXs), which allow it to serve several different frequencies and different sectors of the cell (in the case of sectorised base stations). A BTS is controlled by a parent BSC via the Base Station Control Function (BCF). The BCF is implemented as a discrete unit or even incorporated in a TRX in compact base stations. The BCF provides an Operations and Maintenance (O&M) connection to the Network Management System (NMS), and manages operational states of each TRX, as well as software handling and alarm collection [4].

    2.4.5 Base Station Controller (BSC):

    The BSC controls multiple BTSs and manages radio channel setup, and handovers. The BSC is the connection between the Mobile Station and MobileSwitching Center. The Base Station Controller (BSC) provides, classicaly, the intelligence behind the BTSs. Typically a BSC has 10s or even 100s of BTSs under its control [4]. The BSC handles allocation of radio channels, receives measurements from the mobile phones, controls handovers from BTS to BTS. A key function of the BSC is to act as a concentrator where many different low capacity connections to BTSs become reduced to a smaller number of connections towards the Mobile Switching Center (MSC) (with a high level of utilisation). Overall, this means that networks are often structured to have many BSCs distributed into regions near their BTSs which are then connected to large centralised MSC sites [3].

    The BSC is undoubtedly the most robust element in the BSS as it is not only a BTS controller but, for some vendors, a full switching center, as well as an SS7 node with connections to the MSC and SGSN. It also provides all the required data to the Operation Support Subsystem (OSS) as well as to the performance measuring centers. A BSC is often based on a distributed computing architecture, with redundancy applied to critical functional units to ensure availability in the event of fault conditions. Redundancy often extends beyond the BSC equipment itself and

  • 13

    is commonly used in the power supplies and in the transmission equipment providing the A-ter interface to PCU [4]. The databases for all the sites, including information such as carrier frequencies,frequency hopping lists, power reduction levels, receiving levels for cell border calculation, are stored in the BSC [5].

    2.4.6 Network Switching Subsystem (NSS):

    Network Switching Subsystem is the component of a GSM system that carries out switching functions and manages the communications between mobile phones and the Public Switched Telephone Network. It is owned and deployed by mobile phone operators and allows mobile phones to communicate with each other and telephones in the wider telecommunications network. The architecture closely resembles a telephone exchange, but there are additional functions which are needed because the phones are not fixed in one location. There is also an overlay architecture on the GSM core network to provide packet-switched data services and is known as the GPRS core network. This allows mobile phones to have access to services such as WAP, MMS, and Internet access. All mobile phones manufactured today have both circuit and packet based services, so most operators have a GPRS network in addition to the standard GSM core network [3].

    2.4.7 Mobile Switching Centre (MSC):

    The Mobile Switching Centre or MSC is a sophisticated telephone exchange, which provides circuit-switched calling, mobility management, and GSM services to the mobile phones roaming within the area that it serves. This means voice, data and fax services, as well as SMS and call divert. In the GSM mobile phone system, in contrast with earlier analogue services, fax and data information is sent directly digitally encoded to the MSC. Only at the MSC is this re-coded into an "analogue" signal. There are various different names for MSCs in different context, which reflects their complex role in the network, allof these terms though could refer to the same MSC, but doing different things at different times [5].

    A Gateway MSC is the MSC that determines which visited MSC the subscriber who is being called is currently located. It also interfaces with the Public Switched Telephone Network. All mobile to mobile calls and PSTN to mobile calls are routed through a GMSC. The term is only

  • 14

    valid in the context of one call since any MSC may provide both the gateway function and the Visited MSC function, however, some manufacturers design dedicated high capacity MSCs which do not have any BSCs connected to them. These MSCs will then be the Gateway MSC for many of the calls they handle [3].

    The Visited MSC is the MSC where a customer is currently located. The VLR associated with this MSC will have the subscriber's data in it. The Anchor MSC is the MSC from which a handover has been initiated. The Target MSC is the MSC toward which a Handover should take place. An MSC Server is a part of the redesigned MSC concept starting from 3GPP Release 5 [4].

    2.4.8 Frequency Band Usage

    Since radio spectrum is a limited resource shared by all users, a method must be devised to divide up the bandwidth among as many users as possible. The method chosen by GSM is a combination of Time- and Frequency-Division Multiple Access (TDMA/FDMA). The FDMA part involves the division by frequency of the (maximum) 25 MHz bandwidth into 124 carrier frequencies spaced 200 kHz apart. One or more carrier frequencies are assigned to each base station. Each of these carrier frequencies is then divided in time, using a TDMA scheme. The fundamental unit of time in this TDMA scheme is called a burst period and it lasts 15/26 ms (or approx. 0.577 ms) [4]. Eight burst periods are grouped into a TDMA frame (120/26 ms, or approx. 4.615 ms), which forms thebasic unit for the definition of logical channels. One physical channel is one burst period per TDMA frame. Channels are defined by the number and position of their corresponding burst periods. All these definitions are cyclic, and the entire pattern repeats approximately every 3 hours. Channels can be divided into dedicated channels, which are allocated to a mobile station, and common channels, which are used by mobile stations in idle mode [4]. A traffic channel (TCH) is used to carry speech and data traffic. Traffic channels are defined using a 26-frame multiframe, or group of 26 TDMA frames. The length of a 26-frame multiframe is 120 ms, which is how the length of a burst period is defined (120 ms divided by 26 frames divided by 8 burst periods per frame). Out of the 26 frames, 24 are used for traffic, 1 is used for the Slow Associated Control Channel (SACCH) and 1 is currently unused. TCHs for the uplink and downlink are separated in time by 3 burst periods, so that the mobile station does not

  • 15

    have to transmit and receive simultaneously, thus simplifying the electronics. In addition to these full-rate TCHs, there are also half-rate TCHs defined, although they are not yet implemented. Half-rate TCHs will effectively double the capacity of a system once half-rate speech coders are specified (i.e., speech coding at around 7 kbps, instead of 13 kbps). Eighth-rate TCHs are also specified, and are used for signalling. In the recommendations, they are called Stand-alone DedicatedControl Channels (SDCCH) [5].

    Fig 4

    Organization of bursts, TDMA frames, and multiframes for speech and data GSM is a digital system, so speech which is inherently analog, has to be digitized. The method employed by ISDN, and by current telephone systems formultiplexing voice lines over high speed trunks and optical fiber lines, is Pulse Coded Modulation (PCM). The output stream from PCM is 64 kbps, too high a rate to be feasible over a radio link. The 64 kbps signal, although simple to implement, contains much redundancy [4]. The GSM group studied several speech coding algorithms on the basis of subjective speech quality and complexity (which is related to cost, processing delay, and power consumption once implemented) before arriving at the choice of a Regular Pulse Excited Linear Predictive Coder (RPE--LPC) with a Long Term Predictor loop. Basically, information from previous samples, which does not change very quickly, is used to predict the current sample. The coefficients of the linear combination of the previous samples, plus an encoded form of the residual, the difference between the predicted and actual sample, represent the signal. Speech is divided into 20 millisecond samples, each of which is encoded as 260 bits, giving a

  • 16

    total bit rate of 13 kbps. This is the so-called Full-Rate speech coding. Recently, an Enhanced Full-Rate (EFR) speech-coding algorithm has been implemented bysome North American GSM1900 operators. This is said to provide improved speech quality using the existing 13 kbps bit rate [5].

    2.4.9 Advantages of GSM

    1. Performance - Fast with high real throughput

    2. Integrity - Secure controlled data transfer 3. Network Access - Quick and consistent 4. Contention Control - Avoid conflicts and collisions 5. Installation - Simple quick installation 6. Frequency Choice - Choice of RF bands to suit different terrains 7. Network Diagnostics - For ease of maintenance and cost saving

    2.5 IP CAMERA

    A camera is a device that records images that can be stored directly, transmitted to another location, or both. These images may be still photographs or moving images such as videos or movies. The term camera comes from the word camera obscura (Latin for dark chamber), an early mechanism for projecting images [7].

    2.5.1 Contents

    Cameras may work with the light of the visible spectrum or with other portions of the electromagnetic spectrum. A camera generally consists of an enclosed hollow with an opening (aperture) at one end for light to enter, and a recording or viewing surface for capturing the light at the other end [6]. A majority of cameras have a lens positioned in front of the camera's opening to gather the incoming light and focus all or part of the image on the recording surface. The diameter of the aperture is often controlled by a diaphragm mechanism, but some cameras have a fixed-size aperture. Most cameras use an electronic image sensor to store photographs on

  • 17

    flash memory. Other cameras, particularly the majority of cameras from the 20th century, use photographic film [7].

    A typical still camera takes one photo each time the user presses the shutter button (except in continuous-fire mode). A typical movie camera continuously takes 24 film frames per second as long as the user holds down the shutter button, or until the shutter button is pressed a second time [7].

    2.5.2 Lens

    The lens of a camera captures the light from the subject and brings it to a focus on the film or detector. The design and manufacture of the lens is critical to the quality of the photograph being taken. The technological revolution in camera design in the 19th century revolutionized optical glass manufacture and lens design with great benefits for modern lens manufacture in a wide range of optical instruments from reading glasses to microscopes. Pioneers included Zeiss and Leitz [6].

    Camera lenses are made in a wide range of focal lengths. They range from extreme wide angle, wide angle, standard, medium telephoto and telephoto. Each lens is best suited a certain type of photography. The extreme wide angle may be preferred for architecture because it has the capacity to capture a wide view of a building. The normal lens, because it often has a wide aperture, is often used for street and documentary photography. The telephoto lens is useful for sports and wildlife but it is more susceptible to camera shake [6].

    2.5.3 Focus

    Due to the optical properties of photographic lenses, only objects within a limited range of distances from the camera will be reproduced clearly. The process of adjusting this range is known as changing the camera's focus. There are various ways of focusing a camera accurately.

    The simplest cameras have fixed focus and use a small aperture and wide-angle lens to ensure that everything within a certain range of distance from the lens, usually around 3 meters (10 ft) to infinity, is in reasonable focus. Fixed focus cameras are usually inexpensive types, such as single-use cameras. The camera can also have a limited focusing range or scale-focus that is

  • 18

    indicated on the camera body. The user will guess or calculate the distance to the subject and adjust the focus accordingly. On some cameras, this is indicated by symbols (head-and-shoulders; two people standing upright; one tree; mountains) [7].

    Rangefinder cameras allow the distance to objects to be measured by means of a coupled parallax unit on top of the camera, allowing the focus to be set with accuracy. Single-lens reflex cameras allow the photographer to determine the focus and composition visually using the objective lens and a moving mirror to project the image onto a ground glass or plastic micro-prism screen. Twin-lens reflex cameras use an objective lens and a focusing lens unit (usually identical to the objective lens.) in a parallel body for composition and focusing. View cameras use a ground glass screen, which is removed and replaced by either a photographic plate or a reusable holder containing sheet film before exposure. Modern cameras often offer autofocus systems to focus the camera automatically by a variety of methods [6].

    Some experimental cameras, for example the planar Fourier capture array (PFCA), do not require focusing to allow them to take pictures. In conventional digital photography, lenses or mirrors map all of the light originating from a single point of an in-focus object to a single point at the sensor plane. Each pixel thus relates an independent piece of information about the far-away scene. In contrast, a PFCA does not have a lens or mirror, but each pixel has an idiosyncratic pair of diffraction gratings above it, allowing each pixel to likewise relate an independent piece of information (specifically, one component of the 2D Fourier transform) about the far-away scene. Together, complete scene information is captured and images can be reconstructed by computation [7].

    Some cameras have post focusing. Post focusing means take the pictures first and then focusing later at the personal computer. The camera uses many tiny lenses on the sensor to capture light

    from every camera angle of a scene and is called plenoptics technology. A current plenoptics camera design has 40,000 lenses working together to grab the optimal picture [6].

  • 19

    2.5.4 Exposure control

    The size of the aperture and the brightness of the scene control the amount of light that enters the camera during a period of time, and the shutter controls the length of time that the light hits the recording surface. Equivalent exposures can be made with a larger aperture and a faster shutter speed or a corresponding smaller aperture and with the shutter speed slowed down [6].

    2.5.5 Shutters

    Although a range of different shutter devices has been used during the development of the camera, only two types have been widely used and remain in use today [7].

    The Leaf shutter or more precisely the in-lens shutter is a shutter contained within the lens structure, often close to the diaphragm consisting of a number of metal leaves which are maintained under spring tension and which are opened and then closed when the shutter is released. The exposure time is determined by the interval between opening and closing. In this shutter design, the whole film frame is exposed at one time. This makes flash synchronization much simpler as the flash only needs to fire once the shutter is fully open. Disadvantages of such shutters are their inability to reliably produce very fast shutter speeds (faster than 1/500th second or so) and the additional cost and weight of having to include a shutter mechanism for every lens [7].

    The focal-plane shutter operates as close to the film plane as possible and consists of cloth curtains that are pulled across the film plane with a carefully determined gap between the two curtains (typically running horizontally) or consisting of a series of metal plates (typically moving vertically) just in front of the film plane. The focal-plane shutter is primarily associated with the single lens reflex type of cameras, since covering the film rather than blocking light passing through the lens allows the photographer to view through the lens at all times except

    during the exposure itself. Covering the film also facilitates removing the lens from a loaded camera (many SLRs have interchangeable lenses) [6].

  • 20

    2.6 ALARM

    An alarm device or system of alarm devices gives an audible, visual or other form of alarm signal about a problem or condition. A burglar alarm is a system designed to detect intrusion unauthorized entry into a building or area. Burglar alarms are designed to warn off burglaries; this is often a silent alarm: the police or guards are warned without indication to the burglar, which increases the chances of catching him or her. Burglar alarms are used in residential, commercial, industrial, and military properties for protection against burglary (theft) or property damage, as well as personal protection against intruders [9].

    Some alarm systems serve a single purpose of burglary protection; combination systems provide both fire and intrusion protection. Intrusion alarm systems may also be combined with closed-circuit television surveillance systems to automatically record the activities of intruders or capture their images [8].

    Alarms have the capability of causing a fight-or-flight response in humans; a person under this mindset will panic and flees either the perceived danger or attempt to eliminate it, often ignoring rational thought in either case. We can characterize a person in such a state as "alarmed" [8].

    2.6.1 Design and Work of Alarm

    The simplest type of burglar alarm control consists of a single relay. In this type, the sensor circuit (called the loop in industrial terminology) holds the relay energized. Since the path for the loop goes through a set of contacts which are normally open (when the relay is restored they are open, when the relay is energized they are closed), when the loop opens, even momentarily, the relay will drop out and stay that way. A second set of contacts on the relay, normally closed (when the relay is restored they are closed, when the relay is energized they are open) is used to operate the enunciator, usually a bell. The system is disarmed by a key-operated shunt which forces the relay to energize, and is armed by closing all traps and then by opening the shunt. While burglar alarm controls are now very elaborate, the single-relay control incorporates all the functionality of any control. These controls and a closely related dual-relay design are still

    widely used in stand-alone applications, powered by lead-acid batteries [9].

  • 21

    Modern alarm controls are solid-state devices, and do not use the relays that the older alarm panels used to go into alarm. They make use of relays to modulate the alarm notification device as needed. In addition, they use a relay to seize the telephone line to communicate to the monitoring station [9]. Most switching devices are N.C. (normally closed) circuits, so when the device is not in an alarm condition, the circuit is closed. Most alarm circuits (zones) are also set up to open or close on reading a certain resistance, usually between 1K and 5K ohms when inactive and double the value when active. This wiring system is called dual loop and allows for both alarm and anti-tamper detections to be incorporated into one circuit (anti-tamper occurs when the resistance level moves outside normal open/close values). This is the standard circuit in most modern systems [8].

    High-security alarm controls use current and impedance monitoring on the premises, and may report to the central station via dedicated voice-grade or DC (obsolescent) circuit, or by means of multiple-drop AC grade transmitter (multiplex). Early solid-state alarm controls used shunt switches or momentary closures on the key circuit to arm or disarm the control [8]. Modern controls can use these arming techniques, but more frequently use a keypad, which sends operating information to the control. Thus, there is no point in attacking the keypad, as there is no intelligence in the keypad; it is all located in the control. In addition, many controls feature integrated transmitters, using wired telephony or optionally, cellular telephony. These controls also monitor the status of the telephone line, and can be programmed to trip if the telephone line fails (or is cut). The controls, which utilize cellular telephony report either periodically or at a pseudo-random interval to the central station and a failure to report, will result in a dispatch [9].

    2.7 LIQUID CRYSTAL DISPLAY (LCD)

    A liquid crystal display is a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. It is prized by engineers because it uses very small amounts of electric power and is therefore suitable for use in battery powered electronic devices [12].

    Each pixel of an LCD consists of a layer of perpendicular molecules aligned between two transparent electrodes and two polarizing filters, the axes of polarity of which are perpendicular

  • 22

    to each other with no liquid crystal between the polarizing crystals The surfaces of the electrodes that are in contact with the liquid crystal material are treated so as to align the liquid crystal molecules in a particular direction this treatment typically consists of a thin polymer layer that is unidirectionally rubbed using a cloth. Before applying the electric field, the orientation of the liquid crystal molecules is determined by the alignment at the surfaces. In a twisted pneumatic device ,the surface alignment directions at the two electrodes are perpendicular and so the molecules arrange themselves in a helical structure or twist. Because the liquid crystal material is birefringent, light passing through the liquid crystal, allowing it to pass through the second polarized filter [12].

    When a voltage is applied across the electrodes, torque acts to align the liquid crystal molecules parallel to the electric fields, distorting the helical structures. This reduces the rotation of the polarization of the incident light, and the device appears grey. If the applied voltage is the polarization of the incident light is not rotated and it passes through the crystal layer [13].

    With a twisted pneumatic liquid crystal device it is usual to operated the device between crossed polarizes, such that it appears bright with no applied voltage. With this setup, the dark voltage-on state is uniform. The device can be operated between parallel polarizes, in which case the bright and dark states are reversed [12].

    Both the liquid crystal material and alignment layer material contain ionic components. If an electric field of one particular polarity is applied for a long period of time, this ionic material is attracted to the surfaces and degrades the device performance. This is avoided by applying either an alternating current, or reversed by the polarity of the electric field as the device is addressed [12].

  • 23

    3. EXISTING TECHNOLOGIES

    3.1 GSM safety security alarm system

    This is a good quality GSM wireless alarm systems, which can send SMS for home and office security. This system with LCD display allows user to operate and setup the system with ease. The alarm control panel is equipped with back up. Owner can work with different intrusion and fire, gas leak sensors such as wireless key-fob, door magnetic contact sensor, passive infrared motion sensor, smoke detector, heat sensor, emergency button, active infrared beam sensor, wireless and hard wired strobe siren...etc. which can be installed as per the owners specific needs [5]. The system come with 30 wireless zones and 8 hard-wired zones, each wireless zone can work up with four wireless sensors and fully programmable. The system can preset up to five emergency numbers for alarm receiving, set the alarm panel on monitoring status when you leave away so that all the sensors are monitoring your places while you are away. The alarm

    system can trigger the alarm automatically if there is an intrusion event or smoke and fire breaks out [4].

    3.2 CCTV Cameras

    Closed-circuit television (CCTV) is the use of video cameras to transmit a signal to a specific place, on a limited set of monitors. It differs from broadcast television in that the signal is not openly transmitted, though it may employ point to point (P2P), point to multipoint, or mesh wireless links. Though almost all video cameras fit this definition, the term is most often applied to those used for surveillance in areas that may need monitoring such as banks, casinos, airports, military installations, and convenience stores [13].

    3.3 Radio-Frequency Identification (RFID) access control system and security with voice acknowledgement.

    In order to organize or control different access systems by person or items, this application provide accurate security. RFID is used to provide security by embedding access control in ID cards. Microcontroller would check whether the tag identification number provided by the RFID reader have the access permission or not. If it has, access permission will be provided to that

  • 24

    particular person, i.e. door control signal enabled. Otherwise, an alert message will be sent to a predetermined mobile number and alarm will be activated. Each persons entry timing and access permissions could be seen on the LCD [1].

    Fig 5

  • 25

    4. INTENDED APPROACH The intention of this project is to develop & launch an up-to-date, reliable and user-friendly security system to automate home security using microcontroller circuitry synchronized with GSM module with an objective to provide maximum possible security based on an automatic emergency care response using sensors and cameras. We intend to make a big contribution in the promotion and reliability of home based security systems. Among the contribution, the part of providing automatic text message notifications regarding any undesired movements is user friendly, live streaming of cameras of users desired secured zones is more trustable than that of previous versions of home security systems. The concept of capturing pictures is new, unique and more reliable than any of the previous automatic security systems ever designed for homes.

  • 26

    5. METHODOLOGY

    5.1 Introduction

    We used several steps in designing a PIR and GSM Based Security System for house security system. The relevant information were gathered through literature review from previous chapter [1]. Data on motion detection, GSM, camera, alarm and the entire security system projects were collected. The understanding on the electrical structure for the hardware development was needed for the design circuit process of the motion detector and the basic security circuit [5].

    The next was the hardware development according to the circuit designed. This process could only proceed if each part of the circuit being improved was valid, else, it had to be repeated until it was valid as the theoretical. Once the hardware development circuits had the output as the expected, then, the comparison for both hardware and theoretical analysis was done.The final step was where software structure was developed for the security system to be interfaced with the hardware development as shown in the block diagram below. The final step of this project involved its application to real house entrance like doors and windows [1].

    The hardware development was divided into three stages as shown in block diagram above. The inputs stage of the security system was the PIR motion detector. The second stage was the controller unit, which was the arduino microcontroller. The purpose of using microcontroller was to control the whole system operation by sending data to the output stage which is the LCD display, GSM, alarm and camera [1]

  • 27

    Fig 6

    5.2 Flow Chart for Arduino Programming

    The flow chart below shows how arduino program executed the intended functions of the entire project. The program gave the output in two ways. One way was where the system was active and no intruder. In this case, none of the output components: alarm and GSM would give an output. The flow chart below explains how the entire project works. When an interrupt was received from the PIR output, GSM module was used to send intrusion text to the pre-stored mobile phone number in the program. The same interrupt was used to trigger the alarm. The IP Camera was used to capture the entire burglary process. The images from the IP camera could be viewed remotely on an android mobile phone by the use of IP address of the camera [11].

    Remote

    Computer Router

    PIR Motion

    Sensor

    Arduino Uno

    Microcontroller

    Alarm

    POWER

    SUPPLY

    GSM

    Module

    Mobile

    Phone

    IP Camera

    PC

  • 28

    Fig 7

  • 29

    6. RESULTS AND DISCUSSION

    Fig 8

    6.1 PIR Motion Detector

    This was the sensing part of our project. When a target moved across the sensing range, it radiated infrared radiations hence allowing the sensor to sense its availability. The signal from this block was connected to the arduino microcontroller [1].

  • 30

    6.2 LCD Display

    This was used to display the functioning mode of the microcontroller.

    Fig 9

    6.3 GSM System

    We were able to use GSM module and cell phones interfaced with Arduino to establish simple data exchange via SMS. The GSM module was connected with the Arduino controller. When the PIR sensor sent a signal to the microcontroller, the microcontroller would send the command AT to initiate the module. Now the module will send an sms as Theft Occurring to the already fed mobile number. Thus the information will be passed from the module to the Authorized person [4].

  • 31

    Fig 10

    6.4 Alarm System

    This was the load of the system where the output of the microcontroller was fed as input to the alarm. In this project, we used a buzzer to generate an ear catching sound. The alarm was ON whenever a motion was sensed by the detector [9].

    6.5 Software Development

    We were able to develop software for the arduino that could do the following;

    Receive an input signal from the PIR sensor Send an SMS to a specific mobile number via a GSM module Trigger the alarm Display an output on an LCD display 6.6 IP Camera Configurations

    We were able to configure the IP camera and the router with the following configurations:

    192.168.1.5 which is the camera IP for the LAN in port number 9090 192.168.117.39 which is the camera IP for the WAN in port number 9090

  • 32

    192.168.1.1 Which was the router default gateway. The camera could be accessed remotely through different regions within the university using different computers and live streaming was achieved.

    Fig 11

  • 33

    7. CONCLUSION AND SCOPE OF FUTURE WORK

    7.1 Conclusion

    From our objectives listed in chapter one of this project proposal, it is clear that the main task of this project was to design and implement a PIR and GSM Based Burglar Security System for detecting intrusion in our homes or premises, alerting the owner through SMS, and accessing all the activities via the internet. The project was carried out successfully. The set objectives were met which include:

    Intrusion was sensed by the motion sensor The system was able to send a sms to alert the owner. The owner was able to access the premise remotely to know what is taking place. 7.2 Problems Encountered

    Configuring web Cam proved to be quite a task due to limited working knowledge of the same and the high cost of preferred camera in the proposal.

    Due to limited finance, the design had to keep changing the implementation technique to meet budget constraints.

    7.3 Recommendations and Scope of Future Work

    After the completion of this project and the challenges faced, it was recommended that: 1. All the proposed components are availed to students on time to give them enough time to

    work on all the objectives of the project. 2. Smoke sensor is integrated in future to alert the homeowner in case of fire breakdown.

  • 34

    REFERENCES

    [1] Appleby, R. (2002). Infrared and passive millimeter-wave imaging systems: design, analysis, modeling, and testing : 3-5 April 2002, Orlando [Fla.] , USA. Bellingham, Wash.: Society of Photo-optical Instrumentation Engineers.

    [2] Wilson, J. S. (2005). Sensor technology handbook. Amsterdam: Elsevier. [3] Nielsen, T., & Wigard, J. (2002). Performance enhancements in a frequency hopping GSM

    network. New York: Kluwer Academic Publishers.

    [4] Heath, S. (1999). Multimedia and communications technology (2nd ed.). Oxford: Focal Press. [5] Yacoub, M. D. (2002). Wireless technology: protocols, standards, and techniques. Boca Raton:

    CRC Press.

    [6] Fullerton, J., & Widding, A. (2000). Moving images: from Edison to the webcam. Sydney, Australia: John Libbey & Co..

    [7] Goetz, A. (2003). Webcam. Paris: le Passage. [8] Brown, D., Harrold, D., & Hope, R. (2004). Control engineering control system power

    and grounding better practice. Amsterdam: Newnes. [9] Petruzzellis, T. (1994). The alarm, sensor & security circuit cookbook. Blue Ridge

    Summit, PA: TAB Books. [10] Barrett, S. F. (2012). Arduino microcontroller processing for everyone! (2nd ed.). San

    Rafael, Calif. (1537 Fourth Street, San Rafael, CA 94901 USA): Morgan & Claypool. [11] Evans, B. (2011). Beginning Arduino programming. New York: Apress. [12] Chen, R. H. (2011). Liquid crystal displays fundamental physics & technology. Hoboken, N.J.:

    Wiley.

    [13] Damjanovski, V. (2005). CCTV networking and digital technology (2nd ed.). Amsterdam: Elsevier/Butterworth Heinemann.

    [14] Peyton Z. Peebles. (1989). Digital Communication Systems. Prentice (1st Ed.). Hall International

  • 35

    APENDICES

    Appendix 1 Budget Breakdown

    COMPONENT QUANTITY EACH COST [KShs] PIR sensor 2 1200 2400 IP Camera 1 9000 9000 Arduino microcontroller 1 3500 3500 Buzzer 1 500 500 LEDs 5 50 250 Capacitors 10 20 200 Resistors 20 10 200 Operation Amplifier 6 100 600 Printing and Binding 3 copies 500 1500 Bread board 1 1000 1000 Micro SD Card 1 500 500 GSM Module 1 5000 5000 LCD Display 1 1000 1000 Solder wire 2M 200 400 Internet services 1 1000 1000 TOTAL 27050

  • 36

    Appendix 2 Working Schedule

    Month

    activity

    JAN 2013

    FEB 2013

    MARCH 2013

    APRIL 2013

    MAY 2013

    JUNE 2013

    JULY 2013

    AUGUST 2013

    research

    Proposal writing

    presentation Material acquisition

    Design and implementation

    testing Project write-up

    Final presentation

  • 37

    Appendix 3 Program

    #include "SIM900.h"

    #include

    //If not used, is better to exclude the HTTP library,

    //for RAM saving.

    //If your sketch reboots itself proprably you have finished,

    //your memory available.

    //#include "inetGSM.h"

    //If you want to use the Arduino functions to manage SMS, uncomment the lines below.

    # include "sms.h"

    SMSGSM sms;

    //#include

    //GSM sms;

    # define PINNUMBER"9549"

    int motionpin=2;

    //GSM gsmAccess;

    //To change pins for Software Serial, use the two lines in GSM.cpp.

    //GSM Shield for Arduino

    //www.open-electronics.org

    //this code is based on the example of Arduino Labs.

    //Simple sketch to send and receive SMSint numdata;

  • 38

    boolean started=false;

    char smsbuffer[160];

    char n[20];

    int motion;

    int buzzer=10;

    void setup()

    {

    pinMode(motionpin, INPUT);

    pinMode(buzzer,OUTPUT);

    //Serial connection.

    Serial.begin(9600);

    Serial.println("GSM Shield testing.");

    //Start configuration of shield with baudrate.

    //For http uses is raccomanded to use 4800 or slower.

    if (gsm.begin(2400)){

    Serial.println("\nstatus=READY");

    started=true;

    }

    else Serial.println("\nstatus=IDLE");

    //if(started){

    // //Enable this two lines if you want to send an SMS.

    // if (sms.SendSMS("0729779349", "Intruder Detected"))

    //Serial.println("\nSMS sent OK");

    // }

    };

  • 39

    void loop()

    {

    motion=digitalRead(motionpin);

    if(motion==HIGH)

    {

    Serial.println("MOTION DETECTED");

    sms.SendSMS("0729779349","MOTION DETECTED");

    digitalWrite(buzzer,HIGH);

    }

    else

    {

    Serial.println("NO MOTION");

    digitalWrite(buzzer,LOW);

    }

    delay(10000);

    };