# Calculate Dec and RA of a star from Euler angles and GPS data

I have 9DOF sensor (accelerometer, gyroscope, and magnetometer) that gives orientation via Euler angles (yaw, pitch, roll). Along with GPS data (latitude, longitude, elevation, time) this is passed to a PC application that has to calculate Dec and RA of a target (e.g. star). Sensor and GPS receiver are mounted on a telescope, so it should give the celestial coordinates of a star. The problem is that I don't know how to get Dec and RA from those data. I would very much appreciate a detail explanation of how I could get this.

• astronomy.stackexchange.com/questions/11706/… might help. If you can convert yaw/pitch/roll to altitude/azimuth, you can use the standard formulas to convert. You would also need to know the current time and time zone (or the current UTC time).
– user21
Sep 15 '15 at 13:46
• It makes a big difference whether the telescope (and hence the sensor) is on an equatorial mount or an altitude-azimuth mount. Which is it? My answer below presumes it is an altitude-azimuth mount. Sep 15 '15 at 16:08

Obtain from the publisher Willmann-Bell the book ''Astronomical Algorithms'' by Jean Meeus. If obtaining elsewhere, be sure to obtain the 2nd ed. with corrections as of August 10, 2009. The equations you want are in Chapter 13, "Transformations of Coordinates".

Some variables must be defined:

$\alpha$ = right ascension, if obtained from formula it is in radians
$\delta$ = declination, positive north, negative south
$h$ = altitude, positive above the horizon, negative below horizon
$A$ = azimuth, measured westward from the South, other sources often measure from the North
$\psi$ = observer's latitude
$H$ = local hour angle
$\theta$ = local sidereal time

The first step is to transform horizon coordinates (azimuth and altitude) to equatorial coordinates (local hour angle and declination).

$$\tan H = \frac{\sin A}{\cos A \sin \psi + \tan h \cos \psi}\\ \sin \delta = \sin \psi \sin h - \cos \psi \cos h \cos A$$

Then the local hour angle H is transformed to right ascension $\alpha$:

$$\alpha = \theta - H$$

• Thank you for your answers. I'm not sure how the type of the mount affect the final results. Yes, the telescope is on alt-az mount, but I don't need for now to track the movement of celestial objects, only to give as much precise position as possible. I assume that from sensor readings I can calculate altitude and azimuth, from yaw and pitch, but I'm not sure if I need roll in the calculations.
– yode
Sep 16 '15 at 10:42
• I think you're right, no need for roll in the calculations. And since the sensor is on the telescope, not the mount, I was probably wrong about needing to do anything differently for an equatorial mount. Sep 16 '15 at 17:04