gsm gprs based tracker

39
CHAPTER # 1 INTRODUCTION 1.1 Project background The focus of a GPS based position is to make use of the information of vehicles location. Now a days the world has changed into a global village because of the advancement in communications, but unfortunately in Pakistan we are not taking full benefits of these efficient communication systems and fleet management systems an example of such inefficient system is of our Railways that is still working on the centuries old man handled signaling and operating systems which is very error prone and can easily lead to big mishaps in recent years we have been some disastrous train accidents which took many precious lives. The goal of our project is to make an automated position reporting system that can be installed in the trains or vehicles so that the exact point to point location of the trains or vehicles can be found and send to main control room through GSM technology rapidly. This management system will be helpful in two ways: 1) The management system will be helpful in locating the exact position of the trains or vehicles for keeping a double check on vehicles or trains. Page | 1

Upload: aitzaz-hussain

Post on 18-Dec-2015

27 views

Category:

Documents


0 download

DESCRIPTION

GSM & GPS based car tracker

TRANSCRIPT

CHAPTER # 1

INTRODUCTION

1.1 Project backgroundThe focus of a GPS based position is to make use of the information of vehicles location. Now a days the world has changed into a global village because of the advancement in communications, but unfortunately in Pakistan we are not taking full benefits of these efficient communication systems and fleet management systems an example of such inefficient system is of our Railways that is still working on the centuries old man handled signaling and operating systems which is very error prone and can easily lead to big mishaps in recent years we have been some disastrous train accidents which took many precious lives. The goal of our project is to make an automated position reporting system that can be installed in the trains or vehicles so that the exact point to point location of the trains or vehicles can be found and send to main control room through GSM technology rapidly. This management system will be helpful in two ways:

1) The management system will be helpful in locating the exact position of the trains or vehicles for keeping a double check on vehicles or trains.

2) This system will also be helpful in updating the passengers about the exact location of trains, buses and arrival time and also easy information will be available about cancellation and rescheduling.

Firstly we decided to use the GPS for locating the remote vehicle position and searches for a module that can be used for this purpose finally we got SIM548c which have both GPS as well as GSM module. We used 8041family microcontroller (89S52) for interfacing and sending the GPS data through SMS to user.1.2 Project Summary

We propose it to plan a system enclosed that is used for the advance and the positioning of any transports using the system of world-wide localization (GPS) and the total system for mobile communication (GSM). A GSM modem is used in order to send at a distance ,the position (latitude and longitude) of the vehicle. The modem of GPS will give without interruption to data the latitude and the longitude that the position of the vehicle indicates. The modem of GPS gives many parameters like yield, but only the data of NMEA that exit are read and shown above the visualization to liquid crystals. The same data are sent to the mobile apparatus to the other extremity from which the position of the vehicle it is tax. Data is stored in RAM of microcontroller. The hardware interfaces to microcontroller is GSM modem and GPS Receiver. This design uses RS-232 protocol for serial communication between the modems and microcontroller.

1.2.1 Design hardware tools

Sim548c GPS/GSM module Sim448c EVB board

GPS antenna GSM antenna

GSM cell phone Microcontroller (89S42) Serial cables

1.2.2 Design Software tool

Google Earth

Uvision ProteusCHAPTER # 2GPS

2.1 IntroductionGPS, which means Global Positioning System, is the only method capable to show your exact position on the earth anytime, in any weather, anywhere. The Global Navigation Satellite System (GNSS) is currently the only fully operational system but Russia has GLONASS, China has COMPASS each at changeable stages of development or testing. The GPS system is made up of collection of 24 satellites in 12-hour orbits, orbiting at 10,900 nautical miles, or 20,183 km. Four satellites in each of six orbital planes in a pattern designed to provide worldwide coverage 24 hours a day. A satellite has 12 hour orbital period and an inclination of 44 to the equatorial plane. The collection is designed to give visibility of 6 to 11 satellites at 4 degrees or more above the horizon anywhere in the world at any time. These satellites allow for accurate three-dimensional position and velocity information for users anywhere in the world. The satellites broadcast signal that can be detect by anyone with a GPS receiver. Using the receiver, you can find out your location with great accuracy.Fig .2.1 the NAVSTAR GPS Collection2.2 History of GPSThe GPS system, also sometimes historically known as NAVSTAR was initially developed for the US military back in the 70s although paid and operated by the military the GPS system can offer navigation benefits for civilian use the first of these satellites built by Rockwell international was launched into the orbit in 1978 in that year four satellites were launched to provide an initial system demonstration of the GPS concept.2.3 How GPS WorksThe Satellites, receivers and some of the math involved are highly technical, but the principles behind how GPS works are quite simple. Essentially the system is based on ranging and Trilateration, or a three dimensional form of triangulation.

