background image

See last page for copyright and document info, File: Reeve_GpsNtp-Pi_Setup.doc, Page 28 

10. Final Adjustments and Checks 

 

The convergence time constant of the RPi NTP server is about 1 h. Thus, assuming the GPS receiver has a fix, the 

server achieves close to 0 ms offset of the PPS reference clock in a couple hours. The offset can be followed as it 

changes by repeatedly using the ntpq commands described above.  

 

When the RPi power is first applied and the GPS receiver obtains a fix, the PPS offset after a few minutes will be 

some positive or negative value. Over the next couple hours the offset will move closer to 0.000 ms as the NTP 

daemon learns about the GPS clock characteristics. Many factors are involved so, even after several hours, the 

offset may not be 0.000 ms and some variation will be noted with each query. My lab test systems typically run 

0.000 ± 0.002 ms for the system with the GTop receiver and 0.000 ± 0.005 ms for the U-Blox receiver . 

 

Note: The GPS receivers store the time and satellite ephemeris data in battery-backed RAM. In addition, the 

NTPD uses a 

driftfile

 (location specified in the NTP configuration file) to store the clock frequency offset 

determined by the NTPD. This offset is updated every hour. If the RPi and GPS receiver are power cycled, the 

stored clock data provides very close to actual date and time and the driftfile provides very close to actual 

frequency offset. With these two parameters, the convergence is faster. Therefore, on the first cold-start, 

convergence requires a couple hours after satellite tracking starts but on subsequent starts convergence will be 

much faster.  

 

The PPS is a precise signal with around 10 ns of jitter. On the other hand, the offset of the GPS serial data output 

(GPSD) generally will have much more variation than the PPS because of the variables involved in sending data 

over an asynchronous serial port. However, the GPSD offset can be reduced somewhat by adjusting the GPSD 

reference clock fudge parameter time1 in the ntp.conf file. The initial value used in the ntp.conf file is 500 ms 

(0.500 s). Enter the following to see the present offset; repeat several times over a period of a few tens of 

minutes: 

ntpq -p 

 

Look for the row with remote SHM(0) and refid GPSD. The offset values probably will be different for each 

query. Do a mental average. For values –100 < offset < +100 ms, there probably is no need for adjustment. If you 

consistently see larger negative or positive offsets, the NTP statistics can be used to calculate the average. Let 

the RPi run for at least 4 hours and then at the RPi prompt enter the following series of statements to calculate 

the average: 

awk ‘ 
/127\.127\.28\.0/ { sum += $5 * 1000; cnt++; } 
END { print sum / cnt; } 
‘ < /var/log/ntpstats/peerstats 

 

A moment after the last line is entered, a positive or negative value will be returned. The value is the average 

GPSD reference clock offset in ms and is to be subtracted from the GPSD time1 value in ntp.conf.  For example, 

say the value is –33.573. This means the time1 value for GPSD in ntp.conf needs to be increased by 34 ms from 

+0.500 to +0.534 s. If the value is 33.573, then time1 needs to be reduced by 34 ms to 0.466. To make the 

change, use the nano editor: 

sudo nano /etc/ntp.conf 

 

Содержание GpsNtp-Pi

Страница 1: ...GpsNtp Pi Installation and Operation Guide See last page for copyright and document information...

Страница 2: ...3 Operating System Installation 6 4 Install a Secure Shell Terminal Program 10 5 Basic RPi Setup 12 6 Install and Verify Pulse Per Second PPS 15 7 Install GPS Daemon and Associated Tools 17 8 Enable P...

Страница 3: ...cks to Coordinated Universal Time figure 1 AC Power Adapter Local Area Network Ethernet Power Internet NTP Server using Raspberry Pi Model B Internet Router NTP Client 5 V Optional WLAN GNSS Receiver...

Страница 4: ...are as of February 2015 and do not include shipping The HAB Supplies price includes an active antenna 2 The Adafruit product does not include any hardware for rigidly mounting the GPS daughterboard to...

Страница 5: ...RAM data The battery jumper is a blob of solder covering two small pads It is circled in the images below before left and after right removal with a soldering iron and solder wick Note the incorrect...

Страница 6: ...and specifications are not given by the vendors If a different antenna is contemplated the following guide may be used to select it Polarization Right hand circular Mode Active Impedance 50 ohm Volta...

Страница 7: ...essible after the boards are enclosed Use a jumper from the RPi board to the rear panel where a power connector is installed A small dc dc converter may be installed in the enclosure to convert from s...

Страница 8: ...See last page for copyright and document info File Reeve_GpsNtp Pi_Setup doc Page 6...

Страница 9: ...this image to a 4 GB or larger micro SD memory card as follows Connect a card reader writer suitable for a micro SD memory card to the PC Insert the SD or micro SD memory card into the card reader wr...

Страница 10: ...g the drive letter in My Computer or Explorer and selecting Eject Remove the memory card from the reader writer Memory card installation Insert the micro SD memory card into the slot connector on the...

