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

GSM based Ultrasonic Security System

Chapter 1

INTRODUCTION

2014-15

Ultrasound is acoustic (sound) energy in the form of waves having a frequency above the human hearing range. The highest frequency that the human ear can detect is approximately 20 thousand cycles per second (20,000 Hz). This is where the sonic range ends, and where the ultrasonic range begins. Ultrasound is used in electronic, navigational, industrial, and security applications. It is also used in medicine to view internal organs of the body. Ultrasound can be used to locate objects by means similar to the principle by which radar works. High frequency acoustic waves reflect from objects, even comparatively small ones, because of the short wavelength. The distance to an object can be determined by measuring the delay between the transmission of an ultra-sound pulse and the return of the echo. This is the well-known means by which bats navigate in darkness. It is also believed to be used underwater by cetaceans such as dolphins and whales. Ultrasound can be used in sonar systems to determine the depth of the water in a location, to find fish, to locate submarines. In this project, we are using the ultrasound signals to detect the intruders and the owner is alerted through a message.

1.1 MOTIVATION

Today video surveillance is widely used. But it has a major disadvantage. If we have installed a camera as our security system, we may have to go through the video recorded to know about the intruder or we should sit in front of the camera and watch it continuously which is totally a waste of time. But our ultrasonic security system sends the message to the owner immediately when the intruder is detected, also alerts the surroundings by sounding the alarm.

1.2 OBJECTIVE

Security is an important part of home, Office, Industry, Shops etc…The major function of this Device is to provide security, hence it can be used almost anywhere to protect valuables.

GSM based Ultrasonic Security System

2014-15

1.3 ORGANIZATION OF THE REPORT

Chapter2: Describes the block diagram.

Chapter3: Discusses the hardware description.

Chapter4: Explains the system design of the intruder detection.

Chapter5: Software description of the project is discussed.

Chapter6: Experimental results are discussed.

Chapter7: Explains conclusion and future enhancements.

GSM based Ultrasonic Security System

CHAPTER 2

BLOCK DIAGRAM

2014-15

Security System ​ CHAPTER 2 BLOCK DIAGRAM 2014-15 Fig 2.1: Block diagram describing the detection system.

Fig 2.1: Block diagram describing the detection system.

Components used in the block diagram

1. Ultrasonic transmitter: It produces 8 pulses of 40 KHz and transmits the pulses.

It has to be made high for 10µs.

2. Ultrasonic receiver: It receives the reflected pulses from the intruder.

3. Microcontroller: It is used to give the input to the ultrasonic sensor and start the timer and

to hold the value of the timer. It is also used to send the message using GSM.

4. Power supply: 5V power supply is needed for the microcontroller to work.

5. GSM: It is used to notify the owner by sending a message.

6. LED (Light Emitting Diode): It is used to indicate the presence and absence of intruder

by glowing LED.

7. Buzzer: It is used as alarm to indicate the presence of intruder and alert the surroundings.

GSM based Ultrasonic Security System

CHAPTER 3

2014-15

HARDWARE DISCRIPTION

3.1 AT89S52 Microcontroller

The block diagram shown in Fig 3.1 explains the internal parts of AT89S52. It contains three timers, which can be used for counting internal clock pulse i.e. to generate delays or to count external events. AT89S52 contain 4 ports which can be used either to input digital data or to output digital data. Each port is 8 lines wide. So total of 32 pins are used as I/O ports. AT89S52 contains serial port for transmission or reception of serial data. AT89S52 has On-chip RAM of 256 bytes and On-Chip ROM of 8 kilo bytes.AT89S52 also contains Address and Data lines for accessing external memory. These lines are multiplexed with Port 0 and Port 2.

memory. These lines are multiplexed with Port 0 and Port 2. Fig 3.1: Architecture of AT89S52

Fig 3.1: Architecture of AT89S52

Internal schematics of the 8052:

Data and Program Memory:

GSM based Ultrasonic Security System

2014-15

The 8052 Microcontroller can be programmed in PL/M, 8052 Assembly, C and other high-level languages. Many compilers even have support for compiling C++ for an 8052. Program memory in the 8052 is read-only, while the data memory is considered to be read/write accessible. When stored on EEPROM or Flash, the program memory can be rewritten when the microcontroller is in the special programmer circuit.

