The purpose of this document is to cover the basic design ideas behind the hardware NTP server. It somewhat forms the 'to do' list for the implementation.

System Overview

To implement an NTP server, we need a stable reference clock of a high degree of accuracy. This would typically be an atomic clock of some kind, given not much else will be accurate enough for us to be called stratum 1. With this clock, we answer queries from the network about the current time with a high degree of both accuracy and precision.

Precision is required as network delays must be taken into account. Most easily obtainable reference clocks are accurate, but not precise. That is, they are very reliable about when a particular interval has passed but the resolution of those intervals can be quite coarse. GPS, for example, only provides 1s of precision, while being very accurate about when that is (within 200ns, in fact).

This means we'll need to implement our own clock with greater precision, and align it (and keep it aligned) against the accurate reference clock.

For GPS, we have an additional problem - the GPS time data is provided over a serial connection some time after the actual event. To provide a more accurate idea about when the time presented over serial actually was, some GPS devices have a dedicated clock pulse signal. This means we need to follow the following chart to align our clock.

  1. PPS signal is received by microcontroller, fires interrupt
  2. Interrupt saves the current local clock for comparison later
  3. Wait for GPS to send serial burst containing "current" time
  4. Compute difference between "current" time as reported by GPS, and saved local clock
  5. Slew clock by difference.

If we save our local clock time at the point the PPS signal is noted, then we only need to care about the difference between it and the recieved time later. How much later is no longer important, because we are comparing our clock at that moment, with the GPS clock at that moment.

(The serial data should always contains the time the GPS had at the moment the PPS signal was raised.)


Our device needs the following components:

  • A GPS receiver with a reference clock pulse output
  • Network interface
  • CPU to process the GPS data, and correct the local clock, and process NTP requests and replies
  • A local clock (which might be software on the CPU)

Ideally, we'd also include some configuration interface.