Ranging: It is determined from the distance to the satellite from the time it takes to receive a signal. The time taken is determined from the code of the signal and accurate clocks used on the satellites. If you know the distance to one satellite than you can determine that your position is anywhere on the surface of a sphere at that distance from the satellite. If you know the distance to two satellites then you can determine your position to be anywhere on the intersection of surface of two spheres, which is a circle, thus reducing the possible area. Knowing the distance to three satellites allow you to determine your position to be anywhere the previous circle intersects with a third sphere and this will be one of two points. It is possible through some mathematics to determine that one of these two points is not on the earth so can be ignored. Thus with distance information from 3 satellites it is possible to determine your position.There are two signals used by the satellites, one on 1227.6MHz, the L2 channel, and the other on 1474.42MHz, the L1 channel. The use of two frequencies is mostly to allow for correction of errors caused by ionosphere delay, propagation time and Dopplers effect.

2.4 Sim548C GPS PartThe Modules GPS part is planned to use L1 Frequency (C/A Code) GPS receiver and perform the entire GPS signal processing, from antenna input to serial position data output. The processing steps involved are:

RF section

In the RF section the GPS signal detected by the antenna is amplified, filtered and converted to an intermediate frequency (IF). An A/D converter converts the analogue intermediate frequency into a digital IF signal.

GPS channels

The received digital IF signal bit stream is passed to the baseband section, where it is fed into the correlates. The function of the correlators is to acquire and track the satellite signals. There are 12 channels used in parallel, with each correlate looking for a characteristic PRN code sequence in the bit stream. Once the correlate has found a valid signal, pseudo range, carrier phase and orbit information can be extracted from the GPS signal.GPS core The on-board processor is running an algorithm that calculates the position, velocity and time [7]. This calculation is called navigation solution. Once the navigation solution is calculated, it can be transformed into the desired coordinate system, e.g. Latitude/Altitude. 2.4.1.1 Serial interface of the GPS part

The GPS part of the module offers two serial interfaces, Allows for different protocols to operate on each port. Serial port A i. 2-wire serial interfaceii. Includes the GPS_RXA (receive) and TXA (transmit) linesiii. Supported baud rate: 1200 -114200bpsbut 4800 - 38400bps is a common rate rangeiv. Protocol: Default NMEA ,4800bps

v. Default output message: GGA,GSA,GSV,RMC,VTG

Update rate: Default 1Hz

vi. Datum WGS84 default (User configurable) [8].Serial port B i) 2-wire serial interface, Includes the GPS_RXB (receive) and GPS_TXB (transmit) lines.ii) Supported baud rate 1200-114200 bps.iii) Protocol: Default none [8].2.4 Data Form on Hyper terminal

Our data which is coming on hyper terminal is in NMEA 0183 format which is a specific format for gps devices, and $GPGGA is the string in this data which we are extracting from this data because in this string latitude longitude are included. We also used this command in order to fetch coordinates.

2.4.1 $GPGGARecommended minimum specific GPS data

$GPGGA,164044.000,3342.8601,N,07304.4436,E,1.,08,1.1,437.9,M,-39.2,M,000*76$GPGGA:

Global Positioning System fix data.

164044.000: Time 3342.8601: Current Latitude.

N: North

07304.4436: Current Longitude

E: East

0 or 1 or 2 Fix Quality (1 for GPS fix) 08 No. of satellites 1.1 (Horizon Dilution of Precision) Relative accuracy of precision437.9,M Altitude-39.2,M Height of geoid00 Time since last DGPS update

0 DGPS reference station ID

*74 Checksum for transmission errors

CHAPTER # 3

GSM

3.1 IntroductionGSM (GLOBAL SYSTEM FOR MOBILE COMMUNICATION formally from Groupe Spcial Mobile) is the mainly admired standard formobile telephony systems now a days.GSM is successful because of multiple reasons including offer superior sound quality but the main advantage of GSM phone is ability to internationalize roaming facility.

3.2 GSM Overview

Cellular is one of best ever increasing telecommunications. During the growth various systems have been developed but without the benefits of consistent specifications but GSM standard resolve all the problems. Global system for mobile communication is most flexible telecommunication system. It is also being superior technology like EGDE and GPRS. GSM system is separated into 3 different parts.3.2.1 GSM Structure OVERVIEW

