top of page

Time Server

How to achieve high precision in time associated with astronomical measurements

When measurements are made in astronomy, for example in photometry and astrometry, it is required that the measured data be associated with a date and time (timestamp) that must be precise enough for the measurements to have scientific value, especially if we want to report and share them. The required precision will logically depend on what we are measuring. A lot of precision will be required if, for example, it is a question of measuring a very short period variable star, a "Near-Earth Asteroid" moving at high speed, an occultation produced by a body of the solar system, and so on. 

Astronomy amateurs frequently use computers to control the cameras to capture images for photometry or astrometric measurements. In that cases the time associated with the images is taken from the time of the computer. However, the clock of the computers usually has important drifts that generate lack of precision in the time associated with the captures. 

Typically, a computer is configured to synchronize itself automatically through the NTP (Network Time Protocol) service from time to time. For example, in the case of Windows 7 this is configured using the Date and Time utility, in the "Internet Time" tab. A solution that provides a more accurate synchronization and used by many amateurs is the freeware software Dimension 4. But with these options the errors will be in the order of several tenths of a second, which in some applications will be enough, but in others will not provide the level of accuracy we need. The fundamental problem is related to the fact that synchronization with external servers raises two aspects that affect the process: the precision of the servers themselves (level or “stratum” explained below) and the latency of communications (the hardly predictable delays between our computer and the time server that provide the information for synchronize that travels through the telecommunication networks).

It is important to know the concept of "stratum" (level) of the time server. A stratum 1 server is synchronized with a very precise local clock, for example, atomic or GPS. A stratum 2 server is synchronized with a stratum 1 server, a stratum 3 server is synchronized with a stratum 2 server, and so on. 

Returning to the two problems that affect synchronization, the stratum and latency, the ideal would be to be able to have in the local network of our computer (or computers) a stratum 1 server, since we will have no delays in the communication between our computers and the time server and it will also be synchronized with a high-precision local clock. It seems easy to say, but it is also easy to do, and this document describes how, achieving time synchronization with accuracy better than 1ms.

Stratum 1 server for our astronomical observatory

To build a stratum 1 server for our astronomical observatory, we need these elements:

  • PI Raspberry Plate. I have used the Raspberry PI 3 which is on Amazon for about 35€.

  • Raspberry box for about 5€ on

  • AmazonPower supply for Raspberry PI, about 10€ on Amazon. 

  • 8GB micro SD card, about 4€ at Amazon.

  • Ethernet cable



Once all these elements have been gathered, the next steps are as follows:

Micro SD Recording

Record on micro SD with an image the operating system of the Raspberry. I used the image 2019-07-10-raspbian-buster-full.img that can be found at:


There are several programs available on the web to burn an image to disk from a file with img extension. I have used BalenaEtcher, available for Mac and Windows. 

Assembling the elements

The assembly is very simple. We only have to insert the micro SD once recorded in the Raspberry, place the GPS board in the connector strips of pins of the Raspberry fixing it with the screws that are supplied.


To place this set in the box requires a little DIY, as you have to make an opening on the side for the SMA connector of the antenna, and make a hole in the top cover so that the LED of the GPS plate is seen once it is in place. In order for the lower and upper covers to fit together, some cuts in the plastic are also needed where the GPS plate fixing screws do not allow the closure to work properly.



Once placed the Raspberry with the GPS plate in the box, connect the antenna and check in a few minutes that the GPS works because the led will start flashing once per second. But for this the antenna will have to be placed with vision of the sky so that the GPS can receive the necessary satellites.


There are many enclosure solutions for the assembly, each can choose the one you like, the only important thing is that the GPS LED is visible as verification that the PPS signal is working properly.

Configuring the Raspberry PI

The aim of this step is to configure the Raspberry to operate as a stratum 1 time server with GPS-based synchronization. The GPS we use has an important functionality and is that through a pin provides a PPS signal (one pulse per second) based on the signal received from satellites, and it will be used for local synchronization. Thanks to this signal, the time server becomes stratum 1.


The configuration process requires a monitor with HDMI input, a keyboard, a mouse and an HDMI cable. I have not included this in the list of items for the server, because they are needed only temporarily, and you can use for this process those that are available for another computer. For eventual future connections it will not be necessary because we will leave the connection enabled by SSH.


Insert the micro SD in the Raspberry, connect monitor, keyboard, mouse and power supply and access the operating system of the Raspberry. We will connect with an Ethernet cable to our router if the installation process requires Internet access.


