Raspberry Pi GPS

GPS Data logger using a BerryGPS

This post explains how to log GPS data from a BerryGPS or a BerryGPS-IMU and then how to plot this data onto Google Maps and many other maps E.g. OpenStreet, WorldStreet, National Maps, etc..

Raspberry Pi GPS

1. Setup GPS

Follow the instructions on this page to setup your Raspberry Pi for a BerryGPS. Ensure GPSD is set to automatically start and confirm that you can see the NMEA sentences when using gpsipe;

pi@raspberrypi ~ $ gpspipe -r


2.  Automatically Capture Data on Boot.

We will be using gpspipe to capture the NMEA sentence from the BerryGPS and storing these into a file. The command to use is;

pi@raspberrypi ~ $ gpspipe -r -d -l -o /home/pi/`date +”%Y%m%d-%H-%M-%S”`.nmea

-r = Output raw NMEA sentences.
-d = Causes gpspipe to run as a daemon.
-l = Causes gpspipe to sleep for ten seconds before attempting to connect to gpsd.
-o = Output to file.

The date the file is created is also added to the name.

Now we need to force the above command to run at boot. This can be done by editing the rc.local file.

pi@raspberrypi ~ $ sudo nano /etc/rc.local


Just before the last line, which will be ‘exit 0’, paste in the below line;

gpspipe -r -d -l -o /home/pi/`date +"%Y%m%d-%H-%M-%S"`.nmea

Reboot and confirm that you can see a .nmea file in the home directory.

Every time the Raspberry Pi is rebooted, a new file will be created.

BerryGPS Raspberry Pi GPS

3. Collect Some Data

Go and collect some data. For this post, I used a BerryGPS sitting on a Raspberry Pi Zero and I placed it on the dashboard of my car.

I was able to confirm that the GPS had a fix by the flashing fix LED.


4. Plot the Data

We will use www.gpsvisualizer.com to plot the route we collected.

www.gpsvisualizer.com will accept the raw NMEA file.

Its best to use this page as you will be able to configure a number of options before you upload;



Below is an example route I took;
GPS plotter



5. Change Track Data

GPS Visualizer can colorize your tracks according to speed, elevation, or some other unit.
This can be done by selecting the value in the drop down box highlighted below;

GPS Visualizer Raspberry Pi
Track Option


Here are two examples, speed and number of satellites;

Number of Satellites


6. Display the Route in Google Earth

www.gpsvisualizer.com can also be used to convert your raw NMEA file into a GPX file which then can be used with Google Earth.

Raspberry Pi Google Earth

Use this URL;

Upload you file, make sure GPX is selected and then click the convert bottom. Once converted, download the GPX file and open it in Google Earth.

To show the elevation and speed profile of your route within Google Earth, right click the track and select ‘Show Elevation Profile’

Raspberry Pi Google Earth
Google Earth Elevation and Speed Profile

Leave a Reply

Your email address will not be published. Required fields are marked *