Freeform Astronomical Clock

Arduino powered Astronomical Clock in freeform, which displays the lunar phase and Local Sidereal Time(LST)

Similar projects worth following
An Arduino powered astronomical clock which displays the Local Sidereal Time(LST) and lunar phase using the date, time and location data provided by a GPS-6MV2 module.

  • The structure is built using 0.8mm and 1.0mm brass wire.
  • The local sidereal time (LST) is calculated using this algorithm:
  • The Lunar Phase is calculated using John Conway's moon age algorithm.
  • More details and the explanations of the algorithms are available in the instructions tab.

How to use this clock:

The Local Sidereal Time(LST) is defined as the time reckoned from the motion of the earth relative to the stars. It is 0h when the vernal equinox is on the observer's local meridian. 

When you look at a stargazing chart you'll see 2 celestial coordinates the Right Ascension (RA) and Declination (DEC).  the RA of star X is the angular distance from the vernal equinox to X = 1h = LST. The DEC value is 0 when on the horizon and 90 when on the top. Thus if a star has a RA=3h and DEC=30 it will be on your meridian 30 degrees up from the horizon when the LST clock is 3h.

Further Reading:

History -

RA and DEC -

Celestial Sphere -

Coordinate Systems -

Celestial Coordinates -

Finding Astronomical Objects -

Local Side Real Clock converter -

How to Calculate Sidereal time -

ino - 6.58 kB - 01/03/2019 at 12:36


  • 1 × Arduino Nano
  • 1 × GY-GPS6MV2 GPS module
  • 1 × TM1637 4 digit display
  • 1 × 8x8 LED Matrix
  • 1 × MAX7219 LED Matrix driver

  • 1


    I didn't use sketches/drawings for the brass structure, after 3 days of trial&error I ended up with this. So in these instructions I'll provide you the wiring schematics, explain the code and tell you how I managed to solder the structure. But I can't provide dimensions, etc. since I also don't know them.


    • All the parts in the components tab
    • lots of jumper cables
    • A breadboard

    Here is the wiring schematic:

    I always prototype first to develop the code and test it before making anything permanent.

    After you're done with wiring upload the code "Astroclock.ino" provided in the files tab to Arduino and wait a bit. The GPS should lock into a satelite soon enough and you'll see the matrix and display light up.

  • 2
    The Algorithms

    The code Astroclock.ino is commented so you'll have an idea of how the code works upon examining it. Here I will tell you which algorithms I used and implemented in the code.

    John Conway's Moon Age Algorithm

    John Conway is an English mathematician who came up with the method of mentally computing the day of the week for any given date. Also a method to calculate the age of the moon for any given date. The error rate for this method is a liitle larger than other longer methods but in my case it works well because I only display the 8 phases of the Moon. 

    I implemented the algorithm to arduino as a function called conwayMoon(year,month,day) which takes the year,month and day from the GPS as input, and returns the moon age as output. Than I used this output to draw the Moon phase on to the matrix display using this table:

    Calculating Local Sidereal Time (LST)

    The formula to calculate LST is:

    LST = 100.46 + 0.985647 * d + long + 15*UT


    d = the days from J2000 (more info here)

    long = longtitude from GPS

    UT = Universal time from GPS converted to decimal hours

    This formula gives the LST in degrees.  Then it is converted in the format HH:MM.

  • 3
    The Structure

    Tools & Parts:

    • 0.8mm and 1.00mm Brass Rod or Wire
    • Soldering equipment
    • Pliers
    • Diagonal cutting pliers 

    I didn't have acces to brass rods since they are not avaliable in my region. Thus I had to use brass loop wire and straighten it.

    The first structure I tried was a mess and unstable because I used a larger square for the base and the bent points were visible seen here:

    Later tried a smaller base which I was happy with:

    Instead of soldering the 8x8 matrix to the driver directly, I soldered them using brass wires which gave this cool look:

    I bent the wires estimating the dimensions by eye:

    In every step I tested if the components worked correcly.

    So what do you think? All kinds of feedback is welcome!

View all 3 instructions

Enjoy this project?



floris wrote 12/28/2023 at 12:55 point

i cand vind the TM1637Display libery Where can i vind it

  Are you sure? yes | no

