International Journal
on Marine Navigation
and Safety of Sea Transportation
Volume 4
Number 3
September 2010
289
1 INTRODUCTION
Data transmission using a small volume of data in
mobile means is a relatively simple and mastered
technology today. If the mobile means is equipped
with a GSM modem and GPS receiver then the au-
tomatic means placed in a vehicle can respond to
commands coming from the control centre. The pa-
per presents results of the possible technical solution
realized by the authors. The GPS receiver provides a
data set that can be appropriately selected by the us-
er. If one needs to know geographical position, time,
date, velocity, course, then the GPS sentence with
the GPRMC prefix may be used. Setting of the GPS
receiver for reception of just the given sentence only
simplifies problem solution. The transfer speed has
been set to 19200 bps (for the M35 Siemens cell
phone) corresponding to the GSM transfer speed
(standardly set to 4800 bps).
2 OEM GPS RECEIVER AND NMEA
PROTOCOL
One of the problems to be solved results from exist-
ence of two sources of data signal that are switched
over by the automaton to one control center. If we
want to activate corresponding automaton placed in-
side the vehicle, by default the modem must be set to
GSM communication. Once the arrival message (for
the sake of simplicity only one recommended and
known symbol) has been evaluated the automaton
switches over the communication channel to the
GPS source. The GPS receiver works permanently
despite data is not valid (analyzed by the user).
As mentioned before each GPS receiver generates
a set of data ordered into so called sentences accord-
ing to the NMEA protocol. This protocol provides
data expressed in ASCII code that can be shown di-
rectly at computer monitor without any formatting.
The user must set the serial link (RS232) to the
transfer rate of the GPS receiver. The maximum
speed of data update by GPS receiver is 1 second
however the user may choose a longer interval
(Černý & Steiner 2003).
Each GPS receiver sentence starts with the $
symbol. This flag helps to identify beginning of the
sentence. Information content of the sentence fol-
lows the prefix GPRMC (Garmin). Individual data
in the sentence is separated by the “,” (comma sym-
bol, in the ASCII code the value 2Ch). Particular da-
ta can be evaluated based on the number of these
symbols. As an example we can choose 80 symbols
of the GPRMC sentence including the flag. Thus a
part of the sentence is stored in the memory of mi-
crocomputer. After switching the communication
source back to the default state content of the given
part of memory may be transferred to the control
centre where transaction is being finished and ob-
tained data processed. As a result we can find out if
the vehicle goes in a required direction (according to
the oriented map), is standing or moving, breaking
the speed limit etc.
The GPRMC contains following information at
first 80 positions:
GPS-based Vehicle Localisation
A. Janota & V. Koncelik
University of Žilina, Faculty of Electrical Engineering, Department of Control &
Information Systems, Žilina, Slovakia
ABSTRACT: The paper describes the processor-based equipment designed for the purpose of traffic means
localisation. Data transmission is realised through GSM modem as a standard component of GSM phones.
Control station gets a data set from GPS receiver based on the given command and identification through SIM
module. Data is used to determine exact time, transaction date, geographical position, instantaneous velocity
as well as azimuth. After transferring data into digital map the operator can observe a place of traffic means.
Transaction requires transmission of minimal data volume (ca 80 Byte) which is a minimal load for created
mobile phone connection. The paper describes essential technical details characterizing the developed equip-
ment and obtained experience.
290
the $ flag, followed by
GPRMC, followed by the 1
st
separator ”,”
Time (given in UTC), followed by the 2
nd
separa-
tor “,”
Data validity, followed by the 3
rd
separator “,”
Latitude, followed by the 4
th
separator “,”
Half-world sign, followed by the 5
th
separator “,”
Longitude, followed by the 6
th
separator “,”
Half-word sign, followed by the 7
th
separator “,”
Velocity in knots, followed by the 8
th
separator
“,”
Movement course (azimuth), followed by the 9
th
separator “,”
Data, followed by the 10
th
separator “,” .
Numbers of symbols of particular data is not giv-
en intentionally since they may be different accord-
ing to the type of GPS receiver.
Table 1. Conversion of ASCII symbols to the displayable data
set of the GPRMC sentence in the NMEA protocol.
___________________________________________________
$ G P R M C , 2
ASCII 24 47 50 52 4D 43 2C 32
___________________________________________________
1 2 1 2 9 2 9 ,
ASCII 31 32 31 32 39 32 39 2C
___________________________________________________
A , 4 9 1 5 . 6
ASCII 41 2C 34 39 31 35 2E 36
___________________________________________________
0 7 , N , 1 2 3
ASCII 30 37 2C 4E 2C 31 32 33
___________________________________________________
1 0 . 5 3 7 , W
ASCII 31 30 2E 35 33 37 2C 57
___________________________________________________
, 0 0 0 . 0 , 3
ASCII 2C 30 30 30 2E 30 2C 33
___________________________________________________
6 0 . 0 , 1 1 1
ASCII 36 30 2E 30 2C 31 31 31
___________________________________________________
1 9 8 , 0 2 0 .
ASCII 31 39 38 2C 30 32 30 2E
___________________________________________________
3 , E * 6 8
ASCII 33 2C 45 2A 36 38
___________________________________________________
The indicated procedure makes the technical so-
lution possible with minimum requirements to pro-
gramming environment of the automaton. In any
case the GPS receiver must be configured according
to GSM communication needs. For the GPS OEM
receivers by Garmin there is a cost-free programme
available that can be used to set individual parame-
ters of the GPS receiver. As an example the GPS18
module can be mentioned. Running the file
SNSRCFG.EXE the corresponding serial COM port
is being set, interconnected to the GPS receiver
(COMM preamble). The preamble contains two
items: SETUP and CONNECT. Once the communi-
cation has been activated the programme is search-
ing for the transfer rate of the GPS receiver which is
indicated at the monitor showing gradually all trans-
fer rates tested. When choosing the preamble CON-
FIG, two items are available: SENSOR CONFIGU-
RATION and NMEA SENTENCE SELECTION.
The items GET CONFIGURATION FROM GPS
and SEND CONFIGURATION TO GPS are acti-
vated as soon as the communication link has been
established using the command CONNECT. All sen-
tence preambles generated by the receiver and re-
peated periodically within adjustable intervals are
transferred to the computer using GET CONFIGU-
RATION command. If all received parameters are in
accordance with user requirements the programme
run may be terminated (EXIT in the FILE menu).
More frequent requirement concerns about chang-
ing some GPS receiver parameters. If some of them
are different from intended the preamble SENSOR
CONFIGURATION can be chosen and data pro-
posed according to the planned purpose. Number
and type of GPS receiver sentences may bet set
through the preamble SELECT SENTENSES. Data
prepared in this way can be sent to the GPS receiver
using the preamble SEND CONFIGURATION TO
GPS as the last step of the configuration process.
The chosen options can be re-called by the preamble
VIEW, item NMEA TRANSMITTED SENTENC-
ES when the GPS receiver generates data according
to new conditions. Newly established parameters are
kept in the GPS receiver even after disconnecting
the power supply.
If parameters of the GPS receiver cannot be mod-
ified or the GPS receiver is made by a different pro-
ducer (G symbol in the GPRMC preamble means
Garmin) the automation programme must be adapted
in the following way. The transfer rate is standardly
set to 4800 bps. The user must respect this fact and
adapt the communication transfer rate to new condi-
tions. If the receiver repeats sending more sentences
of the NEMA protocol the programme for receipt of
required data must be adapted. If we insist on check-
ing the sentence check-sum (always generated by the
GPS receiver) this is also possible at the expense of
receiving the whole sentence. If data is to be validat-
ed just at the first reception, analysis of data follow-
ing the second symbol “,” must be performed. The
indication “A” confirms validity of data, all other
combinations denote invalid data (most often “V”).
All data from the GPS receiver are provided in the
ASCII format. All newly defined parameters become
valid after the reset (switch-off and and-switch-on)
of the GPS receiver.
Software simulating the NMEA protocol seems to
be a very effective tool for laboratory tests (without
need to have the physically moving means with the
GPS receiver and GSM modem). The program
(GPSsimul) is licensed and its current version makes
generation of 50 sentences of the NMEA protocol
possible only. The simulator then continues genera-
tion of chosen protocol sentences but without send-
ing them to the serial port (number as an optional
parameter). Older versions of the programme
291
worked without this limitation. In addition, the user
can chose a type of the NMEA protocol sentence,
geographical position, elevation above sea level,
speed, course, repeat interval and check sum. The
clock and date is taken over from the computer
where the software is installed. The user defines
time shift to UTC provided by the GPS. The soft-
ware is also a very useful aid when solving problems
related to dynamics of elaborated GPS data. Based
on the given speed and course it generates relevant
geographic coordinates that are transmitted via serial
link. In this way one is able to substitute the real
GPS receiver that usually does not work inside
buildings and if provides some data it is of static na-
ture. Figure 1 shows the software window with pa-
rameters modifiable by the user (indicated with ar-
rows) or through the item SETUP SCREEN.
Figure 1. Control window of the GPSsimul programme.
The Figure 1 shows symbolically simulation of two
types of sentences of the NMEA protocol (GPRMC
and GPVTG) with a second data generating. The
simulated speed is 5 knots with the course 201 de-
grees. Geographical data is generated and shown in
the first line. Time data represents the UTC from 14
hours 09 minutes 34 seconds to 14 hours 09 minutes
40 seconds on date 26 Nov 2008.
3 GSM MODEM
Work with the GSM modem assumes use of AT
commands. Since there a lot of them only selected
commands used in the application are mentioned
here. Certain problems arise when working with
GSM terminals. Transfer rate of the computer is
19200 bps (valid for the used Siemens M35 model).
If we use the GSM modem it is also necessary to set
activation of the SIM module from computer (in-
struction AT+SCIM = number of SIM card). After a
certain time the activation is confirmed with OK, or
according to the previous command ATV0(ATV1).
All this is realized at the transfer rate 9600 bps via
wireless GSM channels. Some GSM modems do not
enable permanent setting of some parameters. In that
case each interruption of power supply re-call de-
fault values that do not need correspond to our inten-
tion. It is mostly a matter of the S0 value of the mo-
dem register, specifying a number of rings after
which the receiver circuits of the GSM are automati-
cally activated. This value is usually set to 000
which indicates no response of the receiver to ring-
ing. The transmitter then (after a certain time) indi-
cates absence of the carrier frequency (or announces
there is no answer). The value kept in the S0 register
292
can be found using the preamble ATS0?. The answer
given by the GSM modem is for example 000. It
means that the modem will not answer the incoming
call (Končelík 2004a, b).
Table 2 shows example of listing of actual data
from the GPS receiver through the wired modem at
the rate 19200 bps with requirement from the centre
to send data via GSM wireless link. Table 2 also
contains information about who creates the data,
whether the user or the modem or the GPS receiver.
Table 2. Sample of data listed by the automaton.
___________________________________________________
User | atdtXXXXXXXXX
Modem | CONNECT
GPS Rec. | $GPRMC,070436,A,4912.1986,N, 01845.
3541,E, 000.0,207.1,220108,003.3,E*7E
Modem | OK (based on the +++ user-choice)
User | ath
Modem | OK
___________________________________________________
The first data following the comma (in the GPS
sentence) declares UTC. Time shown in the upper
table gives the value 7 hours, 4 minutes, 36 seconds.
The 9
th
comma is followed by date declaring 22
nd
January 2008.
Data following the 2
nd
comma indicates validity
of received data. Data following the 3
rd
, 4
th
, 5
th
and
6
th
comma gives geographical data (latitude, North
sphere, longitude, Eastern sphere). The 7
th
comma is
followed by the speed in knots. Knot is a unit not
used in Europe (1 kn = 1.852 km/h). The sample
shows that the GPS receiver is not in movement.
Next data represents course in this case invalid due
to zero speed. Data following the decimal point has
no sense for this purpose. Data following the * sym-
bol gives check sum calculated as modulo 2 sum of
data of the whole sentence from $ flag to * symbol.
Then there are used two symbols CR and LF that are
not displayed (corresponding to the ENTER key).
AT commands for GSM modem control are generat-
ed according to the type of modem.
11.0592
RST
RxD
TxD
X1
X2
P3.3
P3.4
P3.5
GND
2051
A0
Ucc
GND
R1
R2
R3
R4
DR
A1
GND
Ucc
T1
T2
T3
T4
DT
8k2
Ucc
Ucc
GND
E
R/W
RS
1
2
3
4
5
6
7
8
9
10
22
22
1
2
GND
GND
MAX232
11
20
19
18
17
16
1
2
3
4
5
6
7
8
MUX24
+
Ucc
+
+
GND
14
13
12
11
6
5
4
3
2
1
1
3
2
P1.7
P1.5
E
RS
Ucc
Display Unit 4x20
+
GND
Figure 2. The scheme of the circuit for reporting the mobile means movement.
293
4 CONTROL ALGORITHM AND
PROGRAMME INTERPRETATION OF THE
AUTOMATON EQUIPMENT
Programme for operation of GSM and GPS modules
is configured by default to monitor serial link from
the GSM modem periodically. If any symbol is re-
ceived it is compared with the “F” symbol (a flag
defined by the authors). In the case of positive result
of comparison the built-in multiplexer switch over
the signal to data receive from the GPS receiver.
Then data at the serial link from the GPS receiver
module is monitored searching for the flag “$“that
represents beginning of NMEA protocol sentence.
Other symbols received are being stored in operation
memory of the microcomputer. Special attention is
paid to observing number of commas, separating in-
dividual data of NMEA sentence having a different
length. The 2
nd
separator is followed by data ex-
pressing validity of data of the sentence in question.
If the programme evaluates the symbol “A” (ASCII
symbol 41hex) next reading is continued, followed
by storing data in operation memory of the micro-
computer. Reading cycle can be performed in two
ways. If we know amount of data in advance the
reading cycle may be pre-set exactly. Otherwise, the
programme is waiting for the symbol ending the sen-
tence (0Dh, 0Ah). Then data flow is re-directed back
to the serial link of the communication modem that
is still in the CONNECT state, sending data from the
operation memory of the microcomputer to the in-
formation source that initiated connection. If data
from the GPS receiver appears at the monitor then
connection is terminated with the sequence +++
(modem response is OK) followed by the command
ATH (end of transaction). If we want to continue
with getting new data in dosing interval under exist-
ing connection, the symbol “F” is sent again.
If the GPS receiver provides invalid data it is not
transmitted but the title INVALID DATA is gener-
ated. Solution of such a situation depends on the us-
er of stationary equipment. Either transaction may
be terminated or new data of the NMEA sentence
may be asked by sending the “F” symbol. The prob-
lem of versatility of the application consists in the
fact that each GSM communicator may have differ-
ent parameters used to set its operation (what is not a
problem in the control centre). In mobile means the
required data must be pre-set in advance. Automaton
for establishing connection to a selected phone num-
ber has no chance to use variant solution. Despite
the number of instructions for establishing of pre-
defined GSM connection is relatively low the indi-
vidual parameters must be set in advance according
to the particular type of the GSM modem.
START
98h=0
yes
no
98h=1
A=99h
yes
no
A=#$
R0=#30h
R2=#71
R1=#0
yes
98h=1
no
98h=0
A=99h
A=#”,”
@R0=A
inc
R0
r2=r2-1
r2=0
yes
no
inc R1
R1=2
98h=1
yes
yes
yes
no
98h=0
A=99h
A=#”A”
dptr,#notice2
yes
no
no
clr a
a=20h
a=@a+dptr
99h=a
99h=1
no
yes
99h=0
inc 20h
a=20h
a=#20h
yes
no
a=#”@”
99h=a
99h=1
no
yes
99h=0
a=#0dh
99h=a
99h=0
99h=1
no
yes
STOP
no
Figure 3. Flowchart for reading the GPRMC GPS sentence and
for storing data from the address 30h
294
Figure 3 shows the flowchart describing the pro-
cedure of reading the GPRMC GPS sentence and
storing data from the address 30h. Validity of is
checked. In the case of invalid data the message IN-
VALID DATA is communicated.
Technical solution is quite simple and in addition
to GSM and GPS modules it requires a microcom-
puter, multiplexer, converter of TTL to RS232.
More detailed information is out of scope of the pa-
per. As far as the electronic circuitry is concerned
equipment for vehicle localization is the same as for
monitoring of the vehicle movement (Figure 2). The
only differences are in software of the control unit.
START
Running
Hyperterminal
Calling
ATDTyyyyyyyyyy
Receiving RMC
yes
no
Sending F
Preamble
CONNECT
yes
no
Receiving RMC
Another RMC
needed?
yes
no
Sending F
Receiving RMC
Sending +++
Sending ATH
Flag OK
yes
no
yes
no
Flag OK
STOP
Figure 4. Control algorithm applied when received information
about vehicle movement.
Figure 4 shows the control algorithm describing
situation when information about vehicle movement
has been received. Both diagrams shown in Figure
3-4 correspond to the used processor Intel 51 (Valá-
šek 1989). Usage of a different kind of processor
may require changes in presented algorithms.
5 CONCLUSIONS
Getting data from GPS receiver makes possible to
realize other applications that generate messages in
the event that a vehicle is changing its position
(compared with the original condition). Nonzero
speed activates the GSM modem when the automa-
ton performs calls and connecting to the centre with
continuous service. Operator in this centre gets in-
formation in the form of actual sentence of the
GPRMC and based on its parameters adequate
measures can be taken.
Figure 5 shows the example containing particular
data that can be used to find out where the mobile
means is located, including its time and speed data.
atdt0904901578
CONNECT 9600/RLP
GPRMC,140700,A,4913.5322,N,01847.0990,E,023.
0,275.9,130408,002.9,E*7A
OK
ath
OK
Figure 5. Example of application of described principle.
ACKNOWLEDGEMENTS
The paper was prepared under support of the Slovak
Grant agency VEGA, grant No. 1/0023/08 “Theoreti-
cal apparatus for risk analysis and risk evaluation of
transport telematic systems
”.
REFERENCES
Černý, J. & Steiner, I. 2003. GPS od A do Z. Prague, eNAV,
s.r.o.
Končelík, V. 2004a. Nové trendy ve vývoji bezpečného odpo-
jovače. In Proc. of the OK04, Strážnice.
Končelík, V. 2004b. Využitie údajov poskytovaných GPS v
mobilných prostriedkoch. In ELEKTRO 2004, Proc. of the
international conference. Žilina.
Valášek, P. 1989. Monolitické mikroprocesory
a mikropočítače. Prague: SNTL..