A Low Cost Sidereal Clock

Antonio C. B. Oliveira


Observatório Longa Vista



A clock that displays UT(Universal Time) and LST (Local Sidereal Time) is a useful device to have in an astronomical observatory. Using the Arduino open source platform it is possible to build a sidereal clock for less than $200.


The clock is implemented using the Arduino Ethernet board which allows clock synchronization with a reference clock using NTP (Network Time Protocol). In order to operate even when the internet connection fails, the DS1307 real time clock board  from Adafruit is used, giving a precision of about 2 seconds per day when internet connection is not available.

The display used is the HT1632C 16x24 Red LED Matrix Panel from Adafruit. Two panels are connected providing a LED matrix of 16 by 48 dots. We use the first line of 8x48 dots to display the UT time and the second line to display the LST time.

The connection of the three modules is given in the following table.

Arduino Board

Real Time Clock

LED matrix panel







Analog A4



Analog A5



Digital 2



Digital 3



Digital 5



Digital 6




A potentiometer connected to analog pin 0 is used to control the brightness of the display.

A reset button connected to the RESET pin is used to force NTP time synchronization. A LED connected to pin 8 is used to indicate failure in NTP synchronization.

The clock is assembled in a transparent NEMA enclosure.

The complete clock diagram follows.




The Arduino clock program uses libraries for the real time clock (DS1307RTC.h), the LED display (HT1632.h) and the Ethernet (Ethernet.h).

The header file gmst0.h defines some constants and should be modified as follows:

longitude use the longitude of the observatory to 1/10-seconds of time by dividing by 15 and multiplying by 36000. As usually West should be negative and East should be positive.


timeServer is the IP of the  NTP server  used to synchronize the clock.


mac is the MAC number of the Arduino Ethernet board


ip is a unique IP address in the LAN


The header file also contains a large array holding the Greenwich Mean Sidereal Time (GMST) at 0h for each day of the year. The Arduino platform supports only single precision floating point numbers and the formulas for calculating GMST requires double precision. The solution is to compute the values in a separate Python program on a PC or Mac and store them in an array in the Arduino Program Memory . The implemented array has 2000 days starting at 30-NOV-2011.

The setup() code synchronizes the Arduino clock which always starts at 00:00:00 of January 1st, 1970 with the real time clock. Next it initiates the internet connection and try to synchronize the real time clock with the selected NTP server. Finally it initializes the LED matrix display.

The loop() code displays UT and LST and wait until the UT second changes. It also tries to sync the clock with the NTP server -- using modified program code from Arduino playground -- at intervals of 10 minutes. If sync fails the LED is turned on.

The display of UT and LST is handled by the clockDisplay function. LST is computed from UT according to the formula

LST = GMST at 0h + k. H   + longitude

H=hours elapsed since Oh UT

GMST at 0h is obtained from the array stored in Program Memory and whenever values are not available LST will be displayed as 00:00:00.

The multiplication of H by the constant k=1.00273790935 is implemented in the function mult1 using variables of  data type long in order to avoid the loss of precision that would result by using the single precision float numbers of the Arduino language.



Version 01

November 30, 2011