From Frotmail Projects
Jump to navigation Jump to search

How to NTP a Raspberry Pi 4 via GPS and PPS This also works on Pi 3.


A GPS with serial connected to the Pi’s serial port, and PPS connected to gpio 18 (physical pin 12 on the GPIO connector) If possible, configure GPS to output GPZDA at 9600 baud. GPSD will find other baud rates, but takes approximately 8 minutes to get to 115200, and 9600 is the first one it tries.

sudo raspi-config

disable serial console login, enable hardware serial port

sudo apt install pps-tools gpsd gpsd-clients python-gps chrony

edit /etc/modules, add:


edit /boot/firmware/config.txt (or /boot/config.txt), add:


edit /etc/default/gpsd, set device to “/dev/ttyS0”, options to “-n -b”

sudo systemctl enable gpsd

edit /etc/chrony/chrony.conf, comment out all servers and pools, add:

refclock SHM 0 poll 0 refid GPS precision 1e-1 offset 0.055
refclock PPS /dev/pps0 lock GPS poll 0 refid PPS precision 1e-9

sudo systemctl restart chrony

Monitor using chronyc sources, or chronyc sourcestats