Specification summary of GSM cellular system

Multiple Access MethodTDMA/FDMA

Duplex TechniqueFDD

Uplink Frequency band933-960 MHZ

Downlink Frequency band890-914 MHZ

Channel Spacing(KHz)200 KHZ

Channel Rate(Kbps)270.833 Kbps

3.2.2 GSM BASICS

Good speech quality Low cost Support internationally roaming Offer ISDN compatibility3.3 GSM LINKUplink:

The radio uplink is the broadcast path from the Mobile Station to a Base Station. In the 900 MHz bank the uplink frequency bank is 890-914 MHzDownlink:The radio downlink is the broadcast path from a Base Transceiver Station to the Mobile Station. In the 900 MHz bank the downlink frequency band 934-960 MHz Both sub-bands the UPLINK (24 MHz) and the DOWNLINK (24 MHz) are divided into 124 hauler or radio occurrence control each spaced 200 kHz apart. The access method used is frequency division multiple access (FDMA). Each radio frequency channel is divided into 8 timeslots. The users transmit in rapid succession, one after the other, each using his own timeslot. This allows multiple stations to share the same transmission medium (e.g. radio frequency channel) while using only the part of its bandwidth they require. So the advantage of the GSM over Analog mobile phone system (AMPS) is that, number of users is 8 times greater than AMPS on a single radio frequency channels.

3.4 Advantages of GSM over Analog system

It has condensed RF broadcast control and protracted battery life. It provides global roaming ability. Protection against scam is an added feature of GSM. It has encryption ability for information protection and confidentiality.

3.6 SIM548C

3.6.1 Overview

SIM 548c is basically designed for global market; it is a Quad-band GSM/GPRS modem that works on frequencies 840/900/1800/1900. It provides GPRS several-slit class 10 potential and wires the GPRS system format. It control via AT commands (GSM 07.07 and 07.04 and SIMCOM enhanced AT commands).

3.6.2 Serial Interface

SIM 548C basically provides two asymmetrical asynchronous serial ports. One of the serial port and another is debug port. The GSM module is considered as a DCE (Data Communication Equipment), following the conservative DCE-DTE (Data Terminal Equipment) connection, the module and the client (DTE) are connected through the following signal.

Serial port: TXD: Send data to RXD signal line of the DTE

RXD: Receive data from the TXD signal line of the DTE

Debug port: DBG_TXD: Send data to the /RXD signal line of the DTE DBG_RXD: Receive data from the /TXD signal line of the DTEChapter # 4AT Commands4.1 Definition It a series of machine instructions, which are used to activate features on an intelligent modem. Developed by Hayes Microcomputer Products and officially known as the Hayes Standard AT Command Set.The Hayes command set is known to be a specific command-language which was originally developed for the Hayes Smart modem (300 baud rate) in 1977. The command set consists of different short text strings which combine together to produce complete commands for different operations which include dialing, hanging up, and changing the parameters of a connection. Most dialup modems follow this Hayes command set.

4.2 AT Command Format

AT is a mnemonic code for ATtention, which is the prefix that initiates each command to the modem. A command line from the AT command set, is a string of characters sent from the customer (DTE) to the modem (DCE) while the modem is in a command state. This command line has three important parts a prefix, a body, and a terminator. The command line begins with the character sequence AT and is terminated by a carriage return. The default terminator used is the ENTER key character. Commands can be entered in upper case or lower case, both are accepted. But both the A and T must be of the same case, i.e., AT or at. The command line interpretation begins after receiving the ENTER key character.The basic commands consist of single ASCII characters, or sometimes single characters proceeded by a prefix character (e.g., & or +), followed by a decimal parameter. Missing decimal parameters are evaluated as 0.

4.3 Types of AT commands

Type of AT commandSyntaxDescription

Test commandAT+=?The modem returns the list of parameters and their value ranges

Read commandAT+?The read command returns the currently set value of the parameters.

Write commandAT+=The Write command sets the parameter values, as required by the user

Execution commandAT+The execution command reads non-variable parameters, which are affected by internal processes in the GSM engine

4.4 AT Commands Used in Project

AT+CMGD DELETE SMS MESSAGERead Command Response

AT+CMGD=? +CMGD

OKWrite Command Description

AT+CMGD= TA deletes the message on the location, given .

Response

OKAT+CMGF SELECT SMS MESSAGE FORMAT CCCD Read Command Response

AT+CMGF? +CMGF:

