You are here

easy GPS NTP server howto

1 post / 0 new
KB9OIV
easy GPS NTP server howto

If you need a source for time and don't have regular internet for your node(s), you can use a GPS dongle to get good enough results.  This is NOT a high accuracy NTP 'stratum 1' option, but should be 'good enough' to milliseconds for your mesh.

First, you need to have a raspberry pi or other linux based computer with a base install, and a GPS that is compatible with pi/linux.
Install some packages to get gps and ntp functionality.
Then, tweak the gpsd and ntp configs to use GPS dongle.

0. Give your pi a static mesh IP assignment on the mesh

1. install required packages on pi (internet needed):
         sudo apt-get install libgps gpsd gpsd-clients ntp

2. remove internet and reconnect pi to mesh as needed

3. on pi, edit /etc/default/gpsd, add/modify this line:

        GPSD_OPTIONS="-n"  

4. reboot pi

5. on pi, run cgps command line program and check output for gps lock

6. if cgps/gpsd does not work or use correct device, specify gps device in /etc/default/gpsd, and reboot.  In my experience, gpsd 'just works'.

7. on pi, edit /etc/ntp.conf
           1. comment out "pool..." lines
           2. add this at bottom of file:
               # GPSD
               server 127.127.28.0 prefer
               fudge 127.127.28.0 flag1 1 refid GPS

8. on pi, restart ntp (/etc/init.d/ntp restart)

9. on pi, check with command line program ntpq -p.  You should see some output regarding 'GPS'.  'Offset' should be 'small'

10. on pi, check time is accurate with 'date' command

11. on another mesh computer, check ntpd availability with windows command line on computer connected to mesh: w32tm /stripchart /computer:[your_pi.local.mesh]

12. configure nodes to use pi for network time. The ntp server entry on main config page at bottom = [your_pi.local.mesh]

13. nodes should have proper time within 0-15 minutes if the pi is accessible on the mesh

14. profit

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer