Hey Paul
I'm currently using the custom kernel on the Raspbian distribution. I just connected an external GPS antenna to my Adafruit GPS receiver, so that might further improve the jitter (although I don't think ntpd can go below 0.002?) .
If it makes a difference I run ntpd as root.
The first time I tried running an ntpd server system I tried using a USB GPS Dongle. It tended to have very high jitter, your system seems to be fairing much better than that, well done

.
Would you, by any chance, be willing to give me the code for your web interface? The graphs ? I promise I won't give it to anyone else if you wish and obviously I wouldn't remove your name from it. I'd love to have some stats on my server but I don't really have the motivation to go and work out how to do it

(or rather it isn't a high enough priority at the moment).
On another note, this is my draft guide to re-creating this, so if peterwillcn would like to let me know if this works... that'd be great :
This is a short guide detailing how I got my Pi to act as a stratum 1 NTP server using an Adafruit GPS with PPS output. This same guide should work with almost any other TTL GPS with PPS output.
Firstly, buy a GPS with a TTL UART for NMEA and a PPS output on 3.3V :
http://adafruit.com/products/746 .
You might also want to buy a
u.FL adaptor and
GPS antenna.
Prepare a new Raspberry Pi with a Raspbian SD card installation.
Boot the Pi and prepare it to your liking (set up networking, ssh, etc.)
Download the following :
modules.tar.gz
and
kernel.tar.gz
The above tar.gz files were provided by chrisrpt. They contain custom compiled modules and a kernel image which support PPS on one of the Pi's GPIO pins (GPIO23).
In a suitable directory, extract the contents of the kernel.tar.gz file and move the results into place :
Code: Select all
tar -xvf kernel.tar.gz
mv /boot/kernel.img /boot/kernel.img.old
mv Image /boot/kernel.img
Once again, extract the contents of the modules.tar.gz file :
Now you just need NTPd

.
Get the latest production source code of ntp :
http://www.ntp.org/downloads.html . At the time of this post's writing it was
ntp-4.2.6p5 .
Extract this file : tar -xvf ntp-4.2.6p5.tar.gz
Change into the new directory : cd ntp-4.2.6p5
Configure : ./configure --enable-ATOM --enable-NMEA
Eventually : make
and finally : make install
You may be missing dependencies, if you are configure will tell you.
Edit the init.d script for ntp : nano /etc/init.d/ntp
and add hashes/lines so that you have the following lines :
Code: Select all
#if [ -e /var/lib/ntp/ntp.conf.dhcp ]; then
# NTPD_OPTS="$NTPD_OPTS -c /var/lib/ntp/ntp.conf.dhcp"
#fi
NTPD_OPTS="$NTPD_OPTS -g"
This prevents NTP from listening to your DHCP server, if you have one.
Change the "RUNASUSER" variable to "root".
Press Ctrl + X and press Y to exit and save.
Now remove any references to ttyAMA0 from your inittab :
nano /etc/inittab
Comment the following out so that it looks like this :
Code: Select all
#Spawn a getty on Raspberry Pi serial line
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Once again, Ctrl + X and then press Y to save.
nano /boot/cmdline.txt
Remove any arguments that reference "ttyAMA0" so that the conent of the file looks like this :
Code: Select all
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Edit /etc/ntp.conf and add the configuration for your GPS as well as (optionally) another time source as a backup.
nano /etc/ntp.conf
Example ntp.conf file :
Code: Select all
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 127.127.20.0 mode 24 minpoll 3 iburst true prefer #use ZDA only!
fudge 127.127.20.0 flag1 1 time2 0.350
server 0.pool.ntp.org
server 1.pool.ntp.org
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
Mode 24 restricts ntp to using $GPZDA NMEA outputs only. Mode 24 also specifies the baud rate of the GPS at 9600bps, which is also the default of the Adafruit GPSs.
Finally, connect the following cables :
Code: Select all
GPS PI
------------------------------
GND GND (Pin 6 )
VIN +5V (Pin 2 )
TX RX (Pin 10, GPIO 15)
RX TX (Pin 8 , GPIO 14)
PPS PPS (Pin 16, GPIO 23)
Edit /etc/modules and add "pps-gpio" to the end of the file :
echo "pps-gpio" >> /etc/modules
Create a new file in /etc/udev/rules.d/09.pps.rules.
Populate this file with the following :
Code: Select all
KERNEL=="ttyAMA0", SYMLINK+="gps0"
KERNEL=="pps0", OWNER="root", GROUP="tty", MODE="0777", SYMLINK+="gpspps0"
Restart the Pi.