The steps to follow are quite detailed in the following link and take a few minutes:


As comments to the general process, I will only add that in my case I have preferred not to activate the WIFI in the Raspberry and configure a fixed IP address so that the time server is accessible through the LAN of my observatory connecting it to a switch or a free port in the router with an Ethernet cable.


After these configurations, what have we done in the Raspberry? 




  • We have activated SSH. This will help us to connect in the future to the Raspberry via Ethernet or WIFI, and take control of Linux without having to place the monitor, keyboard and mouse.

  • We have configured the PPS function to operate from the signal received on pin 18 on the Raspberry GPIO.

  • We have activated and configured the NTPD function so that the equipment operates as a time server based on PPS. In the configuration we have added the time servers used by the service in combination with the PPS signal generated locally with the GPS. It is recommended that you choose the ones in your region, for example the ones we can find here for Spain:ña



After making the configuration and waiting a few minutes we can check the results by executing the command ntpq -p in the command console.


The following capture is from the console of my Raspberry with the command ntpq -p. 


It is important to know the following codes referring to the character that precedes the name of each server:


Space              discarded due to high stratum and/or failed sanity checks.

“X”                  designated falseticker by the intersection algorithm.

“.”                   culled from the end of the candidate list.

“-“                   discarded by the clustering algorithm.

“+”                  included in the final selection set.

“#”                  selected for synchronization but distance exceeds maximum.

“*”                  selected for synchronization.

“o”                  selected for synchronization, pps signal in use.


Note that PPS is headed by "o": oPPS (0), which indicates that synchronization by PPS is working. Next, we see that have been selected the server (headed by "*") which is a stratum 2 to apply the GPS PPS setting. The San Fernando Observatory server "" has participated in the selection (headed by "+") but in this case it has not been selected despite being a stratum 1: they are decisions of the ntpq service algorithm.


With this check we see verified that our server stratum 1 is working correctly.

Configuration of the PC's of our local network 

This is the final phase and must be done on all PCs in our local network (either cable or WIFI) to use the Raspberry as a time server.


The first step is simple, in the Windows Control Panel with the Date Time utility, we will disable the NTP synchronization in the Internet Time tab. If we have Dimension 4 installed, we will uninstall it completely.


From here the goal is to install NTPD, and the recommended way is to use the Meinberg installer. As stated on the Meinberg page: "Meinberg NTP packages provide a GUI installer for Windows that installs the NTP service and associated executable programs that have been compiled from the original public NTP source code available on the NTP download page at".


The installer can be found at the following link:


Up today, August 2019, the most suitable option is to download the installer: 

ntp-4.2.8p13-win32-setup.exe (3.81 MB) March 8, 2019 version. 


The following indications are not meant to be a detailed guide, as there is enough information on the web, but they are notes of my experience during the installation in Windows 7. 


After accepting the installation agreement, select the folder and package options it offers by default. 


Check the box to create an initial configuration and select the appropriate region:


When ask if you want to edit the configuration file, you must indicate yes. The file ntp.conf will be opened in an editor and must be added in the # Servers section:


# Servers

server minpoll 5 maxpoll 5 iburst prefer


(with the IP that corresponds to the Raspberry, in my case that I have configured as fixed IP, you need to put the right in your case)


By adding this line, we are specifying to synchronize using our Raspberry server every 32s (the value of 5 refers to power of 2: 2^5=32)


The Raspberry server must be the only one that is marked as "prefer", this way we are giving priority to our local time server stratum 1.


Leave the boxes checked according to the following screenshot.


When you request an ID and key, you can keep ntp as suggested for the ID and enter the desired key, for example, ntpntp.

Checking if it woks

Once the installation is finished, we wait a few minutes and on a Windows command console we run ntpq -pn and we should see something like the following:


We can verify that the Raspberry (IP is selected for synchronization (* ahead) and is recognized as stratum 1 (st 1). 


The values of offset and jitter are below the millisecond (offset indicates the difference in time with the source of synchronization and jitter the dispersion). The jitter value will end up stabilizing at 0.977, which corresponds to 1 ms for a resolution of 10 bits (1024), not lowering this value, although possibly the real value if represented with higher resolution would be lower).


I have verified that these values of offset and jitter (in equipment connected by Ethernet and also by WIFI) are always maintained below 1ms, reason why we have achieved our objective: we already have the PC's of our observatory perfectly synchronized.

bottom of page