VEHICLE ACCIDENT ALERT SYSTEM USING GSM AND GPS
A Project Report On “VEHICLE ACCIDENT ALERT SYSTEM USING GSM AND GPS”
Submitted To THE INSTITUTION OF ENGINEERS (INDIA)
FOR PARTIAL FULFILMENT OF THE REQUIREMENT OF THE AWARD OF DEGREE FOR A.M.I.E Done By ARSHID SHYAMKUMAR Under the guidance of Mr. B. KOTESWAR RAO FIE. THE INSTITUTION OF ENGINEERS (INDIA) 8, GOKHALE ROAD, KOLKATA- 700 020, INDIA ESTABLISHED 1920 INCORPORATED BY ROYAL CHARTER 1935
THE INSTITUTUTION OF ENGINEERS (INDIA) 8,GOKHALE ROAD, KOLKATA- 700 020, INDIA. ESTABLISHED 1920 INCORPORATED BY ROYAL CHARTER 1935
CERTIFICATE Date : This is to certify that Mr. ARSHID SHYAMKUMAR, bearing hip number ST - 607777-9 has done the project titled “VEHICLE ACCIDENT ALERT SYSTEM USING GSM AND GPS” under my guidance. This project is submitted to The Institution of Engineers (India) for the award of degree of AMIE ECE department in Winter 2015 session. The results embodied in this thesis have not been submitted to any other University for the award of any degree or diploma.
Project Guide Mr. B.KOTESWAR RAO FIE
DECLARATION
I Arshid Shyamkumar (ST - 607777-9) do here by declare that, this work is an original one and has not been submitted earlier to any other institution for fulfillment of the requirement of a course of study.
Place : Hyderabad, Date:
ARSHID SHYAMKUAR
ACKNOWLEDGEMENT
I would like to thank to the board of Institute of Engineers, Kolkata, for allowing me to do this project in order to become Associate Member of the institute by completing the course. I am highly indebted to take the opportunity to express deep gratitude and obligation to Mr. B.KOTESWAR RAO.,FIE, Project guide for his constant , supervision, timely advice, ideas, Valuable guidance, Co operation and help throughout the Project work tenure. The success of any project depends largely on the encouragement, and co operation of the people. I would like to express my deep gratitude to my colleagues for their .
ARSHID SHYAMKUMAR ST-607777-9
TABLE OF CONTENTS SYNOPSIS …………………………………………………………………………………………………………… …………………….1-3 ACTIVITY REPORT …………………………………………………………………………………………………………… …………4-5 LIST OF FIGURES …………………………………………………………………………………………………………… ……………6
1.INTRODUCTION …………………………………………………………………………………………………………… …………7 2.BLOCK DIAGRAM …………………………………………………………………………………………………………… ……….8 2.1 CONCEPT AND OVERWIEW …………………………………………………………………………………………………9 2.2 INTERNAL CIRCUIT DIAGRAM …………………………………………………………………………………………....10 3.HARDWARE …………………………………………………………………………………………………………… ……………….11 3.1 MICROCONTROLLER …………………………………………………………………………………………………………… 12-19 3.2 GPS …………………………………………………………………………………………………………… …………………………20 3.3 GSM …………………………………………………………………………………………………………… …………………………21-26 3.4 MEMS ACCELEROMETER ………………………………………………………………………………………………………… 27 3.5 LIQUID CRYSTAL DISPLAY ……………………………………………………………………………………………………… 2829 4. SHORT CIRCUIT ALERT SYSTEM WORKING……………………………………………………………………………… 30 4.1 VEHICLE ACCIDENT ALERT SYSTEM WORKING …………………………………………………………………………30 4.2 FLOW CHART OF THE SYSTEM …………………………………………………………………………………………………31 5.CODE WRITTEN TO THE PROCESSOR …………………………………………………………………………………………32-41 6. RESULTS ………………………………….. ………………………………………………………………………………………………..42 7.LIMITATIONS OF THE PROJECT ……………………………………………………………………………………………………43
8.SCOPE OF FUTURE STUDY ………………………………………………………………………………………………………… 44 9. BIBILOGRAPHY …………………………………………………………………………………………………………… ………………45
SYNOPSIS Title of the Project: “VEHICLE ACCIDENT ALERT SYSTEM USING GSM AND GPS”
Objective of the study: The project titled as VEHICLE ACCIDENT ALERT SYSTEM USING GSM AND GPS
is an embedded based system. By this advanced technology we can get accurate
information about the collision and short circuit taken place in the vehicle. This system combines advanced hardware design and sophisticated electronic control technology into a compact, reliable package. In this project a vibration sensor is used as an accident detector. When the vehicle meets with an accident, the vibrating sensors generate the signal, this signal is being compared with the threshold values. If the value generated exceeds the threshold it is recognized as accident and this information is immediately informed to their relative persons through GSM as a message to mobile. In this system vibration sensors are used for detecting range of collision, Similarly the short circuit sensors will detect the short circuited condition and intimated through the sms in which disaster can be minimized. Vibration Sensors data will be in analog form so it needs to be converted to digital, which is fulfilled through A/D Converter, and this digital data is being sent to microcontroller there it is compared with the threshold values, if it exceeds the threshold values then only data will be sent to GSM (global system for mobile communication) & location data is captured with the help of GPS (Global Positioning System). Here we are making use of the GPS which gives exact location of the collide vehicle.
1
Importance of the study:
In present days as population increases the number of vehicles also increases. This results in more accidents and deaths and also theft. The result of this system saves death or reduces the death rates, by providing information about the accident to the Monitoring system immediately. It improves the level of management in buses of travel agencies and cargo transportation vehicles, such as trucks.It also provides security to personal vehicles like car by locking the vehicle engine from remote location using GSM in case of theft .A Monitoring system continuously waits for information sent from vehicle system. The information sent by the vehicle system includes position of a vehicle (Longitude and Latitude), speed and temperature. The information provided to the Monitoring system when accident happens or when accesses the system to get the information about the vehicle
Methodology to be used for carrying out the study: ◆ Understand the architecture of AT 895S2 Micro controller and operations of GSM and GPS Modules. ◆ Usage of compiler for dumping code in controller. ◆ Design the circuit for interfacing the MEMS,GSM,GPS,LCD and controller. ◆ Using MEMS, generate different values to test the behavior of the system. ◆ Observe the Alert info in LCD Modules for different values and finalize the correct MEMS values for which Alert info is required. ◆ Get the Alert information on SMS on Vehicle collision and Short circuit.
Equipment/Tools required: ◆ AT 895S2 Micro Controller ◆ GPS Receiver ◆ Vibration Sensor/MEMS ◆ LCD Module ◆ GSM Modem ◆ GPS Module ◆ Serial Communication ◆ Keil Compiler
S.
Activity Name
Days
No.
Dates From / To
1
Interaction with the project guide for the first time
1
11/7/2015
2
Selection of project and approval from project guide
2
04/01/2016 to 5/1/2015
1
6/1/2016
3
Understanding the Micro controller architecture and design
4
Learning basics of MEMS,GSM and GPS and its applications
1
7/1/2016
5
Understanding the operation of compiler and how to dump code in controller
3
8/01/2016 to 10/1/2016
6
7
8
Understanding the programming requirements to interface MCU and GSM,GPS and LCD modules Debugging and testing of the project with different test cases. Preparation of Vehicle Accident alert system project report
5
11/01/2016 to 15/01/2016
4
16/01/2016 to 19/01/2016
2
20/01/2016 to 21/01/2016
9
Demonstration of project
2
22/01/2016 to 23/01/2016
10
Submission of project report.
1
25/01/2016
Activity Report
Approval by Project guide Mr. B.KOTESWAR RAO FIE.
List of figures Figure 1 block diagram...................................................................................................... 8 Figure 2 overview of the system..................................................................................... 9 Figure 3 internal circuit diagram ....................................................................................................................................................... 10
Figure 4 pin diagram of microcontroller AT89S52 ....................................................................................................................................................... 12
Figure 5 GPS modem ....................................................................................................................................................... 20
Figure 6 GSM modem ....................................................................................................................................................... 21 Figure 7 MEMS Accelerometer
....................................................................................................................................................... 27
Figure 8 LCD interfacing with AT89S52..................................................................... 28
Figure 9 LCD display...........................................................................................................
29
Figure 10 output displayed on lcd................................................................................. 29
1. INTRODUCTION There are more and more traffic jams as vehicle’s demands are getting high day by day. So, transportation needs more improvement as demands are increasing there will be more possibility of vehicle accidents . Vehicle accidents are one of the leading causes of the fatalities. It will be a serious consequence if people can’t get help on right time. Poor emergency incident is a major cause of death rate in our country . Even with awareness campaign, this problem is still rising due to riders drunk driving and speed driving. Major automobile manufacturers have developed safety devices such as seat belt to protect riders from accidental injuries . Life saving measure electronic stability control also reduces injuries. Crash analysis studies have shown, traffic accidents could have been prevented with the use of this advanced life saving measure . This design focuses on providing basic information on the accident site to the hospital or police station. As s result of this sudden help, public life may get save In this work, ADXL accelerometer, a three-axis accelerometer and GPS tracking system works for accidental monitoring. This design detects accidents in less time and sends this information to the hospitals. In this case GSM will send short message to the hospital or police station. This message will read the geographical co-ordinates of accident spot with the help of GPS. And, as now the location has been traced by the GPS, emergency medical service can be given to the accident victims as soon as possible. Using this method, traffic fatalities can be reduced as time between when accident occurs and responders are dispatched to the accident scene, reduces. Accelerometer sensor embedded in a car determines severity of the accident as how much car has rolled
As soon as the accident occurs, an alert message including latitude, longitude position, date and time of accident occurrence and finally link, indicating Google map is sent automatically to the rescue team or to the police station. This message is sent with the help of the GSM module and accident location is detected through GPS module. The accident can be recognized precisely with the help of ADXL accelerometer sensor which also acts as vibration sensor. . This design provides solution to the road accidents in most feasible way.
2. BLOCK DIAGRAM This is the block diagram of vehicle accident alert system. This shows the overall view of the vehicle accident alert system circuit. The blocks connected here are LCD display, GPS, GSM, MEMS, Power supply , short circuit detector.
Power supply
Figure 1 Block Diagram
2.1 Concept and Overview This vehicle accident alert system takes input from GPS and send it through the GSM module to desired mobile using mobile communication when accident or short circuit occurs. As soon as accident occurs, Controller takes the Lat and Long values and sends the alert to the mobile using SMS. This alert will help others to track the vehicle and rescue people in it.
Figure 2 overview of the system
2.2 Internal Circuit Diagram
Figure 3 Internal circuit diagram
3. HARDWARE For deg this hardware many types of devices are used to make it perfectly working. All the devices are purchased from different manufacturers. These components are soldered on a soldering board. The following list of hardware are required for this system.
GSM MODULE
A/D CONVERTER
S ACCELEROMETER
GPS MODULE
A SWITCH FOR SHORT CIRCUIT SYSTEM
MICRO CONTROLLER AT89S52
MAX232
RS232
LCD DISPLAY
POWER SUPPLY
CRYSTAL OSCILLATOR
LM7805
BRIDGE RECTIFIER
LED
RESET BUTTON
3.1 Microcontroller Here in this system micro controller used is AT89S52. Mainly micro controller consists of u, memory and various I/O pins, and the speed of this micro controller is enough to execute the program in real time. This particular micro controller is chosen because the experiment requires minimum of 8-bit micro controller. This microcontroller contains 4Kb flash memory inbuilt in it, this memory is enough to dump our code in to the microcontroller. This micro controller contains 40 pins and circuit is designed according to fig 2.3. The 40 pins of microcontroller has different properties and usage they are shown in the following image.
Figure 4 pin diagram of microcontroller AT89S52
AT89S52: Features: • Compatible with MCS-51 Products • 8K Bytes of In-System Programmable (ISP) Flash Memory – Endurance: 1000 Write/Erase Cycles • 4.0V to 5.5V Operating Range • Fully Static Operation: 0 Hz to 33 MHz • Three-level Program Memory Lock • 256K Internal RAM • 32 Programmable I/O Lines • 3 16-bit Timer/Counters • Eight Interrupt Sources • Full Duplex UART Serial Channel • Low-power Idle and Power-down Modes • Interrupt Recovery from Power-down Mode • Watchdog Timer • Dual Data Pointer • Power-off Flag
DESCRIPTION OF MICROCONTROLLER 89S52:
The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller with 8Kbytes of in-system programmable Flash memory. The device is manufactured Using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 micro controller. The onchip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit U with in-system programmable flash one monolithic chip; the Atmel AT89S52 is a powerful micro controller, which provides a highly flexible and cost-effective solution to many embedded control applications.
PIN DESCRIPTION OF MICROCONTROLLER 89S52 VCC Supply voltage. GND Ground. Port 0 Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as high impedance inputs. Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash
programming and outputs the code bytes during program verification. External pull-ups are required during program verification
Port 1 Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 Output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the timer/counter 2 trigger input P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification.
Port 2 Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @DPTR). In this
application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2emits the contents of the P2 Special Function . Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.
Port 3 Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table. Port 3 also receives some control signals for Flash programming And verification.
RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.
ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data Memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALEdisable bit has no effect if the micro controller is in external execution mode.
PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH.Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. A should be strapped to VCC for internal program executions. This pin also receives the
12-voltProgramming
programming.
enables
voltage
(VPP)
during
Flash
XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2 Output from the inverting oscillator amplifier.
Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an External clock source, XTAL2 should be left unconnected while XTAL1 is driven, as shown in Figure 2.
Special Function (SFR) Memory: Special Function s (SFR s) are areas of memory that control specific functionality of the 8051 processor. For example, four SFRs permit access to the 8051’s 32 input/output lines. Another SFR allows the to set the serial baud rate, control and access timers, and configure the 8051’s interrupt system.
The Accumulator: The Accumulator, as its name suggests is used as a general to accumulate the results of a large number of instructions. It can hold 8-bit (1-byte) value and is the most versatile . The “R” s: The “R” s are a set of eight s that are named R0, R1. Etc up to R7. These s are used as auxiliary s in many operations. The “B” s: The “B” is very similar to the accumulator in the sense that it may hold an 8-bit (1-byte) value. Two only uses the “B” 8051 instructions: MUL AB and DIV AB. The Data Pointer: The Data pointer (DPTR) is the 8051’s only accessible 16-bit (2Bytes) . The accumulator, “R” s are all 1-Byte values. DPTR, as the name suggests, is used to point to data. It is used by a number of commands, which allow the 8051 to access external memory. THE PROGRAM COUNTER AND STACK POINTER: The program counter (PC) is a 2-byte address, which tells the 8051 where the next instruction to execute is found in memory. The stack pointer like all s except DPTR and PC may hold an 8-bit (1-Byte) value
ADDRESSING MODES:
An “addressing mode” refers that you are addressing a given memory location. In summary, the addressing modes are as follows, with an example of each: Each of these addressing modes provides important flexibility. Immediate Addressing
MOV A, #20 H
Direct
Addressing
MOV A, 30 H
Indirect
Addressing
MOV A, @R0
Indexed
Addressing
a. External Direct
MOVX A, @DPTR
b. Code Indirect
MOVC A, @A+DPTR
3.2 GPS GPS abbreviates global positioning system and this is used to detect the latitude and longitude of the particular position and it also shows the exact time. It detects these values anywhere on the earth. In our project it plays main role and it is the main source of the latitude and longitude of the vehicle to know the accident occurred location.This gadget gets the coordinates from the satellite for each and every second. This device is the main component of vehicle project.
Figure 5 GPS modem
3.3 GSM GSM abbreviates global system for mobile communication, this is a second generation (2G) mobile network. This is widely used in all over the world for mobile communication. This GSM device consists of sim slot in which a sim can be inserted which has a unique number, this unique number is used for . This GSM device consists a unique number called imei number and this is different for each and every hardware kit. In our project the device is used for transmitting data. The data from GPS is transmitted to given mobile through this GSM itself.
Figure 6 GSM modem
GSM (Global System for Mobile communications) is a cellular network, which means that mobile phones connect to it by searching for cells in the immediate vicinity. GSM networks operate in four different frequency ranges. Most GSM networks operate in the 900 MHz or 1800 MHz bands. Some countries in the Americas use the 850 MHz and 1900 MHz bands because the 900 and 1800 MHz frequency bands were already allocated. The rarer 400 and 450 MHz frequency bands are assigned in some countries, where these frequencies were previously used for first-generation systems. GSM-900 uses 890–915 MHz to send information from the mobile station to the base station (uplink) and 935–960 MHz for the other direction (downlink), providing 124 RF channels (channel numbers 1 to 124) spaced at 200 kHz. Duplex spacing of 45 MHz is used. In some countries the GSM-900 band has been extended to cover a larger frequency range. This 'extended GSM', E-GSM, uses 880–915 MHz (uplink) and 925–960 MHz (downlink), adding 50 channels (channel numbers 975 to 1023 and 0) to the original GSM-900 band. Time division multiplexing is used to allow eight full-rate or sixteen half-rate speech channels per radio frequency channel. There are eight radio timeslots (giving eight burst periods) grouped into what is called a TDMA frame. Half rate channels use alternate frames in the same timeslot. The channel data rate is 270.833 kbit/s, and the frame duration is 4.615 ms.
GSM Advantages: GSM also pioneered a low-cost, to the network carrier, alternative to voice calls, the Short t message service (SMS, also called "text messaging"), which is now ed on other mobile standards as well. Another advantage is that the standard includes one worldwide Emergency telephone number, 112. This makes it easier for international travelers to connect to emergency services without knowing the local emergency number. The GSM Network: GSM provides recommendations, not requirements. The GSM specifications define the functions and interface requirements in detail but do not address the hardware. The GSM network is divided into three major systems: the switching system (SS), the base station system (BSS), and the operation and system (OSS).
The Switching System: The switching system (SS) is responsible for performing call processing and subscriber-related functions. The switching system includes the following functional units.
Home location (HLR): The HLR is a database used for storage and management of subscriptions. The HLR is considered the most important database, as it stores permanent data about subscribers, including a subscriber's service profile, location information, and activity status. When an individual buys a subscription from one of the PCS operators, he or she is ed in the HLR of that operator.
Mobile services switching center (MSC): The MSC performs the telephony switching functions of the system. It controls calls to and from other telephone and data systems. It also performs such functions as toll ticketing, network interfacing, common channel signaling, and others.
Visitor location (VLR): The VLR is a database that contains temporary information about subscribers that is needed by the MSC in order to service visiting subscribers. The VLR is always integrated with the MSC. When a mobile station roams into a new MSC area, the VLR connected to that MSC will request data about the mobile station from the HLR. Later, if the mobile station makes a call, the VLR will have the information needed for call setup without having to interrogate the HLR each time.
Authentication center (AUC): A unit called the AUC provides authentication and encryption parameters that the 's identity and ensure the confidentiality of each call. The AUC protects network operators from different types of fraud found in today's cellular world.
Equipment identity (EIR): The EIR is a database that contains information about the identity of mobile equipment that prevents calls from stolen, unauthorized, or defective mobile stations. The AUC and EIR are implemented as stand-alone nodes or as a combined AUC/EIR node.
The Base Station System (BSS): All radio-related functions are performed in the BSS, which consists of base station controllers (BSCs) and the base transceiver stations (BTSs).
BSC: The BSC provides all the control functions and physical links between the MSC and BTS. It is a high-capacity switch that provides functions such as handover, cell configuration data, and control of radio frequency (RF) power levels in base transceiver stations. A number of BSCs are served by an MSC.
BTS: The BTS handles the radio interface to the mobile station. The BTS is the radio equipment (transceivers and antennas) needed to service each cell in the network. A group of BTSs are controlled by a BSC.
GSM Specifications: Specifications for different personal communication services (PCS) systems vary among the different PCS networks. Listed below is a description of the specifications and characteristics for GSM.
Frequency band: The frequency range specified for GSM is 1,850 to 1,990 MHz (mobile station to base station).
Duplex distance: The duplex distance is 80 MHz. Duplex distance is the distance between the uplink and downlink frequencies. A channel has two frequencies, 80 MHz apart.
Channel separation: The separation between adjacent carrier frequencies. In GSM, this is 200 kHz.
Modulation: Modulation is the process of sending a signal by changing the characteristics of a carrier frequency. This is done in GSM via Gaussian minimum shift keying (GMSK).
Transmission rate: GSM is a digital system with an over-the-air bit rate of 270 kbps.
Access method: GSM utilizes the time division multiple access (TDMA) concept. TDMA is a technique in which several different calls may share the same carrier. Each call is assigned a particular time slot.
Speech coder: GSM uses linear predictive coding (LPC). The purpose of LPC is to reduce the bit rate. The LPC provides parameters for a filter that mimics the vocal tract. The signal es through this filter, leaving behind a residual signal. Speech is encoded at 13 kbps.
Main AT commands: "AT command set for GSM Mobile Equipment” describes the Main AT commands to communicate via a serial interface with the GSM subsystem of the phone. AT commands are instructions used to control a modem. AT is the abbreviation of Attention. Every command line starts with "AT" or "at". That's why modem commands are called AT commands. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also ed by GSM/GPRS modems and mobile phones. Besides this common AT command set, GSM/GPRS modems and mobile phones an AT command set that is specific to the GSM technology, which includes SMS-related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages). Note that the starting "AT" is the prefix that informs the modem about the start of a command line. It is not part of the AT command name. For example, D is the actual AT command name in ATD and +CMGS is the actual AT command name in AT+CMGS. However, some books and web sites use them interchangeably as the name of an AT command. Here are some of the tasks that can be done using AT commands with a GSM/GPRS modem or mobile phone:
Get basic information about the mobile phone or GSM/GPRS modem. For example, name of manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number (International Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR).
Get basic information about the subscriber. For example, MSISDN (AT+CNUM) and IMSI number (International Mobile Subscriber Identity) (AT+CIMI).
Get the current status of the mobile phone or GSM/GPRS modem. For example, mobile phone activity status (AT+AS), mobile network registration status (AT+CREG), radio signal strength (AT+CSQ), battery charge level and battery charging status (AT+CBC).
Establish a data connection or voice connection to a remote modem (ATD, ATA, etc).
Send and receive fax (ATD, ATA, AT+F*).
Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write (AT+CMGW) or delete (AT+CMGD) SMS messages and obtain notifications of newly received SMS messages (AT+CNMI).
Read (AT+BR), write (AT+BW) or search (AT+BF) phonebook entries.
Perform security-related tasks, such as opening or closing facility locks (AT+CLCK), checking whether
a
facility
is
locked
(AT+CLCK)
and
changing
s
(AT+WD).
(Facility lock examples: SIM lock [a must be given to the SIM card every time the mobile phone is switched on] and PH-SIM lock [a certain SIM card is associated with the mobile phone. To use other SIM cards with the mobile phone, a must be entered.])
Control the presentation of result codes / error messages of AT commands. For example, you can control whether to enable certain error messages (AT+CMEE) and whether error messages should be displayed in numeric format or verbose format (AT+CMEE=1 or AT+CMEE=2).
Get or change the configurations of the mobile phone or GSM/GPRS modem. For example, change the GSM network (AT+COPS), bearer service type (AT+CBST), radio link protocol parameters (AT+CRLP), SMS center address (AT+CSCA) and storage of SMS messages (AT+MS).
Save and restore configurations of the mobile phone or GSM/GPRS modem. For example, save (AT+CSAS) and restore (AT+CRES) settings related to SMS messaging such as the SMS center address.
3.4 MEMS Accelerometer sensor
Figure 7 MEMS Accelerometer
MEMS (Micro-Electro Mechanical System)-based accelerometers are devices that measure the proper acceleration. In relativity theory, proper acceleration is the physical acceleration experienced by an object. The psychical acceleration is measurable by sensors. These sensors are part of the sensing cluster of ubiquitous technologies. Sensing technologies make use of physical parameters from the environment, such as temperature, pressure, force and light. An accelerometer measures weight per unit of mass, a quantity also known as specific force, or gforce. MEMS-based accelerometers are one of the simplest but also most applicable microelectromechanical devices. They are widely used in cost sensitive, low power, motion- and tiltsensing applications like mobile devices, gaming systems, disk drive protection, image stabilization and sports and health devices.
3.5 Liquid crystal display LCD is the display device which is of 16x2 size and it has yellow background light. This LCD is connected to microcontroller. The following is the interfacing diagram of LCD with microcontroller AT89S52.
A liquid crystal display (LCD) 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. Each pixel consists of a column of liquid crystal molecules suspended between two transparent electrodes, and two polarizing filters, the axes of polarity of which are perpendicular to each other. Without the liquid crystals between them, light ing through one would be blocked by the other. The liquid crystal twists the polarization of light entering one filter to allow it to through the other.
A program must interact with the outside world using input and output devices that communicate directly with a human being. One of the most common devices attached to an controller is an LCD display. Some of the most common LCDs connected to the contollers are 16X1, 16x2 and 20x2 displays. This means 16 characters per line by 1 line 16 characters per line by 2 lines and 20 characters per line by 2 lines, respectively.
Figure 8 LCD interfacing with AT89S52 To enable terminal latch of LCD high to low pulse is sent and RS bit is enabled. Once the latch is enabled the data is transferred through the interfacing pins parallel and the LCD shows the display on it. These LCD are easy to program and they are economical too. LCD interfacing with microcontroller is very easy. Here in our vehicle tracking project LCD displays the output i.e. latitude and longitude of the vehicle. The following figure shows the LCD display of latitude and longitude.
Figure 9 LCD display
4. Vehicle short circuit system working For Short circuit detection, we are shorting two terminals which is connected to one of the pins in the controller. Once short circuit is detected in this port controller then takes input from GPS and which goes into rs232. This Rs232 sends data into max232 and it converts the data format and sends it to the Rx (receiver pin) of microcontroller and this microcontroller stores this data in USART buffer and the data stored is sent again through Tx pin into max232 this max 232 sends the data into GSM via rs232. This is how vehicle short circuit alert works using GSM and GPS. The lcd interfaced to the microcontroller also shows the display of the coordinates. This lcd display is only used to know the working condition of the vehicle tracking system.
4.1 Vehicle accident alert system working Controller continuously monitors the Accelerometer values. Accelerometer is connected to A/D converter which in turn is connected to controller ports. Whenever controller finds the values of accelerometer exceeding threshold values saved in the controller. It then captures the GPS co-ordinates and sends SMS to pre-configured number with GPS Co-ordinates and severity of the accident.
4.2 Flow chart of the system:
5.Code written to the processor #include
#include<string.h> #include<stdio.h> #include
#define BUFF_LEN 50 #define lcd P2 ///////////////////////////////////// sbit CLK = P3^6; sbit DOUT= P3^5; sbit DIN = P3^4; sbit CS = P3^7; sbit mtr =P1^2; sbit sw = P1^0; sbit rl=P1^1; ////////////////////////////// void init_lcd(void); void cmd_lcd(unsigned char); void lcd_data(unsigned char); void display_lcd(unsigned char *); float adc_convert1 (void); void integer_lcd(int); void delay_ms(unsigned int); float adc_convert (void); unsigned char byte_write_read(unsigned char); void select_channel(void); unsigned char channel,channel1,A,C; void select_channel1 (void); /********************************/ void GSM_INIT(void); void SEND_SMS_GPS(unsigned char *); void RECEIVE_GPS(void); void RECEIVE_GPGLL(unsigned long); unsigned char RECEIVE_CHR(unsigned long); void SEND_CHR(unsigned char); void SEND_STR(unsigned char *); unsigned int i=0,j=0; unsigned char REC_BUFF[BUFF_LEN]; void serial_send(unsigned char); void SEND_STR(unsigned char *);
/*********************************/ int f,f1,x,y; ///////////////////////////////////////////////////////// void main (void) { TMOD = 0x20; SCON = 0x50; TH1 = 0xFD; TR1 = 1; rl=0; init_lcd(); GSM_INIT(); cmd_lcd(0x80); display_lcd("COLLISION AND "); cmd_lcd(0xc0); display_lcd("SHORT CIRCUIT "); delay_ms(500); cmd_lcd(0x01); cmd_lcd(0x80); display_lcd("ALERT INFO... "); cmd_lcd(0xc0); display_lcd(" IN VEHICLES "); delay_ms(500); cmd_lcd(0x01); cmd_lcd(0x80); display_lcd("USING GPS &GSM "); cmd_lcd(0xc0); display_lcd("TECHNOLOGIES..."); cmd_lcd(0x01); cmd_lcd(0x01); cmd_lcd(0x80); display_lcd("X-: Y-: mtr=0; sw=1; IE = 0x90; while(1) { mtr=0; channel=0; channel1=1; f=adc_convert(); x=f; cmd_lcd(0x83); integer_lcd(f); delay_ms(500);
");
//
/************************/ f=adc_convert1(); y=f; f=f/4; cmd_lcd(0x8B); integer_lcd(f); delay_ms(500); if(sw==0) { cmd_lcd(0xC0); display_lcd("SHORT CKT OCCURED "); mtr=1; rl=1; RECEIVE_GPGLL(1000); cmd_lcd(0x01); RECEIVE_GPS(); rl=0; delay_ms(500); cmd_lcd(0x01); SEND_STR("AT"); SEND_CHR(0x0D); delay_ms(500); SEND_STR("AT+CMGF=1"); SEND_CHR(0x0D); delay_ms(500); display_lcd("SENDING SMS..."); SEND_STR("AT+CMGS="); SEND_CHR('"'); SEND_STR("9948900106"); SEND_CHR('"'); delay_ms(500); SEND_CHR(0x0D); delay_ms(500); SEND_STR("\r\n"); SEND_STR("SHORT CKT OCCURED AT"); SEND_STR("\r\n"); delay_ms(500); i=1; while((REC_BUFF[i++]!=',')||(j++<1)); j=0; SEND_STR("LT:"); while((REC_BUFF[i]!=',')||(j++<1)) SEND_CHR(REC_BUFF[i++]); SEND_STR(" LG:"); i++;j=0; while((REC_BUFF[i]!=',')||(j++<1)) SEND_CHR(REC_BUFF[i++]);
SEND_CHR(0x1A); cmd_lcd(0x01); cmd_lcd(0x80); display_lcd("X-: delay_ms(2000);
Y-:
");
} if(x>180) { cmd_lcd(0xC0); display_lcd("ACCIDENT OCCURED"); mtr=1; rl=1; RECEIVE_GPGLL(1000); cmd_lcd(0x01); RECEIVE_GPS(); rl=0; delay_ms(500); cmd_lcd(0x01); SEND_STR("AT"); SEND_CHR(0x0D); delay_ms(500); SEND_STR("AT+CMGF=1"); SEND_CHR(0x0D); delay_ms(500); display_lcd("SENDING SMS..."); SEND_STR("AT+CMGS="); SEND_CHR('"'); SEND_STR("9948900106"); SEND_CHR('"'); delay_ms(500); SEND_CHR(0x0D); delay_ms(500); SEND_STR("\r\n"); SEND_STR(" MAJOR ACCIDENT OCCURED AT"); SEND_STR("\r\n"); delay_ms(500); i=1; while((REC_BUFF[i++]!=',')||(j++<1)); j=0; SEND_STR("LT:"); while((REC_BUFF[i]!=',')||(j++<1)) SEND_CHR(REC_BUFF[i++]); SEND_STR(" LG:"); i++;j=0; while((REC_BUFF[i]!=',')||(j++<1)) SEND_CHR(REC_BUFF[i++]);
SEND_CHR(0x1A); delay_ms(2000); cmd_lcd(0x01); cmd_lcd(0x80); display_lcd("X-: Y-:
"); } if(x<140) { cmd_lcd(0xC0); display_lcd("ACCIDENT OCCURED"); mtr=1; rl=1; RECEIVE_GPGLL(1000); cmd_lcd(0x01); RECEIVE_GPS(); rl=0; delay_ms(500); cmd_lcd(0x01); SEND_STR("AT"); SEND_CHR(0x0D); delay_ms(500); SEND_STR("AT+CMGF=1"); SEND_CHR(0x0D); delay_ms(500); display_lcd("SENDING SMS..."); SEND_STR("AT+CMGS="); SEND_CHR('"'); SEND_STR("9948900106"); SEND_CHR('"'); delay_ms(500); SEND_CHR(0x0D); delay_ms(500); SEND_STR("\r\n"); SEND_STR(" MINOR ACCIDENT OCCURED AT"); SEND_STR("\r\n"); delay_ms(500); i=1; while((REC_BUFF[i++]!=',')||(j++<1)); j=0; SEND_STR("LT:"); while((REC_BUFF[i]!=',')||(j++<1)) SEND_CHR(REC_BUFF[i++]); SEND_STR(" LN:"); i++;j=0; while((REC_BUFF[i]!=',')||(j++<1)) SEND_CHR(REC_BUFF[i++]); SEND_CHR(0x1A);
delay_ms(2000); cmd_lcd(0x01); cmd_lcd(0x80); display_lcd("X-:
Y-:
");
} } } float adc_convert (void) { unsigned char byte0,byte1,byte2; int i; float val; CLK=0; CS=1; CS=0; select_channel(); byte0=byte_write_read(A); byte1=byte_write_read(C); byte2=byte_write_read(0x00); CS=1; i=(byte1&0x0f); i=((i<<8)| byte2); val=((i*5.00)/4096)*100; return val; } ////////////////////////////// float adc_convert1 (void) { unsigned char byte3,byte4,byte5; int i; float val; CLK=0; CS=1; CS=0; select_channel1(); byte3=byte_write_read(A); byte4=byte_write_read(C); byte5=byte_write_read(0x00); CS=1; i=(byte4&0x0f); i=((i<<8)| byte5); val=((i*5.00)/4096)*100; return val; } unsigned char byte_write_read (unsigned char a)
{ unsigned char c=0,mask=0x80; do { CLK=1; if(a&mask) DIN=1; else DIN=0; CLK=0; if(DOUT==1) c|=mask; mask>>=1; } while(mask>0); return c; } //////////////////////////// void select_channel (void) { unsigned char x; x=(channel*2)+0x60; A = x>>4; C = x<<4; } void select_channel1 (void) { unsigned char x; x=(channel1*4)+0x60; A = x>>4; C = x<<4; } void init_lcd(void) { cmd_lcd(0x28); cmd_lcd(0x0E); cmd_lcd(0x06); cmd_lcd(0x01); cmd_lcd(0x80); display_lcd(" WELCOME "); delay_ms(500); } void cmd_lcd(unsigned char c) { delay_ms(5); lcd = ((c&0xf0)|0x02); lcd = 0;
lcd = ((c<<4)|0x02); lcd = 0; delay_ms(20); } void lcd_data(unsigned char c) { delay_ms(5); lcd = ((c&0xf0)|0x03); lcd = 0; lcd = ((c<<4)|0x03); lcd = 0; delay_ms(20); } void display_lcd(unsigned char *s) { while(*s) lcd_data(*s++); } ///////////////////////////////////////////////////////////////////////////////////// void integer_lcd(int n) { unsigned char c[6]; unsigned int i=0; if(n<0) { lcd_data('-'); n=-n; } if(n==0) lcd_data('0'); while(n>0) { c[i++]=(n%10)+48; n/=10; } while(i-->=1) lcd_data(c[i]); } ///////////////////////////////////////////////////////////////////// void delay_ms(unsigned int itime) { unsigned int i,j; for(i=0;i
{ unsigned int i=0,j=0; i=1; while((REC_BUFF[i++]!=',')||(j++<1)); j=0; cmd_lcd(0X80); display_lcd("LT:"); while((REC_BUFF[i]!=',')||(j++<1)) lcd_data(REC_BUFF[i++]); //input=REC_BUFF[i++]; cmd_lcd(0XC0); display_lcd("LG:"); i++;j=0; while((REC_BUFF[i]!=',')||(j++<1)) lcd_data(REC_BUFF[i++]); //nput=REC_BUFF[i++]; } /////////////////////////////////////////////////////////////////////////////////// void RECEIVE_GPGLL(unsigned long timeout) { unsigned int i=0; char loop = 1; while(loop) { while(RECEIVE_CHR(timeout) != '$'); if(RECEIVE_CHR(timeout) == 'G') { if(RECEIVE_CHR(timeout) == 'P') { if(RECEIVE_CHR(timeout) == 'R') { if(RECEIVE_CHR(timeout) == 'M') { if(RECEIVE_CHR(timeout) == 'C') { i = 0; do { REC_BUFF[i] = RECEIVE_CHR(timeout); if(i > BUFF_LEN-1) break; } while((REC_BUFF[i++]!=0x0D)&&(i < (BUFF_LEN-2))); REC_BUFF[i-1] = 0x00; loop = 0;
} else loop = 1; } else loop = 1; } else loop = 1; } else loop = 1; } else loop = 1; } } //////////////////////////////////////////////////////////////////////////////////// unsigned char RECEIVE_CHR(unsigned long timeout) { unsigned char temp=0x00; while((!RI)&&(--timeout > 0)); if(timeout) temp = SBUF; RI = 0; return temp; } void GSM_INIT(void) { cmd_lcd(0x80); display_lcd("GSM INITIALIZING.."); SEND_STR("AT"); delay_ms(1000); SEND_CHR(0x0D); } void SEND_STR(unsigned char *s) { while(*s) SEND_CHR(*s++); } void SEND_CHR(unsigned char c) { SBUF = c; //while(TI == 0); delay_ms(100); TI = 0; }
6. Results Whenever accident or short circuit occurs in the vehicle then the device sends message to given mobile device. Message for Major Accident : “MAJOR ACCIDENT OCCURRED AT LT: 240.0000,N LN: 121.0000,E” Message for Minor accident : “MINOR ACCIDENT OCCURRED AT LT: 240.0000,N LN: 121.0000,E” Message for Short circuit: “SHORT CIRCUIT OCCURRED AT LT: 240.0000,N LN: 121.0000,E” This system shows the location of vehicle on the lcd connected to it also just to make sure the working condition of the microcontroller.
Figure 11 output displayed on lcd
6. Limitations of the project : After power on the board, we need to wait about 10 secs before to get accurate accelerometer data from the sensor. After which, the values will begin to stabilize. when moving and rotating the sensor, and apply forces to it, which causes the measurements to fluctuate. The net result is that accelerometer data tends to be very noisy, with brief but significant disturbances. If these can be averaged out, the accelerometer provides accurate results over timescales longer than the noise disturbances.
Existing system do not work if the system itself damaged in the vehicle accident.
8. Scope of future study This Project provides the design which has the advantages of low cost, portability, small size. The platform of the system is AT 89S52 along with accelerometer sensor; GPS and GSM, interfacing which reduces the alarm time to a large extent and locate the site of accident accurately. This system can overcome the problems of lack of automated system for accident location detection. Consequently, the time for searching the location is reduced and the person can be treated as soon as possible which will save many lives. This system will have broad application prospects as it integrates the positioning systems and the network of medical based services. There is a scope for improvement and as a future implementation we can add a wireless webcam for capturing the images which will help in providing driver`s assistance.
9. Bibliography www.8051projects.com http://www.wikid.eu/
[1]The 8051 Microcontroller - Kenneth J.Ayala