vianiotta wrote 10/19/2021 at 09:41 point

Hello. I made the prototype, inserted the Arduino code but the display remains all illuminated or sometimes turns off and does not give me the moon phases. I checked the code and everything looks fine. What mistake can I have made? Thank you for your help.

  Are you sure? yes | no

Görkem wrote 10/19/2021 at 17:06 point


In my experience, the display goes blank or gets illuminated when the GPS signal is lost. I currently don't have an error code to display so it just goes blank. Try to put it near a window where it can get a clear signal. I hope this helps!

  Are you sure? yes | no

vianiotta wrote 10/20/2021 at 15:19 point

Grazie, ho provato come mi hai detto  funziona, ma il display si illumina completamente con tutti i LED accesi non mi  riporta i simboli luna piena un quarto di luna ecc.

  Are you sure? yes | no

vianiotta wrote 09/12/2021 at 10:26 point

Excellent project, it works, as far as I am concerned I have only one difficulty, that I am not able to correct the arduino code to calculate the local time. I am a hobby beginner. Thank

  Are you sure? yes | no

rdolats wrote 07/08/2021 at 19:32 point


I prototyped your project and it works great, I added a DHT11 to show temp and humidity, the only issue that I encountered is that the time was not coming up correctly based on my location (Eastern Time) and I was not able to fix the math,  so I just added a piece of code  to manipulate the UTC to calculate the local time for display, moon phases coming up correctly.

Thanks for posting it 

  Are you sure? yes | no

satoo78 wrote 02/02/2020 at 14:44 point

¿Cómo puedo establecer que en el momento correcto

  Are you sure? yes | no

Bob wrote 05/14/2019 at 22:07 point

Interesting idea and project to try. Your explanation of declination (DEC) is hard to follow. It sounds like you are confusing DEC with altitude. DEC is 0 degrees when a celestial object is on the celestial equator (not the horizon). When it is +30 degrees it lies a third of the way northward toward the north celestial pole, essentially Polaris. I’ve been looking for a good sidereal time implementation for Arduino. Thanks.

  Are you sure? yes | no

parascubasailor wrote 02/02/2019 at 00:37 point

My quick method for straightening wire: one end held in the bench vice, the other end in a pair of pliers. Yank the pliers. Usually, the wire breaks at the end held in the vice, but the piece left dangling from the pliers is straight.. If it didn't get broken (with a thick wire for example), cut with side cutters. Easier and quicker to do than to describe...

Very nice clock, and I'm keen on making one.

  Are you sure? yes | no

Bclark wrote 01/04/2019 at 18:07 point

This is a nice Astroclock I have just tested your cod and all work ok.

I will start to make my self one and put it on my work bench.

Thank you keep up the good work 100%.

from Brian Clark

  Are you sure? yes | no

Jan wrote 01/04/2019 at 18:54 point

You really like building clocks, don't you? :) You should start posting your projects, even if you "just" build projects by others. It's always nice to see the personal touch other people give to their variation!

  Are you sure? yes | no

Dan Maloney wrote 01/03/2019 at 16:08 point

Nice job! Impressively straight support wires given that you were starting with coiled wire. I really like the riser section for the lunar display. Good luck in the contest!

  Are you sure? yes | no

Jan wrote 01/03/2019 at 16:47 point


What I find even more appealing to the eye is the mix of deep orange and deep red color of the displays. I imagine there's not much more visible in a totally dark room than those two displays, I mean nothing of the circuit?


  Are you sure? yes | no

Görkem wrote 01/04/2019 at 19:48 point

Yess I love the colors! 

There is a blue led blinking from the GPS module. Which is annoyingly bright. I should disable it somehow.. 

  Are you sure? yes | no

Jan wrote 01/04/2019 at 20:11 point

@Görkem yeah, just remove the resistor in series with the LED. It's easier to add back an SMD resistor than an LED usually...

  Are you sure? yes | no

Görkem wrote 01/05/2019 at 07:28 point

Thanks for the tip! I'll try that.

  Are you sure? yes | no

Görkem wrote 01/04/2019 at 19:44 point

Thank you! I found some methods that jewelry makers use to straighten the wire:

I used both of them. They work fine.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates