1 CHAPTER 1 INTRODUCTION 1.1 TRACKING Tracking of vehicle is becoming a need of the hour for every logistics companies around the world for their fleet management. Goods transported through the road needs to be continuously monitored for their position and informed about the status of the delivery of those goods to the customers. Vehicle tracking is also used to help navigation of drivers in an unknown city by indicating their position in a map along with the place they want to go with the roads and current traffic information on these roads with the help of satellites. The concept of tracking also plays a vital part in determining the position of the theft vehicles and also in tracking of kidnapped children who get lost. In these cases the location of the stolen vehicle or the kidnapped child is determined and alerted the concern person. The key components of this project are GPS module, GSM modem and ATmega324p microcontroller. GPS commonly abbreviated as Global positioning system plays a vital in tracking by providing the location information by retrieving it from a group of GPS satellites. GSM which is abbreviated as Global System Mobile is a mobile standard in this modern era of cellular revolution. The GSM module solves the problem of establishing communication between the tracker and one who is tracked. The microcontroller here controls both the GPS and the GSM units.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1
CHAPTER 1
INTRODUCTION
1.1 TRACKING Tracking of vehicle is becoming a need of the hour for every logistics companies
around the world for their fleet management. Goods transported through the road needs to
be continuously monitored for their position and informed about the status of the delivery
of those goods to the customers. Vehicle tracking is also used to help navigation of
drivers in an unknown city by indicating their position in a map along with the place they
want to go with the roads and current traffic information on these roads with the help of
satellites.
The concept of tracking also plays a vital part in determining the position of the
theft vehicles and also in tracking of kidnapped children who get lost. In these cases the
location of the stolen vehicle or the kidnapped child is determined and alerted the concern
person.
The key components of this project are GPS module, GSM modem and
ATmega324p microcontroller. GPS commonly abbreviated as Global positioning system
plays a vital in tracking by providing the location information by retrieving it from a
group of GPS satellites. GSM which is abbreviated as Global System Mobile is a mobile
standard in this modern era of cellular revolution. The GSM module solves the problem
of establishing communication between the tracker and one who is tracked. The
microcontroller here controls both the GPS and the GSM units.
2
CHAPTER – 2
GLOBAL POSITIONING SYSTEM
2.1. GPS – Global Positioning System The Global Positioning System (GPS) is the only fully functional Global
Navigation Satellite System (GNSS). Utilizing a constellation of at least 24 Medium
Earth Orbit satellites that transmit precise microwave signals, the system enables a GPS
receiver to determine its location, speed, direction, and time. Developed by the United
States Department of Defense, GPS is officially named NAVSTAR GPS. GPS has
become a widely used aid to navigation worldwide, and a useful tool for map-making,
land surveying, commerce, and scientific uses. GPS also provides a precise time
reference used in many applications including scientific study of earthquakes, and
synchronization of telecommunications networks.
2.2. METHOD OF OPERATION
A typical GPS receiver calculates its position using the signals from four or more
GPS satellites. Four satellites are needed since the process needs a very accurate local
time, more accurate than any normal clock can provide, so the receiver internally solves
for time as well as position. In other words, the receiver uses four measurements to solve
for 4 variables - x, y, z, and t. These values are then turned into more user-friendly forms,
such as latitude/longitude or location on a map and then displayed to the user.
Each GPS satellite has an atomic clock, and continually transmits messages
containing the current time at the start of the message, parameters to calculate the
location of the satellite (the ephemeris), and the general system health (the almanac). The
signals travel at the speed of light through outer space, and slightly slower through the
atmosphere. The receiver uses the arrival time to compute the distance to each satellite,
from which it determines the position of the receiver using geometry and trigonometry.
Although four satellites are required for normal operation, fewer may be needed
in some special cases. If one variable is already known (for example, a sea-going ship
3
knows its altitude is 0), a receiver can determine its position using only three satellites.
Also, in practice, receivers use additional clues (Doppler shift of satellite signals, last
known position, dead reckoning, inertial navigation, and so on) to give degraded answers
One of the key features of GSM is the Subscriber Identity Module (SIM),
commonly known as a SIM card. The SIM is a detachable smart card containing the
user’s subscription information and phonebook. Alternatively, the user can also change
operators while retaining the handset simply by changing the SIM. Some operators will
block this by allowing the phone to use only a single SIM, or only a SIM issued by them;
this practice is known as SIM locking, and is illegal in some countries.
7
3.5. GSM COMMANDS USED
COMMANDS DESCRIPTION
AT Initializing SIM Card AT+CSDT Switch ON or OFF detecting SIM Card AT+CMGF Select SMS Message format AT+CSCS Selecting the Terminal Equipment character set
ATE Set command Echo mode ATD Originate call to phone number in memory ATA Answer incoming call
AT+CSQ Signal Quality Report AT+CPOWD Normal Power off AT+CMGS Send SMS Message AT+CMGR Read SMS Message AT+CMGD Delete SMS Message AT+CMGL List SMS Messages from preferred store
Table 3.2:- GSM command list
8
CHAPTER – 4
SHORT MESSAGE SERVICE
4.1. SMS – Short Message Service
Short Message Service (SMS) is a communications protocol allowing the
interchange of short text messages between mobile telephone devices. SMS as used on
modern handsets was originally defined as part of the GSM series of standards in 1985 as
a means of sending messages of up to 160 characters, to and from GSM mobile handsets.
Since then, support for the service has expanded to include alternative mobile standards
such as ANSI CDMA networks and Digital AMPS, as well as satellite and landline
networks.
Transmission of short messages between the SMSC and the handset is done using
the Mobile Application Part (MAP) of the SS7 protocol. Messages are sent with the MAP
mo- and mt – Forward SMS operations, whose payload length is limited by the
constraints of the signaling protocol to precisely 140 octets (140 octets = 140 * 8 bits =
1120 bits). Short messages can be encoded using a variety of alphabets: the default GSM
7-bit alphabet, the 8-bit data alphabet, and the 16-bit UTF-16/UCS-2 alphabet.
Depending on which alphabet the subscriber has configured in the handset, this leads to
the maximum individual Short Message sizes of 160 7-bit characters, 140 8-bit
characters, or 70 16-bit characters.
9
CHAPTER – 5
SYSTEM OVERVIEW
5.1. MASTER – THE TRACKER
Figure 5.1.:- Master Block Diagram
On the master – the tracker side, a GSM SIM 300 modem is interfaced directly
with the personal computer (PC) through the computer’s serial port. A utility is designed
to run on the PC, about which we will take later in this report. The utility is designed to
read data from the computer’s serial port which naturally being the positional values sent
as a text message through the GSM network. Then this data is extracted and used to plot
the latitude and longitude values on a geographical map of the area. The utility is
designed to control the GSM modem on the master’s side. The utility monitors the status
of the SIM in the modem and issues proper commands to extract the message which
contains the positional data.
5.2. WORKING OF MASTER:
The PC is connected to the SIM 300 GSM Modem through a RS-232 interface.
The commands given to the GSM Modem are called AT commands. The PC issues the
AT commands to the GSM Modem through a visual basic utility program running in the
PC. There are five individual nodes connected to the master. The GSM Modem, on
receiving the AT commands from the PC makes a call to the first node. The node
receives the call and gives the location information to the master. While calling the node,
the master waits for a certain timeout period for the node to respond. If the node doesn’t
respond due to the non availability of carrier or due to channel defects, the master aborts
GSM MODEM
SIM 300 RS 232
INTERFACE
PC
10
its call to the first node and makes the call to the next node. In this manner, the master
issues the request to the nodes and gets the location information from each of the nodes.
The master receives the data from the nodes and identifies the node from which it
received this data. The node sends the data to the master only if there is a change in its
position. In such a situation, the latitude and longitude values of the node’s position will
change. If the node is not moving, the node does not send the data to the master. In such a
situation, the master displays the previous location of the vehicle since the node is not
moving. In this manner, the master periodically issues the request to all the nodes and
gets the data from them.
Now, having understood how the master gets the data from the nodes, let us see
the tool used by the master to do its work. We have developed a visual basic utility
program that will run on the PC in the master side giving the AT commands to the GSM
Modem to call the nodes and get the data from them. Now, let us see the description of
the utility program in detail.
5.3. NODE – THE TRACKED
Figure 5.2.:- Node Block Diagram
GPS MODULE
CP3838 M
ICR
OC
ON
TRO
LLER
ATm
ega 324p
GSM MODEM
SIM 300
11
The above block diagram shows the idea of implementation at the node. The
system is as simple as it appears in the diagram. The GPS module CP3838 collects the
information about the position values of the place where it is present. The GSM modem
SIM 300 is used to send the position values collected by the CP3838 to the master node –
The Tracked. . Generally, the GPS receiver generates the seven different formats of data,
such as $GPGGA, $GPGLL, $GPGSA, $GPGSV, $GPRMC, $GPVTG and $GPZDA.
NMEA standard messages commence with ‘GP’, then a 3-letter message identifier.
NemeriX specific messages commence with $PNMRX followed by a 3 digit number.
5.4. Working of Node
The microcontroller ATmega324p is used to control and command both the GPS
and GSM units. The microcontroller collects the position data from the GPS module by
sending the filter command to the GPS module. Among the above data formats, we have
selected $GPGLL data format, because this format only contains latitude, N\S indicator,
longitude, W\S indicator, time and status of the data. Thus, the filter command is used to
request the GPS module to send only the $GPGLL data to the microcontroller. The filter
command used is $PNMRX103, GLL, 2*xx. The data transfer between the
microcontroller and the GPS module takes place through UART 0. The microcontroller
operates on this data by comparing with the previous data and filtering the required
position data alone.
Now, let us see the interface between GPS receiver and microcontroller.
Generally GPS receiver needs 60 seconds for its cold start. So initially microcontroller
generates about 60 seconds delay before reception of GPS data. After the execution of
delay, microcontroller sends the filtering command $PNMRX103, GLL, 2*xx in hex
format as 24 50 4E 4D 52 58 31 30 33 2C 47 4C 4C 2C 32 2A 1E 0D 0A through its
transmission line. This command sets the GPS receiver for sending only $GPGLL data
format in every 2 seconds. Whenever getting the request from master, the received data
from GPS receiver is stored in microcontroller. Generally GPS receiver sends the data
simultaneously. Microcontroller checks three conditions for storing the valid data, 1)the
request received from master, 2)the received data from GPS receiver has originated with
12
‘$’ sign, 3)the received data status is valid. If these three conditions are satisfied, then the
data had been stored in microcontroller. Then stored data had sent to master as SMS
through GSM engine.
Then the microcontroller commands the GSM modem to send this data as a text
message in other terms this position data is sent to other GSM modem on the master side
as a SMS message. The GSM modem is interfaced to the microcontroller through UART
1. This controller, the ATmega324p has inbuilt 2 UART which facilitates the interfacing
of both the GPS and GSM units at the same time and establish a full fledged two way
communication between the GPS and GSM units. The GSM modem uses the AT
commands to send the filtered position data to the GSM modem at the master side.
Now, let us see about the interface between microcontroller and GSM modem.
First we initialize the GSM modem. Microcontroller had sent the three initialization
commands to the GSM modem. 1) “AT+CSDT=1” for auto detection of SIM card, 2)
“AT+CMGF=1” for selecting the message format in text mode, 3) “AT+CSCS= “GSM”
for select the GSM character set in the Terminal Equipment (TE). Whenever getting the
call from master, the microcontroller counts the number of rings received from GSM
modem at the master. After 10 rings, the microcontroller cancels the incoming call by
setting the command “ATH”. If master confirm the node is live, then again made a call to
node. Then microcontroller had sends the stored position data as a SMS to the master
using the command “AT+CMGS= “destination GSM number”,129”\n message (data) and
then control-Z. This is repeated whenever node is requested by master.
13
CHAPTER – 6
FLOW CHART
6.1. FLOW CHART OF MASTER
Flowchart 6.1.:- Working Of Master
START
Initialize the GSM modem using VB utility
Call the desired node
Invoke appropriate delay
Receives the position data from requested node as SMS
If master side
response is “BUSY” If master side
response is “NO
CARRIER”
Track the other node
Get the previous
position data
Compare the position data (latitude, longitude) with database and find the
location.
Plot the vehicle location in the map
END
14
6.2. FLOW CHART OF NODE
Flowchart 6.2.:- Working Of Node
Delay for 60 seconds
Initialize GPS receiver and GSM
START
The node cuts the incoming call to indicate the master that it is live
If no. of rings from master=10
µC receives and store GPS data
µC extracts the position data (i.e. latitude, longitude, UTC Time)
Microcontroller sends the $GPGLL filter command to the GPS module
If GPS data valid
µC sends the position data to the master through the GSM modem as SMS
Wait for further incoming call
END
15
CHAPTER – 7
UTILITY
7.1. INTRODUCTION
Visual Basic is an ideal, event driven programming language for developing
sophisticated professional applications for Microsoft Windows. It makes use of Graphical
User Interface for creating robust and powerful applications. In a GUI environment, the
number of options open to the user is much greater, allowing more freedom to the user
and developer.
This Vehicle Tracking application developed requires access to database where
latitude and longitude values of vehicles position are stored, serial communication to
send signals to GSM modem located at the vehicle to test it and receive data from GSM
modem located at the application end. Thus this application is developed using Visual
Basic.
7.2. DESCRIPTION:
GPS receiver receives data once in every 5 seconds when the vehicle moves. This
received data is transmitted to the GSM modem at the application end by GSM modem at
vehicle end and this transmission takes more than 20 seconds to reach the application end
due to delay in the network. So each received GPS data consumes at least 40 seconds by
the time it gets stored in the database. So to make the tracking appear lively the
application must be triggered to map the received data once in every 40 seconds. This
mapping procedure is placed under this timer sub routine and the Interval property of the
timer control is set to 40 seconds. So every 40 seconds timer triggers the application to
map the received data to show the position of the vehicle.
7.3. SHAPE FILE:
A shape file is a digital vector storage format for storing geometric location and
associated attribute information. Shape files are simple and easy to handle because they
store primitive geometrical data types of points, lines and polygons. A table of record
16
stores attributes for each primitive shape in the shape file. Shape file is actually a set of
several files of which the following three files are mandatory to store core data, they are:
• .shp file- shape format; the feature geometry itself
• .shx- shape index format; a positional index of the feature
geometry to allow seeking forwards and backwards quickly.
• .dbf- attribute format; columnar attributes for each shape.
There are further eight optional files which store primarily index data to improve
performance. The following are the steps to convert a scanned Madurai topological map
to shape file:
• Construct a geo-database with necessary feature class using Arc catalog. A
feature class is a class which contains geographic features of geometric type
(point, line or polygon) and spatial reference frame.
• Geo-reference the scanned image which is in page coordinate to map
coordinates using Arc map.
• Import the geo-database into Arc map.
• Digitize necessary feature from the geo-referenced image.
• Convert the digitized file to shape file.
7.4. DATABASE:
A database is a tool for collecting and organizing information and helps in easy
access to information stored. The Latitude and longitude values of vehicle’s position
collected are stored in database. Time and date values of data received are also stored in
database. This application uses Microsoft Access, because it is a computerized relational
database management system which stores its tables in a single file and it is also easy to
add new data to a database, edit existing data in the database, delete information,
organize and view data in different ways.
17
Database Object:
Vehicle tracking application first opens the database where tables containing
latitude and longitude values are stored. A variable is declared to hold a reference to the
database.
Record Set Object:
A Record set is an object that contains a set of records from the database that
represents a single table which can be used to add, change or delete records. Once the
database is opened, it is required to open the table in the database where latitude and
longitude values are stored. A variable is declared to hold a reference to the table.
Navigating a Record set:
After creating a Record set object, the various Move methods can be used to
navigate through the records in a Record set.
• MoveFirst method moves to the first row in the record set.
• MoveNext method moves to the next row in the record set.
• MovePrevious method moves to the previous row in the record set.
• MoveLast method moves to the last row in the record set.
Adding records:
Latitude and Longitude values collected at various time and date are added to the
database table using AddNew method. Records can also be deleted, updated.
18
CHAPTER – 8
COMPONENTS OF TRACKING
8.1. GPS-CP3838
CPIT GPS module CP3838 is a high sensitivity ULTRA LOW power
consumption cost efficient, compact size; plug & play GPS module board designed for a
broad spectrum of OEM applications. The GPS module receiver will track up to 16
satellites at a time while providing fast time-to-first-fix and 1Hz navigation updates. Its
superior capability meets the sensitivity & accuracy requirements of car navigation as
well as other location-based applications, such as AVL system. Handheld navigator,
PDA, pocket PC, or any battery operated navigation system.
The CP3838 design utilizes the latest surface mount technology and high level
circuit integration to achieve superior performance while minimizing dimension and
power consumption. The module communicates with application system via RS232 (TTL
level) with NMEA0183 protocol.
8.2. MAIN FEATURES
• Built-in high performance NMEX chipset.
• Average Cold Start in 60 seconds.
• Ultra Low power consumption.( CP3838 27mA type @ 3.3V )
• 16 channels “All-in-View” tracking.
• On chip 4Mb flash memory.
• TTL level serial port for GPS receiver command message Interface.