W9AB

Linux and GPS Time for FT8

2023-05-20 by Rev. Fr. Robert Bower

One thing you need for FT8 is accurate time on your computer. Keeping accurate time on a Linux based operating system is quite easy today when your computer has access to the Internet. Most modern Linux distributions do it out of the box and no one thinks about it. Even in the field if you are connected to the Internet your computer has an accurate time, if it doesn't, with a quick trip to https://time.is/ you can set your computer's time with a click of a button.

What if you don't have Internet access? The answer is to use GPS time. Linux distributions use either timedatectl/timesyncd, chrony, or NTP. The first listed option timedatectl/timesyncd does not support GPS time which leaves chrony or NTP. Either chrony or NTP will work. On my laptop that I use for POTA is currently running Ubuntu 22.04.1 LTS so I opted for chrony.

Things you will need for this project is a GPS dongle or an Android phone running GPSshare and a computer running a Linux based operating system.

If you use a GPS dongle use one with Pulse-Per-Second (PPS) support for the most accurate time. You can use one without PPS but your time may not be as accurate.

Rather than using a dongle I used my Android phone running GPSshare. My phone's GPS does not support PPS so if you go the phone route realize you will not have as accurate time as with a GPS that supports PPS.

What I did was based on https://ubuntu.com/server/docs/network-ntp.

  • I installed the following packages gpsd, chrony, pps-tools, and gpsd-clients on my laptop.
  • I installed GPSshare on my phone.
  • I already had this done but turn on ADB on your Android phone and install the ADB packages for your distribution.
  • If you are running Apparmour disable it for both gpsd and chrony. There seems to be a bug that currently is not fixed in apparmor that blocks gpsd and chrony.
  • Use the following guide to setup Share GPS via UBS http://jillybunch.com/sharegps/nmea-usb-linux.html
  • Edit /etc/default/gpsd to include the following if you use Share GPS.
DEVICES="tcp://localhost:20175"

# Other options you want to pass to gpsd
GPSD_OPTIONS="-n -b"

# Automatically hot add/remove USB GPS devices via gpsdctl
USBAUTO="true"
  • Edit /etc/chrony/chrony.conf to include the following if you are using GPS Share
refclock SHM 0 refid GPS precision 1e-1 offset 0.9999 delay 0.2
driftfile /var/db/chrony/chrony.drift
bindcmdaddress /var/run/chrony/chrony.sock
rtcsync
  • Assuming you have Share GPS setup, running, and connected to your laptop, now restart both gpsd and chrony with sudo systemctl restart gpsd.service and sudo systemctl restart chrony.service
  • Now run chronyc sources

You should see something like

MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
#? GPS                           0   4   177    24    +21ms[  +17ms] +/-  200ms
^- prod-ntp-4.ntp1.ps5.cano>     2  10   377   29m   +833us[ +833us] +/-   48ms
^- prod-ntp-3.ntp4.ps5.cano>     2  10   377   969  +1240us[+1240us] +/-   51ms
^- prod-ntp-3.ntp1.ps5.cano>     2  10   377   777  +1991us[+1991us] +/-   51ms
^- alphyn.canonical.com          2  10   377   998  +1522us[+1522us] +/-   80ms
^- 44.190.40.123                 2  10   357  1004  +2127us[+2127us] +/-   81ms
^- pittsburghmusicals.com        3  10   377   982  +1632us[+1632us] +/-   58ms
^+ ntp1.glypnod.com              2  10   377   923  +1561us[+1561us] +/-   37ms
^+ ntp01.nonexiste.net           1  10   377   21m  -6787us[-6787us] +/-   32ms
^- srv11.dynamigs.net            2  10   377   33m    +24ms[  +24ms] +/-  125ms
^+ triton.ellipse.net            2  10   377    44  +6464us[+6464us] +/-   27ms
^- srcf-ntp.stanford.edu         2  10   377   26m  +4218us[+4218us] +/-   37ms
^* 140.99.199.146                2  10   377   31m   +501us[ +539us] +/-   14ms

Showing that the GPS is providing time and everything is working.

Remember using your phone's GPS works but a GPS dongle with PPS support would even be better.