Home > Debian, GPS, Hardware, Howto, Linux > Setting up NTP to update from a GPS

Setting up NTP to update from a GPS

This is just a quick how to to setup NTP to update from a GPS

Installing software needed for the GPS:

# apt-get install gpsd

If you already not done so connect the GPS to your computer you are wanting to run it on and confirm it is connected with lsusb

$ lsusb
Bus 001 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

My GPS is a USGlobalSat BU 353

Now to configure gpsd:

# dpkg-reconfigure gpsd

There just a few questions to answer.
First question asks you if you like to have gpsd to start at boot, I answered YES
Second question ask you to were tthe GPS is connected, in my case it was /dev/ttyUSB0
The last 2 questions I just left them as is.


Now to setup up NTP to talk / work with the GPS by editing the /etc/ntp.conf file:

# nano /etc/ntp.conf

This is what I added to my /etc/ntp.conf file:

# LinuxPPS: GPS + PPS (comment out either this whole section or the next one)
server 127.127.20.0 minpoll 4 prefer
fudge 127.127.20.0 flag3 1 flag2 0

# SHM: PPS filtered mean (comment out either this whole section or the previous one)
server 127.127.28.0 minpoll 4 prefer
fudge 127.127.28.0 refid PPS flag3 1

Now we need to restart the ntp server cause the changes we made to the /etc/ntp.conf file

# /etc/init.d/ntp restart
Stopping NTP server: ntpd.
Starting NTP server: ntpd.

To confirm that the ntp server is using the GPS all we have to do is:

$ ntpq -p

And you get and output like this:

$ ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+mirror.dedicate 128.250.36.3     2 u   52   64   17   55.405    3.643   0.953
+203-80-162-195. 203.12.160.2     3 u   54   64   17   43.456    2.346   0.880
*a.pool.ntp.uq.e 130.102.152.7    2 u   51   64   17   57.256    1.722   2.129
+ds001.hostingsh 128.250.36.2     2 u   50   64   17   55.676    1.890   1.111
xGPS_NMEA(0)     .GPS.            0 l   10   16  377    0.000  -827.80   7.543
 SHM(0)          .PPS.            0 l    -   16    0    0.000    0.000   0.001
 192.168.1.255 .BCST.            16 u    -   64    0    0.000    0.000   0.001
 192.168.2.255 .BCST.            16 u    -   64    0    0.000    0.000   0.001

These couple lines show that the NTP server is using the GPS to update the time:

xGPS_NMEA(0)     .GPS.            0 l    5   16  377    0.000  -827.34   8.128
 SHM(0)          .PPS.            0 l    -   16    0    0.000    0.000   0.001

That is all that is needed to be done, now you don’t need to be connected to the internet to update you NTP server to have the correct time.

References:
NTP Documentation
GPSd

Categories: Debian, GPS, Hardware, Howto, Linux Tags:
-->

Bad Behavior has blocked 34 access attempts in the last 7 days.