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.

  • $\begingroup$ 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). $\endgroup$
    – user21
    Sep 15, 2015 at 13:46
  • $\begingroup$ 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. $\endgroup$ Sep 15, 2015 at 16:08
  • $\begingroup$ I found this question and your other one on hour angle - it occurred to me while trying to use my ancient alt/az refractor to look for comet C/2022 E3 (ZTF), building a scope-mounted sensor to tell me where I'm pointing would help. I suspect your inquiry was to create a similar device/system. Did you ever do so, and do you have recommendations on how to (or how not to!) do so? $\endgroup$
    – Mark O
    Feb 3, 2023 at 2:32
  • $\begingroup$ @MarkO Yes I did, but unfortunately, for precise guidance and tracking you need motors and professional applications. The sensor that I was using was giving enormous error in measurements, so you need some expensive gear, I’m afraid. $\endgroup$
    – yode
    Feb 4, 2023 at 9:08

1 Answer 1


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 $$

  • $\begingroup$ 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. $\endgroup$
    – yode
    Sep 16, 2015 at 10:42
  • $\begingroup$ 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. $\endgroup$ Sep 16, 2015 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .