Time Server
Build a stratum-1 NTP time server using the GNSS HAT PPS signal and chrony.
Works with all three HATs. PPS output is on GPIO 5.
NotePPS vs Library Timepulse — Enabling kernel PPS claims GPIO 5. You cannot useIGnssHat::timepulse()from the library while kernel PPS is active. Pick one or the other.
GNSS HAT → PPS (GPIO 5) → /dev/pps0 → chrony → NTP clients
→ NMEA → gpsd → chrony
The GNSS module provides two time references:
- PPS — sub-microsecond edge on GPIO 5 (precise but carries no date)
- NMEA — coarse UTC time in serial data (has date, ~50 ms jitter)
chrony combines both: NMEA tells it which second, PPS tells it exactly when that second starts.
sudo apt-get update
sudo apt install pps-tools chrony gpsd gpsd-clients
sudo nano /boot/firmware/config.txt
Add at the end:
dtoverlay=pps-gpio,gpiopin=5
Reboot:
sudo reboot
sudo modprobe pps-gpio
echo "pps-gpio" | sudo tee -a /etc/modules
Verify:
ls /dev/pps0
sudo ppstest /dev/pps0
Edit /etc/default/gpsd:
START_DAEMON="true"
USBAUTO="false"
DEVICES="/dev/jimmypaputto/gnss /dev/pps0"
GPSD_OPTIONS="-n"
START_DAEMON="true"
USBAUTO="false"
DEVICES="/dev/ttyAMA0 /dev/pps0"
GPSD_OPTIONS="-n"
START_DAEMON="true"
USBAUTO="false"
DEVICES="/dev/ttyACM0 /dev/pps0"
GPSD_OPTIONS="-n"
Edit /etc/chrony/chrony.conf:
refclock SHM 0 refid GPS precision 1e-1 offset 0.0 delay 0.2 noselect
refclock PPS /dev/pps0 refid PPS lock GPS precision 1e-9 prefer
refclock SHM 0 refid GPS precision 1e-1 offset 0.0 delay 0.2 noselect
refclock PPS /dev/pps0 refid PPS lock GPS precision 1e-9 prefer
refclock SHM 0 refid GPS precision 1e-1 offset 0.0 delay 0.2 noselect
refclock PPS /dev/pps0 refid PPS lock GPS precision 1e-9 prefer
Restart services:
sudo systemctl restart gpsd
sudo systemctl restart chrony
chronyc sources -v
chronyc tracking
Look for the PPS source with * (selected) and offset in nanoseconds.
NoteServing Time to LAN — Addallow 192.168.0.0/16(or your subnet) to/etc/chrony/chrony.confto serve NTP to other devices.