## Monday, 2 November 2015

### Arduino Sidereal Clock

A work colleague has asked me to make him a Sidereal Clock.  I had never heard of a Sidereal Clock before but was certain I could do it so I agreed and started to think about how it could be done.  The most important thing for me would be accuracy...more on this later.

Wikipedia Entry on Sidereal time

The definition of Sidereal time is:

The sidereal time is measured by the rotation of the Earth, with respect to the stars (rather than relative to the Sun). Local sidereal time is the right ascension (RA, an equatorial coordinate) of a star on the observers meridian. One sidereal day corresponds to the time taken for the Earth to rotate once with respect to the stars and lasts approximately 23 hours and 56 minutes.

Basically Sidereal time is used by astronomers to be able to tell when an object of interest will be visible in the sky.

There is a formula (In fact there are quite a few) for calculating the Sidereal time based upon the current time and date....It's quite complicated but here goes:

First Step - Calculate the Julian Date

Wikipedia Entry on the Julian date

The Julian Day Number (JDN) is the integer assigned to a whole solar day in the Julian day count starting from noon Greenwich Mean Time, with Julian day number 0 assigned to the day starting at noon on January 1, 4713 BC, proleptic Julian calendar (November 24, 4714 BC, in the proleptic Gregorian calendar), a date at which three multi-year cycles started and which preceded any historical dates. For example, the Julian day number for the day starting at 12:00 UT on January 1, 2000, was 2,451,545.

I was going to go through a calculation to check I have this understood and correct....I have tried several methods and found that with excel I can calculate the Julian Date Number and the Julian Date.  The spreadsheet I used to calculate this is here...

Alex's Excel Julian Date Calculator

It shows that several different methods of calculating the Julian Date exist and that they have varying degrees of accuracy when compared with online calculators.  This is of course under the assumption that I have implemented the formula from wikipedia correctly in excel...which I'm fairly certain I haven't as I don't know how to implement the floor function required.

There are several online calculators for the Julian Date which work perfectly.  I may have copied the function from the javascript and tested that and found it works perfectly....

US Navy Online Julian Date Calculator

Once you have the correct Julian Date it is possible to calculate Greenwich Mean Sidereal time...

Calculating Greenwich Sidereal Time is discussed here:

Calculating Greenwich Mean Sidereal Time

Useful Formulae

In order to do this we need to know what the current date and time is...so that means we need a method of getting the time and storing it.  We also need to have the latitude and longitude of where the clock is...and to get that we need a GPS receiver module.

Lets define the electronic components needed to make a sidereal clock:
• 1x Arduino R3 or compatible development board.
• 1x RTC Module.
• 1x LCD Display module - A 20x4 would be good.
• 1x Lipo Battery, charger and boost module.
The idea is that the GPS receiver module will receive the location (latitude, longitude) and UTC time. This is probably the most accurate time we can get.  This value of time is passed to the RTC module so that if the GPS Link is lost the correct time is still available.  The arduino then passes this information to the 20x4 display which will show:
• The UTC time on the first line (the current time in the UK not accounting for day light savings)
• The Local Sidereal time on the second line.
• The local latitude on the third line.
• The local longitude on the forth line.
The lipo battery will keep the clock running just in case there is a power cut or the clock needs to be moved but for normal use the clock will be powered by a mains to USB converter.  To save power the backlight to the display will fade out after ten minutes unless the user presses a button.

I've ordered all of the parts we need from http://hobbycomponents.com/

Lipo Battery Charger and boost module - Protopic - £12.60

We are also going to need a case to hold the clock once it's finished.  I've not designed it yet but I'm looking at a well finished laser cut case which looks something like this:

Well...that's about it for now.  Next post will deal with calculating Sidereal time using the Arduino using the RTC module.