I was wondering how I could get the sun's azimuth and elevation values to shade a particular window with a roller shutter.

At first I thought azimuth is good enough; of course, it wasn't, as I found out in practice. While there are calculators to find a and e for a specific location at a certain date, I lack the maths to figure out when the sun will hit a western window.

The window faces 270 deg, I know how far the eaves stick out, and the top and bottom edges of the window (and of course location).

I get the idea the maths will be complicated... however, (it won't matter much) as I want to program this into a controller to operate the shutter.

Any hints appreciated.


1 Answer 1


You can use a package such as the astropy or skyfield packages for python. It can calculate the position of any astronomical object.

You can use a website like suncalc.org This lets you find the position of the sun at any time, and at any location.

However for the sun since it moves along the ecliptic, roughly at a uniform rate, you can approximate the position by doing coordinate transformations. The sun's longitude moves by 365.24/360 degrees a day from 0 at the vernal equinox and has an ecliptic latitude of 90 degrees. This can be converted into equatorial coordinates (right ascension and declension), and then, given the hour, the alt and az positions can be found. The formulae can all be found on https://en.wikipedia.org/wiki/Celestial_coordinate_system


You must log in to answer this question.

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