Raspberry Pi Zero GPS Logger

This page contains (minimal) instructions and sources needed to reproduce the little Raspberry Pi GPS logger I'm currently playing with:

What you need:

  1. A Raspberry Pi Zero W with a case
  2. A USB GPS dongle with a ublox chip, preferably a VK172 dongle as shown in the picture.
  3. A USB battery pack with a micro USB connector.
  4. A USB OTG cable to connect the dongle.
  5. The scripts and libraries in this ZIP archive.

The simplest thing is to get a Pi Zero W starter kit, which typically includes a case and a cable.

Here's a very brief summary of what you need to do:

  1. Install a current version of Raspbian on the Pi (I used Raspian Stretch).
  2. Change the password for the default user. You can start by connecting the Pi to a monitor or TV with an HDMI cable, and hook up a mouse and keyboard through a USB hub, or configure it to allow SSH and connect through a terminal program. There's lots of instruction on the web how to do these things. Note that you'll probably need a mini-HDMI adapter on the Pi side to connect it to a TV or monitor.
  3. Configure the Pi to connect to your WiFi network.
  4. Install any tools that make working with the Pi easier. For Windows users, that may be Samba and a VNC client; for Mac users, I'd suggest to install netatalk, and to configure the VNC server on the Pi so the "Share Screen" button shows up in Finder windows.
  5. Extract the contents of the ZIP archive from above into the /home/pi/Documents/ folder. The scripts and jar files should be directly in your "Documents" folder (not in a "PiLogger" subfolder).
  6. Edit the /etc/rc.local file to add a line that starts the "start_logger.py" script at startup. An example of the rc.local file is included in the ZIP archive, but the changes must be made in the file in /etc/.
  7. Reboot the Pi.

If you've done everything right, the Pi will patiently wait for a USB GPS dongle to be connected, checking every 4 seconds (check the start_logger.py script for details). Once a dongle is connected, a little Java program will be started that configures the ublox chip, and then dumps all the data it gets from the GPS dongle into a file inside the "PiLogger" folder in /home/pi/Documents/. You stop the logging by disconnecting the USB dongle. A couple of minutes later, the Pi will be shut down. Don't pull the power before the shutdown is done - that can corrupt the SD card!

Here's a list of what's in the ZIP archive:

All files are distributed as free software without any warranties. The RXTX library files are covered by the LGPL license as shown here.