<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Two stepper motors will adjust the position of the assembly the ADCs are mounted on so that it will be able to track the sun precisely during the day.<br></blockquote><div><br></div>Solar tracking is well established and predictable, have you thought about using one of the many libraries available for Python?<br><br><a href="https://pysolar.readthedocs.io/en/latest/">https://pysolar.readthedocs.io/en/latest/</a><br><br>pysolar claims a maximum azimuth error of 0.176 degrees; I doubt you could get anywhere near that? (the biggest error would be getting the compass points aligned)<br><br>Curon</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ar Iau, 18 Gorff 2024 am 23:38 Rhys Sage via Swlug <<a href="mailto:swlug@mailman.lug.org.uk">swlug@mailman.lug.org.uk</a>> ysgrifennodd:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">My Pi Pico is producing readings from the 3 ADCs but I needed to calibrate the ADCs so I modified the code thusly...<br>
import machine<br>
import utime<br>
analog_value = machine.ADC(0)<br>
analog_value1 = machine.ADC(1)<br>
analog_value2 = machine.ADC(2)<br>
#zero values<br>
correction = analog_value.read_u16()<br>
correction1 = analog_value1.read_u16()<br>
correction2 = analog_value2.read_u16()<br>
while True:<br>
reading = int((analog_value.read_u16() - correction)/256)<br>
reading1 = int((analog_value1.read_u16() - correction1)/256)<br>
reading2 = int((analog_value2.read_u16() - correction2)/256)<br>
print("ADC 0: ",reading, " ADC 1 ", reading1, " ADC 2 ", reading2)<br>
utime.sleep(0.2)<br>
<br>
Afterwards I realised that would not work in the real world. The plan for the ADCs is for each to read a patch of sunlight reflected off a white reflector in order to ascertain which is most illuminated by the sun. <br>
<br>
Two stepper motors will adjust the position of the assembly the ADCs are mounted on so that it will be able to track the sun precisely during the day.<br>
<br>
I realised that as soon as the power goes off it will have to be re-aimed and re-calibrated. Better instead to use electronics and put presets on the LDRs in order to calibrate for optimal aim. Thus, when the sun comes up in the morning and the thing comes alive, it'll be able to find the perfect aiming point. <br>
<br>
Usual issue - I spend so much time on real life I have little to no time for programming projects. Out all day Tuesday, out all day today. Out all day tomorrow and Saturday. <br>
<br>
The ultimate aim of this project (which will include some 3D printed parts) will be to produce a device that can track the sun, focussed through a flat magnifier and aimed at a coin held in an insulated mount. I just want to see if I can melt the coin by the power of the sun though the tracking software will serve another project that's planned later down the line.<br>
<br>
Rhys Sage<br>
<br>
-- <br>
Swlug mailing list<br>
<a href="mailto:Swlug@mailman.lug.org.uk" target="_blank">Swlug@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/swlug" rel="noreferrer" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/swlug</a><br>
</blockquote></div>