by Chris Halsall
GPS receivers are demonstrably the best available tool for figuring out where you are. Now that selective availability (SA) has been disabled, the accuracy of civilian-class SPS GPS is perfectly adequate for sea and land travel. As a result, consumer-level technology deployment continues to accelerate, resulting in lower costs per unit.
A fairly major limitation of GPS receivers, however, is the small amount of memory that stand-alone units have to store coordinates -- most modern GPS units can store only 500 or so "waypoints." The software that runs on a GPS receiver is also generally closed, so customization is not an option. And asking if a GPS unit runs Java usually results in blank stares.
Fortunately, GPS receivers can be interfaced with mobile computing solutions by way of the National Marine Electronics Association (NMEA) standard for marine instrumentation. Now up to NMEA 0183 version 2.3, data is presented as a series of sentences in a 4800 baud 8N1 data stream compatible with computer RS-232 interfaces.
What's done with the data at that point is, of course, then entirely in the province of the software developer. Just about anything can be done. How much money do you have to throw at the solution?
Plot of a road trip, with coastal outlines.
A common example is the use of a laptop computer to plot a sailboat's position on a dynamic chart. For vehicle drivers, both laptop and embedded solutions include databases of streets, and they can give advanced notice of where to turn next when navigating the streets. The expanded memory capacity of mobile computing devices allows for many more position samples to be recorded for playback and analysis.
Another area that will add exciting (and in some cases, scary) possibilities is ubiquitous mobile networking. With a way to transmit the GPS receiver's data, mobile assets can be monitored for misuse (over-speed or off-route) as well as safety. Police and emergency vehicles, along with taxi cabs in high-risk areas, are already beginning to use this ability, as are organizers of sailing races.
Lastly, the electronics industry's perpetual march toward the tiny and inexpensive continues in the GPS receiver space as well, with complete receivers the size of small electrolytic capacitors now possible. Because of the future requirement for cell phone companies to be able to physically locate callers to 911, GPS receivers are expected to start showing up in mainstream cell phones in the very near future. Specialty models are available right now.
Imagine what you could do -- or better yet, what you can start experimenting with now...
The GPS data-stream -- the details
Most consumer level GPS receivers, either handheld or vehicle mounted, "expose" current data by way of the NMEA 0183 standard. This is presented on a 4800 baud serial stream, with neither hardware nor software handshaking enabled -- you just hope you get most of the data.
NMEA 0183 defines a set of sentences, each beginning with a five-letter name preceded with a dollar sign. The name is made up of a two-letter "talker" ID, followed by a sentence ID. Examples include "$GPGGA" and "$GPGGL." The sentence will usually terminate with a "*" followed by a simple checksum. Some manufacturers also provide additional proprietary sentences -- most notably Garmin.
Each sentence "payload" consists of a comma-separated series of values, the number and meaning of which are defined by the standard. Two excellent resources for the NMEA standard and definitions of the sentences, along with some of the Garmin sentences, are at Glenn Baddeley's GPS pages and Peter Bennett's GPS and NMEA site.
The sentences of most interest to programmers are defined below. Note that GPS receivers may not transmit all of these sentences, so care must be taken when purchasing a receiver for a particular application.
Provides time (UTC), latitude and longitude fix, and altitude. In addition, quality of fix, number of satellites used in fix, horizontal dilution of precision, and height of geoid above WGS84 ellipsoid is provided. If differential GPS (DGPS) is in use, the station's ID and time since last update is also presented.
This sentence was introduced with NMEA 0183 version 2.00, and combines into one what previously required several sentences. Not all receivers present data in all fields.
Provides time and latitude and longitude fix. Superseded by GPGGA with version NMEA 0183 version 2.00.
Gives time and latitude and longitude fix. Also, true and magnetic track (heading) and ground speed, along with magnetic variation.
Gives true and magnetic track (heading) and ground speed. Note these values are derived from successive positions, and so are only valid while in motion. A GPS receiver never knows its orientation, and can only infer such information.
Presents IDs of all satellites used for the fix calculation, as well as the fix mode (No Fix, 2D, 3D), and whether it's being forced into that mode manually, or if it was an automatic selection. The position, horizontal, and vertical dilution of precision (PDOP, HDOP, and VDOP, respectively) are also given.
Is a list of the satellites in view, including their elevation and azimuth (rotation) from the receiver's location, and the signal strength. Up to four satellites can be presented in one sentence, and as many sentences as are needed are transmitted in sequence.
Current date and time, including local time-zone differences, with a high resolution. Not a common message. Because of its accuracy, this is often used with ntp deamons (or similar) to provide precise time alignment for (geographically) large networks. Examples include the Internet, the phone networks, and national/international power grids.
There are several other messages which might appear in a stream, depending on the settings and modes of the GPS. A full block of sentences is transmitted at a time, usually at a 1Hz frequency. If there is too much data to transmit in one second, the GPS unit will wait until all the data is sent and then wait for the next top-of-second. Thus the rate may drop to once every two seconds, or three, etc.
For this reason, it is usually advisable to disable any messages that aren't needed, as they're consuming valuable bandwidth! In particular, if a route is currently enabled, several sentences dealing with the next waypoint will be included. Unless needed, routes and waypoints should be disabled. Exactly how this is done is specific to each GPS unit, and I suggest you refer to your receiver's manual.
Acquiring some data...
For the mobile examples, I used a Palm Pilot IIIxe to capture hiking data and a lap-top to capture road-trip data. At roughly a megabyte of data per hour from a typical unit, a Palm Pilot IIIxe can acquire about 7 hours of uncompressed data, with modern laptops good to go for several months.
Coastal outlines improve visualization.
The physical connection between the GPS receiver and the laptop computer is made with a cable you either make yourself or pay a surprisingly high price for from the manufacturer. The cables are wired to be compatible with DB9 style serial ports of PCs.
To connect the Palm Pilot, the same PC cable will be compatible with the Palm modem cable if you have one, or the normal cradle cable (or mobile version) combined with a null-modem adapter. If you're building your own cables, you may decide to have two versions, one for use with the Palm's mobile cradle cable and another for use with laptops.
A third common configuration is a permanently wired installation in a building, with a cable running to the GPS or only to the antenna on the roof. While usually used in order to provide accurate time code to a server, it can also be a handy warning during office parties -- when the building starts to oscillate to the tunes, it's time to turn it down!
For Palm software, two main classes exist -- ones that simply log the data for later use, and others which use or display the data immediately in real time. Free examples for logging include File-X-Fer and GPS TrackLogger, or any transfer utility that can capture and retransmit serial data.
A few examples for immediate processing include PilotGPS, tzgps and NMEA Mon. Solutions are available that display full real-time location on a map, but only from commercial suppliers. The Palm's ".3" secret shortcut is handy to know about, disabling the automatic power-off feature if the software doesn't do this itself. Beware of other "." shortcuts, however; their use is rather dangerous.
For full mobile PCs, a wide range of software is available. Something as simple as minicom or another serial communication program can be used to capture data for post-processing. On the other hand, several versions of GPS broadcast deamons exist, which allow multiple clients to access a GPS. See GPSd and NMEA Server as examples.
airport.gps - GPS Track - Road trip to the airport.
wander.gps - GPS Track - 23 hour plot of a stationary receiver.
victoria.gps - Outline - Canada's vacation hotspot.
lowerisland.gps - Outline - An island on the far west coast.
There are several sample files included in the adjacent sidebar for examination and used in the program found at the end of this article. These have been acquired by four different GPS units over the course of several months.
An important note: GPS receivers provide fixes relative to a map datum, which can be set. The default is the World Geodetic Survey, 1984 (WGS 84). However, if using the GPS with an existing map (either electronic or traditional), the GPS unit must be set to match or significant errors will result.
An excellent resource for extracting coastal outlines in WGS 84 Datum is the US Geologic Survey's Coastline. The data is not in NMEA format, however, so a filter is required to translate into NMEA. An example Perl script, ll2nmea.pl was written for our purposes. This inserts GPGGA messages with "999999" as the datestamp whenever the plot should be broken, which our program watches for. This allows islands and other non-continuous outlines to be plotted.
Pages: 1, 2