OKTest Command Response

AT+CMGF=? +CMGF: list of supported s

OKWrite Command Description

AT+CMGF=[] which input and output format of messages to use

Response

OK Parameters

0 PDU mode

1 text mode

AT+CMGR READ SMS MESSAGE

Test Command Response

AT+CMGR=? OKWrite Command Parameters

AT+CMGR= integer type, location number for the, ] message to 0 normal

1 not change status of the specified SMS record

Response

TA returns SMS message with location value from message storage to the TE. It changes the status of the message from 'received unread' to 'received read'

AT+CMGS SEND SMS MESSAGE

Test Command Response

AT+CMGS=? OKWrite Command Parameter

1) If text mode GSM 03.40 TP-Destination-Address

+CMGS= GSM 04.11 TP-Destination-Address

[,] integer type value indicating in the text

text is entered mode the length of the message body

, or in PDU mode (+CMGF=0), the

2) If PDU mode length of the actual TP data unit in

+CMGS= octets

Chapter # 5

Interfacing with 89S52Here we have mainly two different blocks, those are tracking and location viewing blocks in this first we going to know about tracking system. In this project we will place this vehicle tracking system in vehicle. The Block diagram consists of a GPS modem, a GSM modem, a Micro controller, a LCD Display and power supply.

A GPS modem is used to get the signals and receive the signals from the satellites. In this project, GPS modem get the signals from the satellites and those are given to the microcontroller. The signals may be in the form of the coordinates; these are represented in form of the latitudes, longitudes and altitudes.

A GSM modem is used to get the messages from the mobile and as well as reading the message also. Thereafter sending the acknowledgement will be done. After that, GSM will ask GPS for coordinates and then will send them to the concerned authority.5.1 Hardware Components

5.1.1 Microcontroller 89S52

A Micro controller consists of a powerful CPU tightly coupled with memory, various I/O interfaces such as serial port, parallel port timer or counter, interrupt controller integrated on to a single silicon chip.

AT89S52 is 8-bit micro controller, which has 4 KB on chip flash memory, which is just sufficient for our application. The on-chip Flash ROM allows the program memory to be reprogrammed in system or by conventional non-volatile memory Programmer. Moreover ATMEL is the leader in flash technology in todays market place and hence using AT 89S52 is the optimal solution.

We interfaced GPS and GSM devices serially with controller. Controller has only one serial port, so multiplexing is necessary.5.1.2 DM74LS244

Octal 3-STATE Buffer/Line Driver/Line ReceiverWe used 74244 buffer in order to multiplex the serial ports of GPS and GSM. These buffers/line drivers are designed to improve both the performance and PC board density of 3-STATE buffers/ drivers employed as memory-address drivers, clock drivers, and bus-oriented transmitters/receivers. Featuring 400 mV of hysteresis at each low current PNP data line input, they provide improved noise rejection and high fanout outputs and can be used to drive terminated lines down to 133 ohms.5.1.3 Liquid Crystal Display (LCD)

LCD is used to represent the data that has been taken from GPS.

LCD is interfaced to controller through a proper interfacing commands meant for LCD. This will be explained in the code.

5.1.4 Max-233MAX233 (MAX220MAX249 family) line drivers/receivers is intended for all EIA/TIA-232E and V.28/V.24 communications interfaces, particularly applications where 12V is not available.

The MAX233 (MAX220MAX249 family) is especially useful in battery-powered systems, since its low-power shutdown mode reduces power dissipation to less than 5W. The MAX225, MAX233, MAX235, and MAX245/MAX246/MAX247 use no external components and are recommended for applications where printed circuit board space is critical.Here max-233 is used to line drive GPS data so that bit can be fed to microcontroller i.e. at TTL logic, for further processing. Max-233 is used especially because with it there is no need of connecting capacitors as there in max-232.5.2 Software Interface#include

#define port2 P2

sbit rs = P1^2;

sbit rw = P1^1;

sbit e = P1^0;

sbit gps = P1^4;

sbit gsm = P1^3 ;

///////////////////////GPS VARS///////////////

char info[43];

char test[6]={"$GPGGA"};

char comma_position[5];

unsigned int check=0,i;

unsigned char a;

void receive();

void lcd_latitude();

void lcd_longitude();

char msg[35];

////////////////////////GSM VARS////////////////

void text (unsigned char [] ) ;

void setgsm();

void run();

char ms='l';

char read ;

//DELAY FUNCTION

void delay(unsigned int msec)

{

int i,j ;

for(i=0;i