Synchronizing the date and time of a Raspberry Pi to a GPS receiver

In case your Raspberry Pi board is not connected to the internet, the date and time of your Raspberry Pi will not be updated and may drift over time. To enable automatic updating of a Raspberry Pi “isolated” in any place , without network, you can set up an external synchronization by GPS. This solution clearly brings great accuracy!


Once GPS is connected to your Raspberry Pi, the following command should allow you to verify that the data are available.

cat /dev/ttyACM0

The GPRMC frame format is


1 = UTC of position fix
2 = Data status (V=navigation receiver warning)
3 = Latitude of fix
4 = N or S
5 = Longitude of fix
6 = E or W
7 = Speed over ground in knots
8 = Track made good in degrees True
9 = UT date
10 = Magnetic variation degrees (Easterly var. subtracts from true course)
11 = E or W
12 = Checksum

Download GPSDATE the program using git.

if you have not already git on your Raspberry Pi, install it with the command

sudo apt-get install git


git clone

Install the program from the doanload directory and typing the following commands:

cd gpsdate
make all

Now you can use gpsdate to update your system time. Simply with the command:

sudo ./gpsdate /dev/ttyACM0
Local datetime was: 2014-03-16 20:19:06 (CET)
GPS   datetime  is: 2014-03-16 19:19:07 (UTC)
Succesfully updated local time.

For the system to be updated daily, we’ll add a command in the CRON file

sudo crontab -e

Updating the system clock every day at 1:10 am, add the following line:

10 01 * * * /home/pi/gpsdate/gpsdate /dev/ttyACM0

This article is an example of the many resources available for the Raspberry Pi and the repeater controlboard SvxLink Card (svxcard) on the site



2 thoughts on “Synchronizing the date and time of a Raspberry Pi to a GPS receiver

  1. Bonjour,
    J’aimerais savoir quel est le modèle du récepteur GPS compatible avec vos lignes de commande ?

    I would like to know which GPS receiver model is compatible with your command lines?
    Thank you

    1. Bonjour Johann,

      La date et l’heure sont extraites des trames “minimales recommandées” : GPRMC . Cette trame est générée par des GPS communiquants au format NMEA (Lien NMEA 0183 sur wikipedia).

      Hello Johann,

      The date and time are extracted from the “minimum recommended” frames: GPRMC. This frame is generated by GPS communicating in NMEA format ( NMEA 0183 on wikipedia ).


Leave a Reply

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