HSMM-Pi Node as a Network Time Server

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:

GPS-1

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:

GPS-2

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.

GPS-3

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:

GPS-4

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).

7 thoughts on “HSMM-Pi Node as a Network Time Server

  1. Looks great, Scott! I installed it last night and have been playing with it. Waiting for a GPS to arrive to test all of the new functionality!

    I noticed a couple other things that I thought might be useful. The first is that the other nodes that show up on the status page are not linked? If I want to manage one of my other nodes I should be able to click on the name and open up the web interface. (Of course to keep with the ‘standard’ you would have to change the default web page on the pi nodes to 8080..

    The other thing I would suggest be added is either an addition to the status page, or another page that shows all of the wifi nodes that are visible to the pi. Not that it is going to make a huge difference with oslrd running, but it is a good informational tool. When I first set mine up I couldn’t figure out why I wasn’t connecting to anyone. I thought maybe my little usb wifi adapter wasn’t working. I finally figured out that I misspelled the SSID. Oops.

    I think that’s it for now. Love it! I have a gps, some new wifi adapters, power supplies, pigtails, and dish antennas coming this week to play with so I will let you know how things go! Now that I have a couple pi’s and a couple WRT54G’s to experiment with I want to start doing some range testing.

    Thanks for all your hard work.

    Drew

  2. Okay! Got the gps in the mail, configured it, and it works as advertised. Great.

    Started playing around with some other options, and noticed a couple things. You will have to confirm as I am also having some trouble with my internet bandwidth the last couple days!

    I reconfigured the apache webserver to not use port 80, and created a new virtual server on port 80 and redirected it to a new subfolder. I then configured a service in hssm-pi to advertise the new service. Works fine. Shows up as an advertised service.

    I then set the pi to WAN mode and after a few disagreements with my dsl router have that working as well. (though it gave me all kinds of grief when my laptop was connected to my dsl router.. I could not seem to get anywhere on the 10. network and name resolution was strange. I chalk that up to the router just not knowing what to do with it. I could access the pi on it’s local address on the lan.

    One thing I did notice that you might want to check is when in WAN mode my http service disappeared from the status page. I could click on services and see the link was still there and it works, but it is no longer on the status page… tried turning wan on and off several times with the same result – switch back to lan mode and it pops up on the status page again.

    That’s all for now!

    Drew

    • Great to hear that the GPS feature was working well. The HSMM-Pi node will not advertise services when the wired interface is configured to run in WAN mode. Did you have success with service forwarding when running as a Gateway node? If so, then I’ll look into modifying HSMM-Pi to announce services when working as a Gateway, too.

  3. I assume that by gateway node you mean that I was using is to give the mesh access to the internet? The only way to do that is to set it to WAN mode, correct?

    When it is in LAN mode my http service shows up on the status page and works fine. When I put it in WAN mode the service still seems to work (if I go to services and click the link), but it is not listed on the status page of the pi. I should have checked to see if it was still advertised on the other nodes, but I didn’t think about it!

    Got my 24 db grid antenna’s today, as well as the pigtails, but I have still not received the usb wifi cards with the external antenna connectors!

  4. “I used the GlobalSat BU-353 receiver (Amazon) and it worked flawlessly; the receiver is priced reasonably at just $32 USD. ” .. from an earlier post.

    I found the same unit on ebay for $23, though, so he may have transposed his numbers!

    Drew

Leave a reply to TC Johnson (@TC_Johnson) Cancel reply