Go Down

Topic: RA/Dec to Az/El conversion library? (Read 156 times) previous topic - next topic


I'm trying to create a telescope pointing mount.

Does anyone know where I can find a library that converts right ascension (RA) and declination (Dec) to azimuth and elevation if given the date/time, gps coordinates and altitude?



Check Jan Meeus or Peter Duffet-Smith


Feb 14, 2015, 08:28 pm Last Edit: Feb 14, 2015, 09:33 pm by jremington
The books by Peter Duffet-Smith are excellent.  There is lots code available on the web for astronomical calculations, in just about any programming language of interest. Here is a place to start for C/C++ code: http://www.projectpluto.com/source.htm

The Arduino IDE is not suitable for most astronomical calculations, because most use double precision floating point calculations, which are not supported by the compiler (double is the same as float).

For that matter, not even standard GPS calculations are supported by the IDE, because it takes more than 6-7 decimal digits to locate yourself on the planet to a few meters precision. You would be much better off with a laptop, Raspberry Pi or similar for the calculations.


Is this a IDE problem or Arduino (microcontroller) issue? By IDE problem, this would mean the programming environment, so would using another program solve this? Unless you really mean it's an inherent issue with the microcontroller?


Feb 15, 2015, 02:06 am Last Edit: Feb 15, 2015, 02:08 am by jremington
It is an IDE problem. The compiler pretends that "double" is the same as "float". 

Double precision calculations work perfectly on the ATmega chips used in the standard Arduino but they are slow, which is probably why the IDE designers left them out. You can use Atmel Studio to program the Arduino board, together with a version of the gcc compiler that does support double precision.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131