Special Function Register:

The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF. A, B, PSW, DPTR are called SFR. This area of memory cannot be used for data or program storage, but is instead a series of memory-mapped ports and registers. Also, different status registers are mapped into the SFR, for use in checking the status of the 8052, and changing some operational parameters of the 8052.

General Purpose Registers:

The 8052 has 4 selectable banks of eight addressable 8-bit registers i.e., R0 to R7. This means that, there are essentially 32 available general purpose registers, although only 8 (one bank) can be directly accessed at a time, to access the other banks, we need to change the current bank number in the flag register.

XTAL1 and XTAL2:

These pins are provided for connecting a resonant network to form an oscillator. Resonant network has quartz crystal which is connected between these two pins. The crystal frequency is the basic internal clock frequency of the microcontroller (1 MHz-16MHz).

Used I/0 ports of the microcontroller:

PORT 2: It is 8-bit bi-directional I/O port. It is bit/ byte addressable. During external memory access it functions as higher order address bus. The alternate use of Port 2 is to supply a high order address byte in conjunction with port 0 low order byte to address external memory. P2.5: It is connected to the buzzer.

GSM based Ultrasonic Security System

2014-15

P2.6 and P2.7: These pins are connectedto the leds.

PORT 3: It is used for special functions like interrupts, transmitter and receiver, to connect

external clock etc

P3.0: This pin is used to give the input for the ultrasonic sensor. It is connected to the trigger pin of ultrasonic sensor.

P3.1 (TxD): It is used to for serial communication to send data serially to the GSM module. This pin is connected to the Rx pin of the GSM module. P3.2 (INT0): This pin is used for receiving the output of the ultrasonic sensor. It is external hardware interrupt I/P signal. It is connected to the echo pin of ultrasonic sensor.

And also as simple I/O port.

GSM based Ultrasonic Security System

2014-15

3.2 HC-SR04 ULTRASONIC SENSOR:

Ultrasonic (US) ranging module HC-SR04 provides 2cm - 400cm non-contact measurement

function. This includes ultrasonic transmitter, receiver and control circuit as shown in the Fig

3.21

Working of HC-SR04:

Fig 3.22 illustrates the working of HC-SR04. (1) Using I/O trigger for at least 10µs high level signal. (2) The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back. (3) If the signal is sent back, then the echo pin will go low. The time that the Echo pin is high is stored in microcontroller. Test distance = (high level time × velocity of sound (340m/s) / 2)

= (high level time × velocity of sound (340m/s) / 2) Specifications: Fig.3.21: HC-SR04 Dept of

Specifications:

Fig.3.21: HC-SR04

GSM based Ultrasonic Security System

Power supply: 5V DC Quiescent current: <2mA Effectual angle: <15° Ranging distance: 2cm – 500 cm Resolution: 0.3 cm

Timing diagram:

2014-15

A short ultrasonic pulse is transmitted at the time 0 reflected by an object as shown in the Fig 3.22. The sensor receives this signal and converts it to an electric signal. The next pulse can be transmitted when the Echo is faded away. This time period is called cycle period. The recommend cycle period should be not less than 50ms. If a 10μs width trigger pulse is sent to the signal pin, the Ultrasonic module will output eight 40 KHz ultrasonic signal and detect the Echo back. The measured distance is proportional to the echo pulse width and can be calculated by the formula. If no intruder is detected, the output pin will give a 38ms high level signal.

Distance in cm = Echo pulse width in μs /59

GSM based Ultrasonic Security System

2014-15

GSM based Ultrasonic Security System 2014-15 Fig 3.22: Timing diagram of HC-SR04 Ultrasonic Sensor 3.3 GSM

Fig 3.22: Timing diagram of HC-SR04 Ultrasonic Sensor

3.3 GSM MODEM

Introduction:

GSM/GPRS module is used to establish communication between a computer and a GSM-GPRS system. Global System for Mobile communication (GSM) is an architecture used for mobile communication in most of the countries. Global Packet Radio Service (GPRS) is an extension of GSM that enables higher data transmission rate. GSM/GPRS module consists of a GSM/GPRS modem assembled together with power supply circuit and communication interfaces (like RS-232, USB, etc.) for computer. The MODEM is the soul of such modules. SIM900- TTL UART GSM/GPRS modem:

GSM based Ultrasonic Security System

2014-15

GSM (Global System for Mobile) / GPRS (General Packet Radio Service) TTL –Modem is SIM900 Quad-band GSM / GPRS device, works on frequencies 850 MHZ, 900 MHZ, 1800

MHZ and 1900 MHZ. It is very compact in size and easy to use as plug in GSM Modem. The Modem is designed with 3V3 and 5V DC TTL interfacing circuitry, which allows User to directly interface with 5V Microcontrollers (PIC, AVR, AT89S52 microcontroller, AT89S52, etc.) as well as 3V3 Microcontrollers (ARM, ARM Cortex XX, etc.). The baud rate can be configurable from 9600- 115200 bps through AT (Attention) commands. This GSM/GPRS TTL Modem has internal TCP/IP stack to enable User to connect with internet through GPRS feature. It is suitable for SMS as well as DATA transfer application in mobile phone to mobile phone interface. The modem can be interfaced with a Microcontroller using USART

(Universal

communication).

Features-

Synchronous Asynchronous Receiver and Transmitter) feature (serial

Quad Band GSM/GPRS : 850 / 900 / 1800 / 1900 MHz

Built in RS232 to TTL or vice versa Logic Converter (MAX232)

Configurable Baud Rate

SMA (Sub Miniature version A) connector with GSM L Type Antenna

Built in SIM (Subscriber Identity Module) Card holder

Built in Network Status LED

Audio Interface Connectors (Audio in and Audio out)

Most Status and Controlling pins are available

Normal Operation Temperature : -20 °C to +55 °C

Input Voltage : 5V to 12V DC

Interfaces

Interface to external SIM3V/1.8V

Analog audio interface

RTC backup

SPI interface

Serial interface

Embedded SIM

Antenna pad

GSM based Ultrasonic Security System

GPIO

ADC

Charge interface for LI battery

PWM

2014-15

Interfacing GSM with 8052

The GSM module is communicate the microcontroller with mobile phones through UART. To communicate over UART or USART, we just need three basic signals which are namely, RXD (receive), TXD (transmit), GND (common ground). GSM modem interfacing with microcontroller for SMS control of industrial equipment. The sending SMS through GSM modem when interfaced with microcontroller or PC is much simpler as compared with sending SMS through UART. Text message may be sent through the modem by interfacing only three signals of the serial interface of modem with microcontroller i.e., TxD, RxD and GND. In this scheme RTS and CTS signals of serial port interface of GSM Modem are connected with each other. The transmit signal of serial port of microcontroller is connected with transmit signal (TxD) of the serial interface of GSM Modem while receive signal of microcontroller serial port is connected with receive signal (RxD) of serial interface of GSM Modem. The SMS message in text mode can contain only 140 characters at the most. It depends upon the amount of information collected from GPS Engine that you need at the base station for tracking vehicle or person. We now want to display a text in mobile from 8052 Primer Board by using GSM module through UART. In 8052 Primer Board contains two serial interfaces that are UART0 & UART1. Here we are using UART0. The GSM modem is being interfaced with the microcontroller 8051 Primer Board for SMS communication. The SMS can be sending and receiving for the data sharing and situation information and control.

GSM based Ultrasonic Security System

2014-15

GSM based Ultrasonic Security System 2014-15 Fig.3.31 Interfacing GSM to microcontroller MAX 232 The MAX232 IC

Fig.3.31 Interfacing GSM to microcontroller

MAX 232

The MAX232 IC is used to convert the TTL/CMOS logic levels to RS232 logic levels during serial communication of microcontrollers with PC. The controller operates at TTL logic level (0-5V) whereas the serial communication in PC works on RS232 standards (-25 V to + 25V). This makes it difficult to establish a direct link between them to communicate with each other.

The intermediate link is provided through MAX232. It is a dual driver/receiver that includes a capacitive voltage generator to supply RS232 voltage levels from a single 5V supply. Each receiver converts RS232 inputs to 5V TTL/CMOS levels. These receivers (R1 & R2 ) can accept ±30V inputs. The drivers (T1 & T2 ), also called transmitters, convert the TTL/CMOS input level into RS232 level.

GSM based Ultrasonic Security System

2014-15

GSM based Ultrasonic Security System 2014-15 Fig. 3.32 MAX 232 pin configuration Rs-232/Db9 An RS-232 ​

Fig. 3.32 MAX 232 pin configuration

Rs-232/Db9

An RS-232 serial port was once a standard feature of a personal computer, used for connections to modems, printers, mice, data storage, uninterruptible power supplies, and other peripheral devices. However, RS-232 is hampered by low transmission speed, large voltage swing, and large standard connectors. In modern personal computers, USB has displaced RS-232 from most of its peripheral interface roles. Many computers do not come equipped with RS-232 ports and must use either an external USB-to-RS-232 converter or an internal expansion card with one or more serial ports to connect to RS-232 peripherals. Nevertheless, RS-232 devices are still used, especially in industrial machines, networking equipment and scientific instruments. RS-232 stands for Recommend Standard number 232. This cable Rs-232(Db9) is used to interface between microcontroller and GSM (global system for mobile communication).

GSM based Ultrasonic Security System

2014-15

GSM based Ultrasonic Security System 2014-15 Fig. 3.33 pin configuration of DB9 connector Dept of E

Fig. 3.33 pin configuration of DB9 connector

Ultrasonic Security System 2014-15 Fig. 3.33 pin configuration of DB9 connector Dept of E & C,

GSM based Ultrasonic Security System

3.4 LED (light emitting diode)

2014-15

It is used to indicate whether the intruder is detected or not. 2 White LEDs are used. One to indicate detection of intruder, another for not.

3.5 BUZZER

A buzzer is an audio signaling device, which may be mechanical, electromechanical, or

piezoelectric. The buzzer is used to alarm when there is intruder in the restricted area and

alert the surroundings.

3.6 POWER SUPPLY

Power supply circuit is built using filter, rectifier, and then voltage regulators. Starting with

an

ac voltage, a steady dc voltage is obtained by rectifying the ac voltage, then filtering to a

dc

level, and finally, regulating to obtain a desired fixed dc voltage. The regulation is usually

obtained from an IC voltage regulator unit, which takes a dc voltage and provides lower dc voltage, which remains the same even if the input dc voltage varies, or the output load connected to the dc voltage changes. The block diagram of power supply is shown in Fig

3.61.

The block diagram of power supply is shown in Fig 3.61. Fig.3.61: Block diagram of power

Fig.3.61: Block diagram of power supply

Transformer:

GSM based Ultrasonic Security System

2014-15

A transformer is a static electrical device that transfers energy by inductive coupling between

its winding circuits. A varying current in the primary winding creates a varying magnetic flux

in the transformer's core and thus a varying magnetic flux through the secondary winding.

This varying magnetic flux induces a varying electromotive force (EMF) or voltage in the secondary winding. Transformers can be used to vary the relative voltage of circuits or isolate them, or both. The transformer will step down the power supply voltage (0-230V) to (0-6V) level. It is given to the Bridge rectifier as input.

Bridge rectifier:

Bridge rectifier is used to maintain the proper DC voltage at the input to the circuit as shown

in the Fig 3.62. It comprises of four diodes connected to form a bridge. It uses the entire AC

wave (both positive and negative sections). 1.4V is used up in the bridge rectifier because

each diode uses 0.7V when conducting and there are always two diodes conducting, as shown

in fig below.

are always two diodes conducting, as shown in fig below. Fig 3.62: Bridge rectifier Voltage Regulators:

Fig 3.62: Bridge rectifier

Voltage Regulators:

Fig 3.63 shows the basic connection of a three-terminal voltage regulator IC to a load. The

fixed voltage regulator has an unregulated dc input voltage Vin, applied to one input terminal, a regulated output dc voltage Vout, from a second terminal, and the third terminal connected

to ground. We are using 7805 IC which contains zener diode.

GSM based Ultrasonic Security System

2014-15

GSM based Ultrasonic Security System 2014-15 POWER SUPPLY DESIGN Fig.3.63: Voltage regulator Fig 3.64: Circuit ​

POWER SUPPLY DESIGN

Fig.3.63: Voltage regulator

2014-15 POWER SUPPLY DESIGN Fig.3.63: Voltage regulator Fig 3.64: Circuit ​ Diagram ​ for power supply

Fig 3.64: Circuit Diagramfor power supply

Calculations:

Vdc (o/p) =5V Idc (o/p) =100mA Vdc (in) =Vdc (o/p) + 5V = 10V Assume y ≤ 0.05

=100mA Vdc (in) =Vdc (o/p) + 5V = 10V Assume y ≤ 0.05 C=577.35uF Vm =

C=577.35uF

Vm = Vdc (in) + Idc/4fc =10V Choose capacitor >577.35uF (>> 10V) Choose diodes with current rating >100mA, breakdown voltage>>PIV=Vm=10V Vrms (i/p) = Vm/1.414 = 7.071V N1/N2 = V1/V2 = 34/1 Choose 0:9 transformer.

GSM based Ultrasonic Security System

2014-15

GSM based Ultrasonic Security System

Chapter 4

SYSTEM DESIGN

2014-15

The circuit diagram shown in Fig 4.1 is the main part of the intruder detection. Ultrasonic sensor is connected to 8052 through p3.0 and p3.2 pins of port3. LEDs are used to indicate the presence and absence of intruder in the specified range. The embedded C is used to write the software code and it is dumped into 8052 to measure the distance using Keil micro-vision.

into 8052 to measure the distance using Keil micro-vision. Fig.4.1: Circuit diagram of the intruder detection

Fig.4.1: Circuit diagram of the intruder detection system

Explanation of the circuit diagram:

Trigger pin of the ultrasonic sensor is connected to pin P3.0 and Echo pin is connected to pin P3.2 of microcontroller. Crystal is connected pin 18 and 19 of microcontroller. LEDs are connected to pins P2.6 and P2.7 of microcontroller. Microcontroller is connected to 5v power supply. GSM is connected to the P3.1 (TxD) pin of the microcontroller. Buzzer is connected to P2.5 of microcontroller.

GSM based Ultrasonic Security System

2014-15

GSM based Ultrasonic Security System

Chapter 5

2014-15

SOFTWARE DESCRIPTION

When the trigger pin is made a transaction from low to high with a delay of 10µs, then the timer starts and Echo pin of the sensor goes high. If the pulse is received by the receiver of the sensor then Echo pin goes low then time required for transmitting and receiving of the pulse will be stored in DPTR register. The distance to the intruder will be proportional to the high level time of echo pulse. The flowchart of the system is shown in fig 5.1.

echo pulse. The flowchart of the system is shown in fig 5.1. Fig.5.1: Flow chart of

Fig.5.1: Flow chart of the intruder detection system

GSM based Ultrasonic Security System

Chapter 6

2014-15

EXPERIMENTAL RESULTS

The intruder assumed here is a person but it can be anything which has certain size and shape. The range of the distance varies from minimum of 2cm to maximum of 250cm. Fig 6.1 shows the snapshot of the project which includes LED, buzzer, GSM module, Ultrasonic sensor, and 8052 microcontroller .Fig 6.2 shows the message received in the owner’s mobile.

.Fig 6.2 shows the message received in the owner’s mobile. Fig 6.1 Snapshot of the Ultrasonic

Fig 6.1 Snapshot of the Ultrasonic Security system

mobile. Fig 6.1 Snapshot of the Ultrasonic Security system Fig 6.2 Snapshot of the SMS received

Fig 6.2 Snapshot of the SMS received

GSM based Ultrasonic Security System

Chapter 7

CONCLUSION

2014-15

The major function of this Device is to provide security, hence it can be used almost anywhere to protect valuables:

Can be used in museum to protect antique items and other valuable items

Can be used as an Home Security System

It can also be used to protect Privacy

Can be used in jewellery shop to protect jewels from customers.

GSM based Ultrasonic Security System

REFERENCES

2014-15

1. Mohammed Ali Mazidi and Gannice Gilipsi Mazidi, “8051 Microcontroller and Embedded Systems Using Assembly and C” Second edition : PHI, 2002

2. www.wikipedia.org

3. www.raeelectronics .com

4. Ikuo Ihara, “Ultrasonic Sensing: Fundamentals and Its Applications to Non-destructive Evaluation (a draft)”

5. www.elecfreaks.com, HC-SR04 User Guide.