Страница 11: ...cond Power LED Red ON Timepulse LED Green OFF Power on Fix obtained tracking Status LED Red Flash 1 per 15 seconds Power LED Red ON Timepulse LED Green Flash 1 per second All LED indicators on the RPi...

Страница 12: ...ttings Upper left Screenshot of PuTTY configuration window with the IP address for a test setup Your installation will have use a different address Upper right Upon first connection PuTTY asks for aut...

Страница 13: ...y to remove power from the RPi the RPi must be properly shutdown before removing power just like a Windows PC Never remove power without first shutting down the RPi To shutdown log into RPi as describ...

Страница 14: ...o save and close the editor Similarly replace the name in the etc hostname file sudo nano etc hostname Change the name from raspberry to GpsNtp Pi as in GpsNtp Pi Type CTRL X Exit Y yes Enter to save...

Страница 15: ...tion 1 Expand filesystem Select Option 4 Internationalization Options Option 11 Change Locale en_US UTF 8 UTF 8 Use the spacebar to deselect en_GB UTF 8 UTF 8 Scroll down to en_US UTF 8 UTF 8 and sele...

Страница 16: ...ile Reeve_GpsNtp Pi_Setup doc Page 14 After initial setup sudo reboot Now it is necessary to update the software and operating system These steps may require several minutes sudo apt get update sudo a...

Страница 17: ...the GPS receiver sudo nano boot config txt Add a new line as shown below The value X 4 or 18 depending on GPS board The HAB GPS uses GPIO pin 18 and the Adafruit GPS uses GPIO pin 4 dtoverlay pps gpio...

Страница 18: ...ine if PPS is working first ensure the GPS receiver is in the satellite tracking mode This may require up to 15 minutes from a cold start On the HAB Supplies GPS board the green PPS LED flashes about...

Страница 19: ...d document info File Reeve_GpsNtp Pi_Setup doc Page 17 Also check sudo ppstest dev pps0 If the PPS software module is working output should be similar to shown below with the source 0 lines scrolling...

Страница 20: ...tall GPSD and GPSD Clients sudo apt get install gpsd gpsd clients After installation configure GPSD Sudo dpkg reconfigure gpsd Follow the prompts to Start gpsd automatically Yes Automatically handle U...

Страница 21: ...See last page for copyright and document info File Reeve_GpsNtp Pi_Setup doc Page 19 After GPSD has been configured reboot sudo reboot...

Страница 22: ...enclosed data updates automatically The lower part scrolls as incoming data are displayed Of particular interest in the scrolling data are the GPRMC parameters which show position time and date if nec...

Страница 23: ...stakes sudo service ntp stop sudo cp usr local bin ntp usr bin sudo cp usr local sbin ntp usr sbin Now modify the NTP configuration file to use the GPSD and PPS servers sudo nano etc ntp conf Add the...

Страница 24: ...stics are not required leave the comment character statsdir var log ntpstats The NTP configuration file has several restrict statements with default settings Two in particular require modification Fin...

Страница 25: ...te column shows the local address of the KPPS driver designated 22 rather than its name PPS 0 ntpq crv pn ntpq crv p If you repeat the query command over periods of tens of minutes you should see the...

Страница 26: ...ed purpose of setting flag1 to 1 is for systems where the RTC backup cannot keep the time over long periods without power and the SHM clock must be able to force long distance initial jumps The PPS dr...

Страница 27: ...cond PPS signal either indirectly via the PPS reference clock driver or directly via the kernel interface Source selected included in final set x Source false ticker out of tolerance Source selected f...

Страница 28: ...rag leap seconds file from the Desktop to the new ntp directory Open a PuTTY shell session if not already open and log into the RPi If desired PuTTY can be open from WinSCP in Commands menu Open in Pu...

Страница 29: ...See last page for copyright and document info File Reeve_GpsNtp Pi_Setup doc Page 27...

Страница 30: ...gence requires a couple hours after satellite tracking starts but on subsequent starts convergence will be much faster The PPS is a precise signal with around 10 ns of jitter On the other hand the off...

Страница 31: ...ordinary internet search The preferred client by far is NTP itself The Windows version may be obtained at NTP Win After installation setup the NTP client to use the IP address of the RPi NTP server F...

Страница 32: ...s accessed by the GpsNtp Pi NTP server through an internet connection and access to them is enabled by uncommenting the pool statement in the ntp conf file pool us pool ntp org iburst minpoll 6 prefer...

Страница 33: ...doc Page 31 Note If you plan to add your RPi NTP server to the pool you should not use the pool ntp org alias in the NTP configuration as described above Instead time servers should be hand picked fro...

Страница 34: ...t com products networkscanner NMEA http www gpsinformation org dale nmea htm NTPAcc http www eecis udel edu mills ntp html accopt html NTPHack http lists ntp org listinfo hackers NTPJoin http www ntpp...

Страница 35: ...ve edits 01 Mar 2015 0 7 Additional cleanup for distribution 15 Mar 2015 1 0 Distribution 1 Apr 2015 1 1 Added link to reference clock and enclosure descriptions 21 Apr 2015 1 2 Revised make for ntp 4...

Отзывы: