One of the projects that I would love to implement this year is a NTP stratum 1 using a raspberry pi and a GPS antenna. Well, the main goal is a little bit ambitious. I want to enter in the NTP poll as stratum 1 (we have in connectical a time server stratum 2 server right now), and also do the same with GLONASS based chip to compare the accuracy of both models.
But, right now I need to start building the first one, a GPS based NTP statrum 1. For that I use a Ublox MAX-7Q chip from HAB suppliers, and as antenna one single SMA model from the same manufacturer.
The initial installation was easy, just plugin the GPS board in GPIO connector and let’s move forward. For the OS I use the image create for the NTPi project of openchaos, which works fine for this chip.
Once connected to the rasp and wait for a couple of seconds for the GPS synchronization (I must say that this model is incredibly fast), I use cgps -s command to inspect what satellites are visible by my antenna:
So, next step is configure PPS source and NTP to use the it as main source for time synchronization.
Once connected to the rasp, I tested the PPS source using ppstest.
# ppstest /dev/pps0 trying PPS source "/dev/pps0" found PPS source "/dev/pps0" ok, found 1 source(s), now start fetching data... source 0 - assert 1411064435.000594220, sequence: 3906 - clear 0.000000000, sequence: 0 source 0 - assert 1411064436.000598888, sequence: 3907 - clear 0.000000000, sequence: 0 source 0 - assert 1411064437.000602658, sequence: 3908 - clear 0.000000000, sequence: 0 ^C
Everything appears to work fine. Time to configure NTP daemon. I use the following NTP config:
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help # Drift file to remember clock rate across restarts driftfile /var/lib/ntp/ntp.drift # coarse time ref-clock, not really needed here as we have LAN & WAN servers server 127.127.28.0 minpoll 4 maxpoll 4 fudge 127.127.28.0 time1 +0.350 refid GPS stratum 15 # Kernel-mode PPS ref-clock for the precise seconds server 127.127.22.0 minpoll 4 maxpoll 4 fudge 127.127.22.0 flag3 1 refid PPS # WAN servers, "pool" will expand the number of servers to suit pool eu.pool.ntp.org minpoll 10 iburst
Note the lines GPS and PPS. The first one use the GPS reference as clock. There are
no much to explain (the ntp.conf (5) man page is really aclaratory), but essentially
I configure two local server using the gpsd interface (the gpsd daemon starts automatically
if you use openchaos image) one use the standard GPS interface and the other the PPS link.
After restart ntpd, and wait a couple of minutes for reaching, I can see both new servers
# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== oPPS(0) .PPS. 0 l 4 16 7 0.000 -2.015 8.087 *SHM(0) .GPS. 0 l 3 16 17 0.000 -11.105 11.233 ptbtime1.ptb.de .PTB. 1 u 49 64 1 88.195 -15.562 0.002 +vps01.roethof.n 22.214.171.124 3 u 41 64 1 80.312 -11.912 2.794 +i2t15.i2t.ehu.e .GPS. 1 u 38 64 1 70.612 -12.175 2.321 +ntp01.srv.cat 126.96.36.199 2 u 42 64 1 59.587 -7.685 2.895 +188.8.131.52 ( 184.108.40.206 3 u 39 64 1 70.919 -12.449 2.945
And that’s all. The following steps are to optimize the configuration to get a good quality time source, measure delays and repeat the experiment with GLONASS one. Stay tuned!