View unanswered posts | View active topics It is currently Sun Feb 17, 2019 10:24 pm

Reply to topic  [ 3 posts ] 
 Use GPS as Network Time Protocol Source for Utilite-A How To 
Author Message

Joined: Mon Jan 09, 2012 3:16 am
Posts: 351
Post Use GPS as Network Time Protocol Source for Utilite-A How To
I imagine that for most of the time, the majority of Utilites are connected to networks which provide internet connectivity. Accordingly,most Utilite's have access to a range of NTP servers which facilitate system clock initialization and synchronization. However, how does one set and maintain accurate system time in the mobile role or in remote areas where internet access is not available ?

One solution is to use a simple GPS receiver as an NTP source. Here's how.

1. Hardware needed.
A. Utilite
B. GPS receiver (serial or USB interface) (Pulse Per Second Output for
high accuracy) (I am using GlobalSat BU-353)

BU_353.jpg [ 13.15 KiB | Viewed 5175 times ]

2. Packages needed.
A. ntp
B. ntpdate
C. gpsd
D. gpsd-clients
E. python-gps

3. Setup and configuration.
A. Connect gps to Utilite
B. Navigate to /dev directory and find GPS port (my case port = ttyUSB0)
C. Connect to GPS using a terminal program such as minicom. Look for NMEA
output from GPS - will resemble the following:


D. Configure gpsd using: sudo dpkg-reconfigure gpsd as follows:
I. Start gpsd automatically? yes
II. Handle gps receivers automatically? yes
III.Device gps receiver is attached to: /dev/ttyUSB0 in my case
Iv. Options to gpsd: -b --n
v. gpsd control socket path: /var/run/gpsd.sock

E. Run cgps to confirm operation of gpsd. Pay special attention to the parameter Time Offset. It is typically less than 1. If it is a huge number, there is a problem.
cgps.png [ 79.12 KiB | Viewed 5181 times ]

F.Using an editor such as nano, edit the NTP configuration file /etc/ntp.conf as follows:

i. For a non Pulse Per Second GPS receiver add the lines:

# gps ntp
server minpoll 4 maxpoll 4
fudge time1 0.183 refid NMEA

ii. For a Pulse Per Second GPS receiver add the lines:

# gps ntp
server minpoll 4 maxpoll 4
fudge time1 0.183 refid NMEA
server minpoll 4 maxpoll 4 prefer
fudge refid pps

G. Execute the following commands as su:

I. killall -9 gpsd ntpd
ii. ntpd -gN
iii. gpsd -b -n /dev/ttyUSB0
iv. cgps

H. If cgps returns active, normal output then querry ntp using ntpq -p
You should get a listing similar to:

ntpq -p.png
ntpq -p.png [ 42.57 KiB | Viewed 5178 times ]

The line

SHM(0) .NMEA. 0 l 15 16 377 0.000 -16.884 2.868

indicates the GPS is providing time data to the NTP dameon.

A few notes:

1. Shortly after bootup, Utilite uses ntpdate to initially set the system clock. Thereafter, the ntp dameon keeps the clock synchronized to ntp servers including your GPS. Unfortunately, ntpdate will not accept time data from a gps - it only uses ntp servers. Therefore, if you operating where internet service is unavailable, you must manually set the clock to within 4 hours of actual time after bootup. After you initially set the linux system clock, the ntp dameon takes over and uses the GPS time to synchronize the system clock. Please note that if your initial time setting is 4 hours or more different from the actual time, the ntp dameon will not correct the linux system clock to GPS time. The initial setting must be less than 4 hours different form the actual time.

A program called gpsdate is available which will take GPS time and accomplish the initial setting of the clock at boot. Gpsdate basically replaces ntpdate.

See: ... 00004.html

2. Utilite must be connected to a LAN in order for the GPS to function as a time source. If Utilite is not connected to a LAN, the ntp dameon will not run. Therefore, mobile or remote operation will require that a rudimentary network be available.

3. This process can be a bit quirky at times. Don't give up if at first you don't succeed.

Further reading: ... c-gpsd.php ... pberry-pi/ ... pspps.html

Wed Dec 18, 2013 2:15 am

Joined: Mon Jan 09, 2012 3:16 am
Posts: 351
Post Re: Use GPS as Network Time Protocol Source for Utilite-A Ho
Utilite Can Function as an NTP Server for Your Network

Once your GPS and NTP are cooperating, you can setup Utilite as an NTP server for your network. Here's how:

1. Using an editor such as nano, make the following changes to the file /etc/ntp.conf

A. Comment out the line
restrict mask notrust
by adding a # in front.

It should now be
# restrict mask notrust

B. Add the line
restrict mask nomodify

2. Restart gpsd and ntpd as follows:

A. killall -9 gpsd ntpd
B. ntpd -gN
C. gpsd -b -n /dev/ttyUSB0
D. cgps

Utilite is now configured to act as a NTP time server for all computers on the subnet.

The IP address of my Utilite is
Here is an example of a Windows XP laptop using Utilite as a NTP server where the only NTP time source available is the GPS connected to Utilite.

ntpq -p 2.png
ntpq -p 2.png [ 23.6 KiB | Viewed 5145 times ]
Win XP Time.JPG
Win XP Time.JPG [ 30.19 KiB | Viewed 5147 times ]
Thu Dec 19, 2013 3:16 am

Joined: Wed Jun 25, 2014 8:04 am
Posts: 1
Post Re: Use GPS as Network Time Protocol Source for Utilite-A Ho
I've been working on a similar GPS clock project using a Utilite value, GPS timing receiver and connecting a serial LED display. I have had some issues getting the latest version of NTP, 4.2.7, working correctly with the SHM software interface. Older versions of NTP up to 4.2.4 appear fine. Is the SHM interface broken in the latest NTP release? Has anyone else had similar issues with the latest NTP server software?

Wed Jun 25, 2014 8:15 am
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.