The march of progress brings much, but where's my serial port?
Your GPS receiver has a serial port, but your computer has a USB port. How are you going to transfer your tracklogs and waypoints? It is true that more GPS units are arriving with Bluetooth and USB interfaces, but most still use the old RS232 serial interface. We can get a serial-to-USB converter that will allow us to use our GPS with Windows, Linux, and Mac USB ports.
Converting USB to serial turns out to be complex, due to the way that USB devices work. Basically the serial-to-USB converter includes a small computer (well, a microcontroller) that translates USB to RS232 and back. Not all serial-to-USB converters properly implement the whole RS232 specification.
Even with this complexity, we can find devices that work. One choice is the BF-810 from BAFO (http://bafo.com). BAFO has drivers for Mac OS X, Windows, and Linux. Another option is to visit our friends at http://pfranc.com. How can you resist people who have this question on their FAQ?
Q6: Are most people cool? (AKA Good?)
A: YES - like maybe a million or more to one!
You can read about the good and the bad things about their adapters at http://pfranc.com/usb/usb.mhtml. They have drivers for Windows, OS X, and Linux. They also provide the custom Gamin connectors [Hack #48] , which allow you to build your own data cables.
The following instructions refer to the BAFO BF-810. However, the same general principles will apply to other devices. You need to install the proper driver software and then determine the name that your operating system gives to that port or device.
5.6.1. Configuring and Using the Serial-to-USB Adapter Under OS X
Download the latest driver from the BAFO driver's page (http://bafo.com/bafo/prodrivers.asp). Decompress the file and install it by double-clicking on ProlificUSBSerial105.pkg.
This should create the serial-to-USB device. You can check that this created the device in a Terminal window:
$ ls -al /dev/cu* crw-rw-rw- 1 root wheel 8, 1 24 Sep 11:24 /dev/cu.modem crw-rw-rw- 1 root wheel 8, 3 24 Sep 11:28 /dev/cu.usbserial0
You want to use the cu.usbserial0 device.
Here is how to read GPS waypoints from a Garmin GPS using GPSBabel on a Mac. The device or file is specified with the -f parameter. In this case, it is -f /dev/cu.usbserial0:
sudo gpsbabel -D9 -i garmin -f /dev/cu.usbserial0 -o gpx -F foo.gpx
This includes the debugging flag -D9, so we will get lots of extra information to help confirm that the transfer is operating correctly.
See [Hack #51] for more examples.
5.6.2. Configuring and Using the Serial-to-USB Adapter Under Windows
Download the latest driver for your version of Windows from the BAFO driver's page (http://bafo.com/bafo/prodrivers.asp). Unzip it and then connect the serial-to-USB adapter. The "Add New Hardware" wizard will likely see the new device. Give the wizard the location of the file that you downloaded and follow the instructions.
Once it is finished, you can also test the GPS connection under Windows by setting your GPS to NMEA mode, and then starting HyperTerminal (Start images/ent/U2192.GIF border=0> Accessories images/ent/U2192.GIF border=0> Communications images/ent/U2192.GIF border=0> HyperTerminal). Create a new connection using com3, and set the speed to 4800 bits per second. You should then start seeing NMEA sentences.
GPSBabel works the same way across the three platforms, with the exception of the operating-system-dependent way that you refer to serial ports. Under Windows, the serial-to-USB adapter maps the USB to a regular COM port: com3 in our example. To fetch waypoints from a Garmin GPS using the serial-to-USB adapter under Windows:
C:> gpsbabel -D9 -i garmin -f com3 -o gpx -F waypoint.gpx
5.6.3. Configuring and Using the Serial-to-USB Adapter Under Linux
The BAFO-810 uses the Prolific PL230 driver. Connect the serial-to-USB adapter while watching the system log in /var/log/messages. It should display "PL-2303 converter detected" and create the device node /udev/ttyUSB0. You should then be able to connect with GPSBabel.
Both of these commands worked in fetching waypoints from a Garmin GPS:
$ sudo gpsbabel -D9 -i garmin -f /dev/ttyUSB0 -o gpx -F foobar.gpx
$ sudo gpsbabel -D9 -i garmin -f /udev/ttyUSB0 -o gpx -F foobar.gpx
With older Garmin GPS units, under all three platforms GPSBabel will sometimes have trouble connecting. This is true even when it is directly connected to the serial port, rather than to a USB adapter. The common error is:
GPS_Packet_Read: No DLE GARMIN:Can't init com3
The port specified will vary with operating system. Under Windows USB it will be com3. A Linux serial port is /dev/ttyS0 (or /dev/ttyUSB0 for USB). /dev/cu.USBserial0 is for a Mac OS X USB port.
If you retry, sometimes four to five times, it seems to finally "get it" and start transferring data.
The -D9 switch to GPSBabel enables the display of debugging information. If you have trouble, try turning your GPS off and back on. Some GPS units will show you the progress of their data downloads and uploads. On the Garmin III Plus, this is displayed under Menu images/ent/U2192.GIF border=0> Setup images/ent/U2192.GIF border=0> Interface. The Garmin Rino does not show the status of the data transfer.
Mapping Your Life
Mapping Your Neighborhood
Mapping Your World
Mapping (on) the Web
Mapping with Gadgets
Mapping on Your Desktop
Names and Places
Building the Geospatial Web
Mapping with Other People