# Open source code for the maths behind a heliostat?

Theoretically, using a Raspberry Pi, (at least) one mirror, and two motors, one should be able to build a heliostat, i.e. a device which redirects sunlight to a fixed spot, like a scrub in the shadow of a building.

I am now searching for heliostat (open) source code, ideally in python, hopefully with enough comments. Also: Is my following rough approach correct?

1. We need to know the exact geographical location of the mirror in terms of longitude, latitude. For simplicity, we assume that the mirror itself always has an obstacle-free view of the sun.
2. For a given time, we can use celestrial mechanics to calculate the path of the sun on the sky.
3. Using the reflection law from geometrical optics, we can determine the position of the mirror, since we know the vector from the mirror position to the spot we want to direct light to.

That sound simple enough, at least theoretically. I read that for step 2, many use precalculated tables. Why? Is it numerically so challenging?

### References

• You've been through the US Navy site? usno.navy.mil/astronomy Apr 1, 2021 at 14:49
• Part of the reason tables are used for the Sun's position in celestial coordinates is that the right ascension and declination of the Sun vary throughout the year in a complicated way. See the Wikipedia articles on the equation of time and the analemma. Apr 8, 2021 at 20:09
• @MichaelSeifert Thanks for the hint about analemma. I also found Position of the sun which is kind of what I need to do in first place. Apr 8, 2021 at 20:25
• did you build the heliostat? Apr 30, 2022 at 18:11
• @jumpjack Not yet. May 2, 2022 at 6:50

I wrote the source you need some years ago:

https://jumpjack.wixsite.com/progetti/sorgenti-ipsun

The Arduino/Processing version was just a demo program to manually control a TENVIS camera by multiple buttons, it lacks the "astronomical algorithm".

The Javascript version contains astronomical calculations and a demo page which connects to a local TENVIS camera.

I also built a prototype...

...then I found, at MakerFairRome 2016, a maker which sold on Kickstarter a ready-made heliostat, initially named "Lucy", then renamed "Caia"... but 5 years passed and it has not yet been born... so I think I'll have to go back to my project and develop my own heliostat.

But in the meantime I found this page about a "static heliostat", and now I am trying to reverse-engineer it to figure out if it could be easier/cheaper:

http://cleardomesolar.com/solareflexpanels.html

http://www.redrok.com/main.htm#gsc.tab=0

• I have answered your question about the SolarReflector. Now, what would be your ideal design for a cheap and practical reflector? I am also very interested in this work :-) Jan 22, 2022 at 19:07
• I added my old code to my github repo about heliostats: github.com/jumpjack/heliostat/tree/main/ipSun Now I am going to update it to port the javascript code to ESP32/Arduino, to control this pan/tilt head (27€): amazon.it/gp/product/B07G8WK3HS Mar 13 at 9:28

Assuming you know Sun Altitude/Elevation and Azimuth at a given location on Earth (you can calculate it using any astronomy library, such as suncalc.js), and the Altitude/Elevation and Azimuth of target w.r.t mirror, the mirror must point toward this direction:

mirrorAz = TargetAz + (SunAz - TargetAz) / 2
mirrorAlt = TargetAlt + (SunAlt - TargetAlt) / 2


I just discovered that a lot less math is needed to build an heliostat:

• in '800 somebody "discovered" that you don't need any un-existing sun-sensor or un-existing computer to continuously track the sun moving in the sky: you just need a clock; but a special clock, which rotates at specific speed. Rotating at this speed a properly oriented mirror, it will reflect the sun in the same direction for whole day, but in slightly different directions on next days; the device was indeed designed to work only for some hours, during optics lessons. There are several variants of these devices, currently I am focusing on Silbermann heliostat buit by Louis-Jules Duboscq; with this device you don't need to know/do maths: somebody did it for you 250 years ago; I think the right speed is half the sun speed and is constant along the day, but I am still working on this: the box of Silbermann heliostat looks too big to be so simple.

• there is a "werid way" to look at how a parabolic mirror reflects rays;
• classic way: all rays coming from same direction (a satellite) are reflected to same point:
• alternate way: wherever a ray comes from, it will be always redirected in same direction (as long as it passes through focus):

Does this mean that wherever the sun is in the sky, it will be always reflected in same direction along the day?!?

So I did a real life test: I took a parabolic antenna, I painted it in reflective coat, I placed it the sun, in front of my north-oriented window. Result: a whole wall of the room which had never seen the sun before was filled by natural sun light!! My experiment lasted only 1h15m because I started it late, while sun was going to set (in that point the sun arrived today only at 16:00, and it set at 17:15 behind buildings). During this time, a flat mirror placed on the illuminated wall reflected light to a constant position on another wall.

The light was not as bright as the sun, because the mirror is just around 0.33 m2 and the wall is 6m2, so I think I observed a collateral effect: if reflective coating is not perfect but a little coarse, you get this effect:

And probably:

So you can decide:

• if you want intense reflection, you need a "perfect" mirror (next test will be to glue mirror mosaic tiles to the parabolic antenna), but it will be as large as the mirror itself.
• If light widespread all over the wall is enough, you can use a reflective coating.

Further experiments will follow.

In the meantime , you can play with this 2d optics simulator:

https://phydemo.app/ray-optics/simulator/

• "you just need a clock; but a special clock, which rotates at specific speed." This is how telescopes work, no? Mar 20, 2023 at 4:24
• No this is how telescopes connected to startrackers work; but anyway they rotate at exactly 360 degrees/day, because they follow sky objects; but an heliostat does not track sun, the mirror shall not look at the sun: it must reflect it to a specific direction. At my specific location I think it can do it by moving at 1/2 speed of the sun, I am still trying to figure out how the speed relates to position and day of the year. Mar 20, 2023 at 5:52
• "connected to startrackers work". That's what I meant. Should have clarified it. Mar 20, 2023 at 5:54