# Calculating sun position with lightsensor?

Hi all,
I was wondering if it is possible to calculate the actual sun position (only the azimut) with my lightsensor?
My weatherstation at the rooftop is perfectly aligned to the south. The lightsensor(s) build into the device are mesuring the light intensity coming from the east, south/north and west.

So, for my understanding, it should be possible to calculate the postion according to the differnt lux values and show it in degree… But how?

Thanks for you help,
Best regards Dirk

Did you consider using the astro binding?

Yes, I already installed the Astro binding… it’s working, but it doesn’t represent the „real live“ data.

It would be nice to achieve the calculation of the position with my own equipment… and using the Astro binding would be too easy I don’t see how this could ever be accurate unless you live in the Nazca desert or someplace like that which almost never has clouds. And since you will have to take into account the time of year anyway ultimately you will end up with a calculation that doesn’t need your lux sensors in the first place. and just uses time of day/time of year which is what Astro does.

Ultimately, LUX isn’t a distance and it’s too variable based on the weather conditions to be used to triangulate the position of the sun.

@rlkoshak
I don’t think that the clouds would be a problem.
The lux ratio coming from the directions stay the same. (Only when half of the sensor would be in the sun and the other coverd by a cloud it would be a problem imho)

In the chart I can exactly see when the sun changes from east to west. This is (Point at picture) 180°.

So I thought it would be possible to calculate the values before and after that event too.

In theory you could use a lot of geometry. However the fact that your graphs are not smooth and ‘peak’ at different positions shows that your measurements are not accurately enough.

In theory it’s very easy to calculate the position, but applied to your case I think is impossible. And that is because of the sensors readings.

Let’s say that the angle is 0deg. then you should have LuxS=0 and LuxE=something.
LuxS divided by LuxE is zero so the atan will be zero, this means that the angle is 0 deg.

But in reality the sensors don’t work like that. Even if the angle is 0 deg. the sensor facing south will still measure some light intensity and that is because the sensor is not actually measuring the intensity of the light coming from the sun but is also measuring the reflected light. You can verify this be looking at the readings from the north facing sensor. This sensor should always report 0Lux, because it will never be facing the sun, but it still measures some light intensity.

You will need a different type of sensors, a sensor that measures only the direct light coming from the sun and no reflected light. I don’t know if such a sensor exists, maybe something similar with a photovoltaic panel.

If you post the readings from all your sensors at a certain time, and you know the sun angle at that time, we can try a calculation.

I know I can not use my sensor to tell where the sun is Green is measured luminance, yellow is the calculated sun position to the horizont:

You cant use it to tell when the angle is above or below 0 I do not have correct sun/horizont angle data vs. luminance for the darkest time of year, the sun is above 0 on the darkest day (Not considering the hills blocking the sun).
I can use the luminance sensor to tell if the sun is aprox. -10 below the horizon. The readings varies depending on moonlight and if there is snow.

@LaurentiuB
Here are three data sets for a calculation. I am really curious whether you can calculate the same azimuth as shown by the Astro binding.

E: 72 941
S: 57 647
W: 22 941
° : 147

E: 65 882
S: 98 823
W: 44 705
° : 182

E: 36 470
S: 88 823
W: 62 941
° : 209

Blue/ Red/ Green arrows represent the light intensity in relation to each other.
Orange sun position is from the Astro binding.

First set of values

Because East value is bigger then the West value we assume that the sun is between 90° and 180° so we calculate the angle with 90+atan(57,647/72,941)=128°

Second set

Again East value is bigger then the West value so we assume that the sun is between 90° and 180°, we calculate the angle with 90+atan(98,823/65,882)=146°

Third set

This time the West value is bigger then the East value so we assume that the sun is between 180° and 270°, we calculate the angle with 180+atan(62,941/88,823)=215°

Conclusion: use the Astro binding 2 Likes

@LaurentiuB

Thank you for the calculation.

So… a calculation is possible but not accurate at all.
Astro binding is the way to go.

Thanks!