[ntp:questions] ESR looking for good GPS clocks

Bruce Lilly bruce.lilly at gmail.com
Thu Mar 8 22:26:27 UTC 2012

On Mon, 05 Mar 2012 20:18:31 +0000, unruh wrote:

> The problem is that parallel ports are far rarer than serial ports these
> days, and even rarer than usb ports. And you would then have to get the
> output of that counter into the computer. A bit more than $100 for the
> whole thing I suspect.

Here's an outline of how this can be easily done for far less than $100 
of hardware: any parallel output for which a suitable driver exists can 
be used. Most general-purpose computers have more than one of these (e.g. 
LED drivers, IR drivers, as well as serial and/or parallel ports).  At 
some time, the computer takes a timestamp, sets an output port line to a 
specific state and takes another timestamp. The two timestamps bracket 
the setting of the output (the output state can be reset at some later 
non-critical time).  A simple microcontroller such as a Microchip dsPIC 
series device does the rest, viz. measure the time interval between the 
aforementioned computer output pin and the GPS PPS timing reference edge, 
read and echo NMEA messages from the GPS serial data, and convert the 
measured time interval into an NMEA sentence which is inserted into the 
serial output along with echoed GPS NMEA sentences.  The computer reads 
the NMEA data (USB is fine as timing of the serial data is not critical); 
the measured time interval is encoded in the NMEA data and the computer 
has before and after timestamps bracketing the output port state 
transition, from which the local clock timing offset to GPS PPS timing 
reference is easily computed. Echoed GPS NMEA sentences provide the date 
and time.  Microcontroller and support components, I/O signal 
conditioning, serial line transceivers, etc. total cost is likely to be 
well under $100 even in small quantities.  Microcontroller requirements 
are modest; a reasonable timer, serial I/O, and enough memory for a 
fairly simple program.

Of course, there are many boards suitable for use as a router (e.g. 
Soekris products) that not only have parallel I/O but also can use the on-
board CPU for timing, eliminating the need for a microcontroller.  And 
interfacing GPS timing receivers to a Soekris board has already been done 
(Google can point you to some examples).

More information about the questions mailing list