NTP server using GPS

NTP server using GPS as time source.

Away from any fixed internet connection the Network Time Protocol (NTP) Cannot be used to connect a client to the NPT servers on the internet. Offline you need to provide your own time standard. The proper solution is to install an Atomic clock time standard onboard (today within reach on even a modest budget, see SA.45s Chip or module). The simple solution is to use a USB GPS receiver. This provide a time with a high degree of accuracy. The Pi like systems accept the GPS dongle via the USB port.

The software gpsd provide the functions needed. It is easy to install, with Ubuntu which is commonly used on the PI the commands are simple (as root): "apt-get install gpsd gpsd-clients python-gps". Remember to enable the service so the gpsd start at boot time.

The next step is to set the Pi board up as a NTP server. I used a very small system Friendly ARM NEO to run the NTP server, picture on the left. This is a very small and cost effective system. It accept a single USB connection. The NEO board also support RJ45 Ethernet connection, making it better connected than over wifi.

The NTP need to be set up to use a GPS as the time source. This is done by inserting the following lines to /etc/ntp.conf :

# GPS PPS reference (NTP0)

server 127.127.28.0 minpoll 4 maxpoll 4 prefer

fudge 127.127.28.0 refid PPS

# GPS Serial data reference (NTP1)

server 127.127.28.1 minpoll 4 maxpoll 4

fudge 127.127.28.1 time1 0.9999 refid GPS

And restart the NPT service.

To check if it's working one might use the ntpq utility :

root@NanoPi-NEO:~# ntpq -p

remote refid st t when poll reach delay offset jitter

==============================================================================

*SHM(0) .PPS. 0 l 15 16 377 0.000 -0.122 0.879

SHM(1) .GPS. 0 l - 16 0 0.000 0.000 0.000

GPS is reported and we now have a NTP server on board that provide all nodes on the yacht's net with accurate timing information even when cut of from the internet. It's very nice to have a time server on board with accuracy comparable to an atomic clock.

Bilderesultat for NanoPi NEO