After a mind numbing amount of work to rewrite massive sections of the code, here is the finished update to the Arduino Sun Tracking / Heliostat program. The improvements include the following:
To start, the table which contains the hour angle values has been completely redone. After a bit of research, I learned that it could be moved into program memory, thus giving it enough space to hold values for every day of the year. This means that the calculated altitude and azimuth values of the sun are more accurate now that the table doesn’t skip days.
Much effort was put into making the program more user friendly. In particular, adding more machines is now a lot easier than it was before. The process now only involves editing a couple of lines of code where as before it was just a horrible mess of copying and pasting.
The code for controlling the stepper motors has been consolidated into a function named “moveToPosition”. This makes it much easier for someone to modify it for their purposes.
Fractional steps are now saved and added back in during the next machine update. This keeps steps from being lost due to rounding error.
There has also been a few bug fixes and a general cleanup of the code to make things more readable.
In general, I’d say that the core program is about as finished as it is ever going to be. It is, however, certainly possible to add more features around it. If you add anything, please feel free to share it on the forums. Also, let me know if you run into any new bugs.
Thanks!