This is only a preview of the April 2001 issue of Silicon Chip. You can view 34 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "A GPS Module For Your PC":
Items relevant to "Dr Video: An Easy-To-Build Video Stabiliser":
Items relevant to "A Tremolo Unit For Musicians":
Items relevant to "The Minimitter FM Stereo Transmitter":
Items relevant to "Intelligent Nicad Battery Charger":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
You can buy excellent – and reasonably cheap – hand-held
GPS units these days. So why would you want to add GPS
to a PC? The applications, as they say in the classics, are
limited only by your imagination!
M
ost people are familiar with
GPS: the Global Positioning System run by the United States Government. It allows a
GPS receiver to locate its position
anywhere on the planet by analysing
signals received from a series of orbiting satellites. (For a more detailed
explanation of GPS, see the separate
panel in this article).
Quite a number of hand-held receivers are available at reasonable
prices. These show your position as
a latitude and longitude on an LCD
readout. They’re ideal for bushwalkers, hikers, etc – and fishermen love
them because they can get back to that
secret spot – exactly!
Some of the higher end models
allow the position to be displayed
on a map along with other numerous
features.
But what if you’d like to interface
a GPS directly to your PC or laptop?
Most of the cheaper hand-held units
don’t support an external interface at
all – or if they do, it is an expensive
option.
There is also the question of battery
life (which is normally quite short anyway). If you’d like extended logging of
data, you’re up for yet another add-on
for external power, not to mention an
external antenna if it’s not convenient
to mount the entire unit in a spot that
gives good coverage.
As you can imagine the task of tracking and analysing signals received
from the up-to-12 satellites that can
be in view at a single time is quite a
complex task.
Fortunately quite a number of
OEM (original equipment manufacturer) GPS modules are available that
perform most of the real work and
interfacing one of these modules to a
By PETER JOHNSON
18 Silicon Chip
PC or other serial device is quite easy.
This article describes constructing
such a unit at a cost considerably less
than using a hand-held unit and gives
some pointers on getting some usable
data out of the GPS module once it’s
built.
Why do it?
Linking a GPS unit to a personal
computer is very much the doorway
to countless other applications.
We are not even going to try to list
those applications but anyone who
has ever needed to know where something/someone was at any particular
time, where it/they went from there,
how long it took it/them to get there
and so on . . . they are the types of applications which immediately spring
to mind.
Having a GPS unit in your hand
will tell you where you are (it’s great
The GPS interface sitting on
the keyboard of a notebook PC.
It’s actually upside down so
you can see the GPS module
itself (right side of board). The
active antenna lead connects
on the right side, while RS232
data goes off to a suitable COM
port via the socket on the left.
if you’re lost!). Feeding that data into
a PC then allows it to become really
useful!
Still not convinced? OK, here’s one
application: rally driving. The GPS
unit would know exactly where the
vehicle is and, with the right software,
a notebook PC could “tell” the driver
(ie, in actual speech), what grade corner is coming up, what direction it
takes, obstacles en route, etc. It would
be far more accurate than any human
navigator and wouldn’t make “ouch”
mistakes!
Another? How about delivery drivers, with all “drops” preprogrammed
in to the notebook PC?
Circuit description
The circuit (Fig.1) is quite straightforward as the GPS module undertakes
most of the “real work”. All we require
to interface it is a suitable power supply and a circuit to convert the TTL
serial levels used by the board to the
RS-232 levels used by a PC.
REG1 is a LM-2940CT-5 linear regular used in a standard configuration to
provide the +5V required by the GPS
module and active GPS antenna. Note
that the GPS module consumes around
250mA of current when in operation
so if the unit is to be operated from an
input voltage much above the 6V recommended a heatsink will be required
to dissipate the heat.
IC1, a MAX232, performs conversion from the TTL levels used by the
GPS module to RS-232 levels for the
external interface.
As well as containing a DC-DC converter to increase the voltage levels, the
MAX232 also provides 15kV of ESD
(electrostatic discharge) protection on
the RS-232 interface to provide some
Table 1 – Laipac TF10 GPS Receiver Module Connections
Pin
Function
1 +5V DC Active antenna power
2 +5V DC Power input
3 Battery backup power
4 +3.3V DC Power input
5 Push-button reset, active low
6 Reserved
7 Reserved
8 Reserved
9 Reserved
10 Ground
Pin
Function
11 Host serial data output A
12 Host serial data input A
13 Ground
14 Aux serial data output B
15 Aux serial data input B (DGPS)
16 Ground
17 Reserved
18 Ground
19 1 PPS time mark
20 Reserved
April 2001 19
Fig.1: the interface consists mainly of the MAX-232 RS-232 level converter and
a few power supply components. Battery backup is optional, especially if the
unit is to be continuously powered.
level of protection to the expensive
GPS module.
The GPS module itself plugs into
connector J2 and performs forms the
“brains” of the project. The board
contains the RF front-end to receive
the 1.575GHz signal from the GPS
satellites and an on-board RISC processor running at around 50MIPS to
calculate time differences between
the received satellite signals and
triangulate this into the latitude,
longitude and altitude of the receiver.
The position information and a
very accurate time (each satellite
contains four atomic clocks) are
available through the serial port.
The clock is also available as a
series of 100ms TTL pulses at pin
19 with the time reference being the
negative edge. The time is accurate
to UTC within ±1µs.
parity. Pin-outs for the module are
shown in Table 1.
Configuration commands may also
be sent to the GPS module through
pin 12, the host serial data input,
although for most applications
configuring the GPS module is not
necessary as the default power-on
“command set” instructs the GPS to
send all the information necessary.
Astute readers will pick up that
several connections on the PC board
have been made to the reserved pins
on the module. Why?
While the recommended module is
the Laipac TF10 there is somewhat
of an industry standard known as
being “Rockwell Compatible” and
these modules have similar pin configurations.
This design is capable of also
working with most of these modules,
although because of the large number of variants it is recommended
you carefully check the data sheets
before using a different module with
this project.
For the same reason the project
uses a double-sided PC board when
single sided could have been used
–some modules have the mounting
connector reversed and require
mounting on the top side of the PC
board rather than the bottom.
While modules with the connector
pointing towards the bottom of the
module are probably the most popular, modules with the connector
pointing to towards the component
side are quite popular with some
portable equipment manufacturers
The GPS module
The processed data is available
on pin 11 of the module and is sent
as NMEA sentences (see below) at
4800bps with 8 data bits and no
20 Silicon Chip
Fig.2: the component overlay of the double-sided PC board, from the component side. The blue tracks are on the component side. This board is more
complicated than it needs to be to allow alternate GPS modules to be fitted.
Parts list
Looking straight down on the “normal” component side of this double-sided PC
board: there’s not much to solder here so you shouldn’t have any problems. . .
because they make the design slightly
more compact.
Construction
Mount the TF10 module on the
bottom of the PC board!
I hope that’s got your attention but
if you’re an advanced constructor
you probably often skip the assembly
instructions. It is the only assembly
point that may be different to what
you expect looking at the component
overlay (Fig.2).
As noted the PC board may be used
with a variety of GPS modules, but
the TF10 module supplied with the
kit must be mounted so that the socket points towards the solder layer of
the board, or back the front to what
would normally be expected.
With a TF10 module you may like
to consider using a socket for IC2,
but with some other modules that
mount on top of the PC board that
may not leave enough clearance, so
check the physical requirements of
the particular module first.
Other than that normal construction methods apply. It will be easiest
to start with the 20-pin GPS connector first, followed by the low-profile
passive components such as the
diode and five tantalums. Follow
this with the voltage regulator, D-9
connector, MAX232 IC and finally
the 1000µF electrolytic capacitor.
The TF10 module may secured
to the board using nylon spacers
of 6mm length and 6mm diameter,
along with four 15 x 3mm steel
screws. It is recommended however
that the GPS board not be inserted
until the testing procedure below
has been followed.
Testing and final assembly
For initial testing leave the GPS
board disconnected and apply 6-9V
1 PC board, 108 x 80mm, double
sided, code RCS PJGPS2K1
1 Laipac TF10 GPS module,
SMA right angle, Type 4 OEM
connector
1 20-pin (2x10) female straight
header socket, 2mm centres
1 D-9 female connector, rightangle PC board mounting
1 3-way screw terminal, PC
board mounting
1 TO220 mounting kit
1 3mm screw, 10mm long
4 3mm screws, 16mm long
5 3mm nuts
4 6mm Nylon spacers, 6mm long
4 PC board Nylon supports,
20mm long
Semiconductors
1 LM2940T-5 low dropout
regulator (REG1)
1 Maxim MAX232N RS-232 level
converter (IC1)
1 1N4004 diode (D1)
Capacitors
1 1000µF 16VW electrolytic (C1)
1 0.22µF 10VW tantalum (C2)
4 1µF 16VW tantalum (C3-6)
. . . and there’s even less on the “underside” of the board – just the GPS module
which plugs into the socket you previously soldered underneath.
April 2001 21
Table 2 – Example data received from GPS module
$GPRMC,040055.999,A,4250.5522,S,14718.4910,E,0.08,143.68,060101,,*11
$GPGGA,040055.999,4250.5522,S,14718.4910,E,1,08,1.3,58.9,M,,,,0000*25
$GPGLL,4250.5522,S,14718.4910,E,040055.999,A*20
$GPGSA,A,3,21,29,15,14,25,11,03,31,,,,,2.7,1.3,2.3*3B
$GPGSV,3,1,09,29,85,066,47,21,57,118,48,14,52,126,44,15,37,041,47*73
$GPGSV,3,2,09,31,31,278,46,11,30,231,47,03,20,325,48,25,13,010,44*73
$GPGSV,3,3,09,23,12,097,*4C
$GPVTG,143.68,T,,M,0.08,N,0.1,K*61
See Table 3 below for an example of interpreting the “GPRMC” sentence from
the receiver that contains the time and position information. The example data
is as per the first line shown above.
to the power connector. You will notice on the component overlay there
are two power connections, +6V DC
and battery backup.
The battery backup is optional and
may be connected to a 3V battery to
save the GPS almanac while the main
power is off. This allows the unit to
perform a quicker “warm start” when
power is applied because the unit
will have an idea where the satellites
should be.
Battery backup is not necessary
if you plan to have the main power
source available constantly.
Use a multimeter to check that the
voltage between pin 15 (GND) and
pin 16 (Vcc) of IC1 is 5V (±0.25V),
to confirm that the voltage regulator
is operating correctly.
Once this has been confirmed
give the board a quick check for any
shorted tracks, install the GPS module and attempt to use the module as
described below.
If at any stage you’re unsure if the
GPS module is operating correctly
you can perform a “loop-back” test
by removing the GPS module and
inserting a piece of wire between
pins 11 & 12 on the socket.
This will cause data received from
the serial port to be sent back through
the MAX232 chip to the serial port.
You should be able to connect to the
serial port with a communications
program, such as HyperTerminal,
and see that characters typed are
received back.
Characters being echoed back
should cease once the link is removed, otherwise you either have a
short on the PC board or in the serial
cable. This will confirm that the RS232 converter is operating and the
cable is connected to your PC correctly, although it will not help check
22 Silicon Chip
the communications parameters are
set correctly.
The active antenna
The recommended antenna is supplied with a 5m cable, making it more
than long enough to reach, for example,
a vehicle roof.
Speaking of that, best performance
will be achieved if the antenna is
mounted on a horizontal metal surface (such as a vehicle roof) to act as a
ground plane. In fact, the antenna has
a magnetic base to make mounting on
a vehicle very easy.
Table 3 - Interpreting the GPRMC sentence
DATA
ELEMENT
DESCRIPTION
$GPRMC
Defines this record as “recommended minimum GPS data”.
040055.999
UTC time in format hhmmss.sss.
The example record was received at 04:00:55 UTC (+99ms).
A
“A” indicates valid position calculated,
“V” indicates invalid position.
4250.5522
Latitude in format ddmm.mmmm.
To convert to the more common degrees, minutes
seconds (°, ', ") format multiply the decimal part
(0.5522) by 60 to get the seconds component.
The example is 42°, 50', 33".
S
S indicates south of the equator; N is north of the equator.
14718.4910
Longitude in format dddmm.mmmm.
Convert as for latitude giving 147°, 18' 29".
E
E indicates east of the meridian, W indicates west.
0.08 Speed over ground in knots.
Multiply by 1.852 to get kilometres per hour.
143.68 Course over ground in degrees.
Only accurate when the receiver is moving so bearing
can be calculated from previous position.
060101
UTC date in format DDMMYY,
The example is 6-Jan-2001.
(empty)
Magnetic variation.
Not provided by TF10.
*11
Checksum of the message in hexadecimal.
It is the 8-bit exclusive-OR of all characters between
the “$” and “*” delimiters.
CR/LF Line is terminated with a carriage return/line feed
combination.
Table 4 - Free/shareware
GPS software on the Internet
commlinx.com.au/gps_diag.htm
Name: GPSDiag
Software written by the author
using Borland Delphi that shows
position information received
from the module along with other
information such as speed, altitude, satellite positions and signal
strength. It also displays the raw
data received and is mainly intended as a diagnostic tool to get started.
iliketheinternet.com/gps.html
Name: NMEAgent
Above is the recommended active GPS antenna, available from CommLink
Solutions. Inset at right is the antenna from the opposite side.
If you cannot mount it on a ground
plane you will probably still get adequate signal but it will take longer to
initialise and the chances of errors in
the data are higher.
Regardless of whether it is moun-ted
on a ground plane or not, the antenna
needs to be able to “see” a significant
proportion of the sky with minimal
obstruction from buildings, etc – if it
cannot see the sky, it cannot see the
satellites which it needs to receive
data from.
As a rule of thumb, for best performance at least a third of the sky should
be visible from the location you mount
the antenna. That’s not to say it won’t
work indoors – it possibly will, as long
as you don’t have a metal roof or metallised insulation blocking the incoming
signals.
And note that if you move the
antenna from one place to another
without it being turned on, it may take
a few minutes to store a new almanac
and therefore allow valid data to be
received. During this time you will
receive only a series of zeros for latitude
and longitude.
Connecting to the computer
The female D-9 connector on the
board is configured as a DTE (data terminal equipment). This means the unit can
be connected directly to the serial port
on a PC with a straight-through cable.
Operation of the board with a modem
will require a male-male null modem
cable.
Data is sent at 4800bps with 8 data
bits and no parity and can be received
with any terminal emulator program
such as HyperTerminal supplied with
Windows.
Once the board is connected, powered up and the COM port selected you
should see data being received. For a
while it looks like gobbledegook then,
as the antenna almanac builds, invalid
data (0’s for latitude and longitude)
Screen grab from the
author’s “GPSDiag”
software showing data
coming in from eleven
satellites but only
nine are used (data
quality of others is too
low). As the module
needs only three
data for an initial fix
and one thereafter,
the positional data
(151°18'13.938" E,
33°40'28.56" S) and
other information
here would be
regarded as extremely
accurate.
Somewhat similar to the above
but also allows gathering and averaging of positions over a long period
to obtain a very accurate position
of a fixed location.
maptrax.com.au/freestuff/
Name: Trax 2.2
Australian-produced GPS mapping software that is easy to use
and provides a map of Australia
as part of the installation. The
map provided doesn’t contain a lot
of detail but more detailed maps
may be purchased. The software
is fairly limited but it is an ideal
starting point, being very easy to
install and use.
gpsu.co.uk/index.html
Name: GPS Utility
When you want to get into the
real stuff and start plotting your
positions on a map, this seems to be
the best package around. The free
download has some limitations but
at $US40 for the registered version
it is excellent value for money and
this package is much easier to setup and use than others that provide
as many features. It also works with
a wide variety of maps and you can
“register” your own bitmap, TIF and
JPEG files by providing the known
latitude and longitude of a few
points on the map.
diku.dk/users/elgaard/eps/index.html
Name: EPS – The Elgaard
Positioning System
A Java-based GPS and mapping
system. For those into Java this will
provide an excellent starting point
for other projects but probably won’t
be easy to follow for Java novices.
April 2001 23
These two screen grabs are from the “TRAX 2.2”
software (see overleaf). First screen actually
shows the whole of Australia with Sydney
targeted as our location (gee, just as well it
got that right!). The black crosshairs and red
concentric circles mark our position, while
the blue arrow shows our “course” (obviously
invalid ’cos our office isn’t moving – we hope!)
The second screen shows the only level of zoom
possible with this demo software (yep, we’re
still in Sydney) but if we wanted purchased
more maps, it could go down to street level. The
camera images on the map below, by the way,
show red light and fixed speed camera locations
– your PC can even give you a voice warning as
you approach these when mobile!
and finally, after perhaps a minute or
so, (maybe more if it the first time the
unit has been turned on) data that looks
something similar to that in Table 2 (and
the screen grab overleaf).
The NMEA standard
Confused? Those familiar with GPS
will immediately recognise the data in
Table 2 as NMEA sentences.
This is the standard for GPS communications devised by the National
Marine Electronics Association and is
the universal standard describing how
GPS devices should send data to a host,
such as your PC.
The complete NMEA specification
actually covers quite a range of marine
related devices and as the document is
copyright it must be purchased from
the NMEA.
Fortunately many freely available
sources describe the sentences that
relate to GPS and such information is
widely available on the Internet.
Try using your favourite Internet
search page for the terms “NMEA” and
“GPS” or alternatively the Internet site
http://commlinx.com.au/NMEA_GPS.
htm contains a good overview and
examples of the sentences you’ll most
likely want to interpret.
Those who don’t feel confident reading the NMEA specification and writing
code to communicate with the module
needn’t feel intimidated. The ’net provides a plentiful source of “ready-to-go”
solutions for GPS.
A few pointers to get you started are
shown in Table 4 and in the references.
24 Silicon Chip
References
The NMEA 0183 Standard for Interfacing Marine Electronics Devices.
Published by NMEA, PO Box 3435,
New Bern, NC 28564-3435, USA.
http://www.nmea.org
TF10 Reference Guide. Available
from Laipac Technology Inc, 105
West Beaver Creek Road Unit 207,
Richmond Hill, Ontario L4B 1C6,
Canada. http://www.laipac.com
Peter Bennett’s GPS and NMEA Site.
http://www.vancouver-webpages.
com/peter/
Wheredyageddit?
CommLinx Solutions is the Australian distributor for Laipac GPS & Telephony products. The TF10 OEM GPS module is priced at $176 including GST. A
suitable active GPS antenna with 2-metre lead and SMA connector is $49.95
including GST. A complete kit of components (not including antenna) is available
for $247.50 including GST. See http://commlinx.com.au/products.htm for
more details, fax orders to (03) 6273-5227 or write to CommLinx Solutions, 9
Wattle Avenue, Lutana, Tas, 7009.
The 20-pin OEM connector is also available from CommLinx Solutions for
$5.00 including GST or can be obtained from Farnell electronics, part number
511407. Farnell orders can be placed at http://www.farnell.com.au or by
calling 1300 361 005.
The PC board is produced by RCS Radio and is available as PCB 4981s.
All other components are available from retail electronics distributors.
Global Positioning System
L
ike many of today’s technology breakthroughs,
GPS was originally a military system. Initially four
NAVSTAR satellites, the first launched in 1978, formed
the backbone of the system. As satellites go, they aren’t
very big: about 1.5m wide and 5m long. In orbit (17,450km
out), they weigh only 850kg.
Each satellite contains four extremely accurate atomic
clocks (one second in three million years!). This time information and satellite identification is transmitted on two
L-band carriers around 1.575GHz.
Today there are 24 of these satellites which provide
coverage to every point on the planet. At least three satellites would normally be “visible” from anywhere; more
important areas have up to twelve satellites available from
featureless desert and often in blinding sandstorms. In fact,
which to obtain data.
GPS has been credited with having a decisive role in the
Because the exact position of each satellite is known UN forces’ success.
at any instant in time, a GPS receiver on the ground (or
Most of today’s GPS receivers require an initial “fix” from
in the air, or at sea) can work out precisely how far away
no more than three satellites to establish their position – the
that satellite is by comparing the time-stamped transmitted
Laipac TF10 module used in this project is one such device.
signal to the time it actually received that signal.
Once the signal is received and position determined, it can
Doing the same thing with the signal from a second
keep accurate readings using only one satellite. Therefore
satellite enables the GPS receiver to determine its position
it is ideal in very poor signal areas.
between the two. Adding a third signal enables a location
It can take almost a minute to receive and analyse
to be established; ie, a three-dimensional “fix”.
enough signals to determine position from a “cold start”.
And adding a fourth signal (or more) enables errors to Once the receiver knows where it is, a “hot start” gives a
be virtually eliminated, giving even more accuracy.
position in about eight seconds. While operating,
Design accuracy is within 30 metres of true pothe information is updated about every 100ms.
sition. Until last year, accuracy for “normal” users
The output from the module is data in the
was only 100m because of “selective availability”
form of NMEA-0183 sentences. NMEA
or SA errors, deliberately introduced into the
stands for the National Marine Electronsystem to make it more difficult for non-friendly
ics Association and has become the
armed forces to use.
standard for all GPS data output.
But former US President ClinAn NMEA sentence contains an
ton ordered SA be removed
address field, a data field and a
on 1st May 2000, to allow
checksum.
all users access to the miliWithin the data field can be
tary-precision signal.
such information as latitude
Achieved accuracy is usuand longitude, north or south of
ally better than 30m – many
equator, east or west of 0° meridvehicle identification and
ian, speed over ground in knots,
tracking systems claim to be
course over ground in degrees
Basic Positioning (simplified to one plane only):
able to show on which side of
true, the date and time, and whethif the GPS receiver (at point A) knows it is a
a road a vehicle is travelling
certain time away from the red satellite, it must er the data is vaild or not.
or parked – an accuracy of
By the way, the reason that
be somewhere on the red circle. Similarly, if
at least 10m or even better.
the exact positions of the GPS
it also knows it is a certain time away from
That’s not too bad from
satellites is always known is that
the blue satellite, it can only be where the red
and blue circles intersect (points A & C). If a
17,450km away!
they themselves use signals from
third (green) satellite is added, it can only be at the other satellites to exactly deThe GPS system is fairly
point A. Once it knows it is at point A, even if
unaffected by weather; rain
termine their own position.
the GPS receiver temporarily loses data from
and cloud generally have
And it’s not only the US which
one or two satellites it knows it cannot be at
little impact but wet foliage
has GPS satellites – in 1982,
points B, C or D so it takes its data from one
can cause problems. During
the Russians launched their own
satellite and works with that data until another
the “Desert Storm” war in the
system called GLONASS. Some
comes into view. In the real GPS world, all of
Middle East ten years ago,
newer
GPS receivers can operthe circles are actually spheres, so the system
GPS was used extensively to
ate using both NAVSTAR and
operates in all three dimensions and can
SC
obtain positions in completely
GLONASS.
therefore give height.
April 2001 25
|