Hardware Reference
In-Depth Information
1.
Type in the following command to open up the
ntpd
configuration file
for editing:
pi@raspberrypi ~ $ sudo nano /etc/ntp.conf
2. Find the predefined block of
server
directives ending with
server 3.debian.
pool.ntp.org iburst
and add the following statements beneath:
# GPS
server 127.127.28.0
fudge 127.127.28.0 time1 0.420 refid GPS
server 127.127.28.1 prefer
fudge 127.127.28.1 refid PPS
3.
Now restart
ntpd
using the following command:
pi@raspberrypi ~ $ sudo service ntp restart
4.
We can verify that the GPS is being used as a time source with the
following command:
pi@raspberrypi ~ $ ntpq -p
You'll have two lines mentioning
GPS
and
PPS
in the
refid
column.
The second line will show activity only if your GPS receiver supports
the more accurate PPS pulse method.
If your
date
command reports a year of 1969 or 1970 (an unset clock),
ntpd
will refuse to set the correct time. This can happen when an
unset clock date has been saved to
/etc/fake-hwclock.data
. You
need to set a date manually using the following command, and then
reboot your Pi:
pi@raspberrypi ~ $ sudo date --set='Mon Jan 1 12:00:00
GMT 2015'
Setting up GPS on boot
Out in the field, we obviously won't be there to start
gpsd
manually, so we need a
way to make it run at boot time. The
gpsd
package does come with a few scripts for
this purpose, but they're not the most reliable and will only autodetect a handful of
GPS models.