[time-nuts] GPS seconds conversion on an Arduino

Chris Albertson albertson.chris at gmail.com
Sun May 14 13:38:10 EDT 2017

Unless this is an educational exercise I'd move to a different processor.
One of those $3 Arm M3 units has enough  memory AND a more standard
development environment that you could use a standard library function to
do what you need.   For more money ($13) you can get the Arm M4 on an
arduino-like PCB and this unit has floating point hardware and even more
memory.   Still about the size of an Arduino Uno but 1/2 the price and 10X
processing power.

Then use nothing like this

But what is your "big Picture" goal?   Do you just need a sidereal clock
display.  Then you only need precision up to the number of digits displayed
up up to human perception.     50ms more or less is about all we can detect
by eyeball or ear.

But are you looking to aim a telescope and need sub-arcsecond precision?
The last time I needed to write software to aim a 'scope we had a wide
angle camera so I only needed to car about milliseconds but some people
today even with backyard telescope want better than that.

On Sat, May 13, 2017 at 6:58 PM, Mark Sims <holrum at hotmail.com> wrote:

> Converting GPS seconds to Gregorian date/time on the Arduino will be an
> arduous task.  You take GPS seconds and add it to the GPS starring epoch to
> get a Julian date.  Then add in the number of leap seconds as a fraction of
> a day to get UTC and possibly add in a time zone offset for local time.
> Don't forget to do daylight savings time conversion...  Then convert the
> result to Gregorian date/time for display.
> The problem is the Arduino floating point library is single precision only
> and does not have the resolution needed to handle the numbers involved.
> Doing it with integer arithmetic (long longs) opens up a whole new can of
> worms.
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/
> mailman/listinfo/time-nuts
> and follow the instructions there.


Chris Albertson
Redondo Beach, California

More information about the time-nuts mailing list