Last week I received an excellent suggestion from Drew Wood/KF5MMW to have a GPS-equipped HSMM-Pi node serve as a network time server (NTP server) on the mesh network. The GPS signal includes high-precision date/time information, in addition to the geographic location data we’re all familiar with. The HSMM-Pi mesh node runs a daemon called ‘gpsd’ when configured to use a GPS device for location info. The ‘gpsd’ service can provide time information to the ‘ntpd’ daemon that runs on all mesh nodes. The ‘ntpd’ daemon is responsible for keeping the system clock synchronized in relation to reference clock. You can have the ‘ntpd’ daemon on the Pi use the ‘gpsd’ time signal as a reference clock. It’s also possible to have other mesh nodes in the network synchronize against the ‘ntpd’ daemon on the GPS-equipped mesh node. The following steps will show you how.
GPS-equipped Mesh Node
1) Configure the HSMM-Pi node to use a GPS device:
2) Reboot the HSMM-Pi node and verify that it acquires its location using the GPS receiver. Go to the Status page and verify that a globe icon appears to the right of the node name:
HSMM-Pi Node without a GPS Receiver
You might also want to have an HSMM-Pi node that doesn’t have a GPS receiver to synchronize its time to the mesh node equipped with a GPS receiver. This, too, is pretty easy:
1) Configure the HSMM-Pi node to use the GPS-equipped mesh node as an NTP server. Go to the Admin->Network section, and then select the ‘Time’ tab.
2) Specify the IP address of the GPS-equipped mesh node in the NTP server field. I recommend using the IP address (i.e. 10.201.5.3) instead of the hostname (i.e. KK6DCI-3.local.mesh) because the hostname might not be resolvable at the time the Raspberry Pi boots up, and I’ve noticed that the ‘ntpd’ service ignores unresolvable NTP servers.
3) Reboot the Pi as suggested, and that’s it. You can verify that the Pi is getting it’s time from the other node by running the ‘ntpq -p’ command from a shell:
The NTP server on every HSMM-Pi node can function as a server for other devices on the network. This should make it easy to synchronize a large network using just a single GPS-equipped HSMM-Pi node. Pulling the time from a GPS signal would be extremely useful in a scenario where Internet access isn’t available (i.e. natural disaster).