OK, so I lied. In part 2 we'll actually look at two options for an external GPS: a handheld GPS unit, and a USB-connected GPS mouse. Why both? In part, it's because these are both viable options for developers, and in part it's because I just like to tinker with this stuff. And, I suppose, it's also because USB-connected receivers and data loggers are inexpensive peripherals in case you don't happen to have a handheld GPS receiver lying around the house, so why not talk about both?
Hooking up an external GPS
I'll start by connecting my Garmin* GPSMap 76Cx. This GPS has a serial port connector and it is capable of outputting NMEA data at 4800 baud. The serial port cable has a DB-9 connector, so to attach it to my ultrabook I need a USB-to-serial adapter.
Once plugged in, it shows up as a virtual COM port in device manager:
With the COM port identified, I can launch GPSDirect and configure it to speak with the device. One very convenient aspect of a handheld GPS unit is that you can compare what is on the display with the data that is being collected by GPSDirect. In this case, I had a friend take me out for a drive so that I could monitor the two.
Important safety note: Do not operate a motor vehicle while using a computer, handheld GPS, or any other device that will take your attention off the road!
The next two images show the display on the handheld GPS while the car was in motion. The GPS is reporting a speed of 75.1 kph, and GPSDirect is registering a speed of 40.9 knots (if I had been thinking at the time, I'd have configured the GPS to display speed in knots but I wasn't, so we have to do a unit conversion: 1 knot = 1.852 kph) so the speeds are in sync. Both are also showing a bearing of 91 degrees. Also note that the altitudes are lined up at 56m.
|Garmin GPSMAP 76Cx||GPSDirect|
To show that horizontal position is also tracking, we brought the car to a halt and compared the static location information, shown below. As you can see, the latitude, and longitude both line up. The small differences are due to display precision limits on the handheld device, as well as minor position drift that occurred between capturing the two screenshots.
|Garmin GPSMAP 76Cx||GPSDirect|
What does not agree between the two is the Garmin's EPE (Estimated Position Error), which is what the Windows Location API refers to as "accuracy", and the Precision field in GPSDirect which is the current Dilution of Precision figure. This is because EPE is not part of the NMEA specification, and it's really a best-guess from the receiver based on a number of factors of which only one is the DOP. The DOP is included in the NMEA data since it is a mathematically calculated value derived from the positions of the satellites in view, but it is up to the GPS receiver software to determine its EPE. Different device manufacturers use different models for this which is why EPE/accuracy is really a subjective figure that some would say is all but meaningless. GPSDirect does not attempt to make these estimations, and appears to just pass the raw DOP as its EPE.
Don't put a lot of faith in the accuracy value from the Location API, no matter the data source.
Using a GPS mouse
A GPS mouse is a wired or wireless GPS receiver that does not have its own user interface and requires computer software to interact with it. Almost all modern, wired mice have a USB interface while wireless mice use Bluetooth, but both are still typically serial devices that present themselves as a virtual COM port to the host computer. I prefer using GPS mice to handheld units for this purpose because they tend to be smaller, lighter, simpler, and more power-efficient. You lose the ability to see what the device is doing just by glancing at a display, but for the purposes of software development and even for casual use that is not a huge loss.
There is a bigger problem with using GPS mice, however, and that's satellite reception. Unlike handheld devices, most wired mice are USB-powered while the wireless mice have to share their limited power with the Bluetooth radio. On top of that, their small size leads to relatively compact antennas and less sophisticated electronics. Like most things in life you get what you pay for: a tiny USB device that is powered by the bus may take a lot longer to lock on to satellites, have more trouble holding on to them once it does, and result in poorer quality fixes. Bluetooth mice tend to be weatherproof with a magnetic base so they can be mounted outside, such as on the roof of your car, for better reception but a wired device will probably require a USB extension for optimal placement. Some of the less expensive wired devices will also be indoors-only, meaning the best you can do is place it near a window such as on the dashboard of a car which can severely limit your reception.
In terms of hooking up a GPS mouse to GPSDirect the process is not much different than attaching a dedicated, handheld GPS: you simply connect the device in to the computer, determine which serial port it is attached to, and go. Your product's documentation should tell you the appropriate settings for the COM port (baud rate and so on).
My USB mouse is pictured below, hooked up via a USB extension cable.
This device was bundled with Microsoft* Streets and Trips 2012 with Locator (discontinued: the link will take you to the most recent version which may contain different hardware), and uses a GPS receiver module from u-blox*. It presents itself as a virtual COM port and operates at 9600 baud.
It works very well with GPSDirect.
Just for fun, here's a screenshot from the Bing Maps app on Windows 8, verifying that the Location API in WinRT does see the position data.
As I mentioned earlier, what you lose when using a GPS mouse is a user inteface. Most of these devices come with software that will show you device status and other useful information, but because COM ports cannot be opened by two applications siumultaneously you won't be able to run those in tandem with GPSDirect. It's either one or the other.
What about data loggers?
Some data loggers have a mouse operating mode, but not all of them do. Check the manufacturer's product documentation before spending your money. Caveat emptor.
In Part 3, we'll step through using an Android smart phone as a virtual GPS receiver.
|<-- Back||Next -->|