Perhaps even a photosensor that would turn on input and allow you to time how long the sun is up.
timeTommorrow = timeToday
It would theoretically semi-learn the length of sun shine each day.
You could then also do a check everyday before moving your array. If the sun should be up at a given time, then the photosensor should be on as well.
Perhaps it’s a cloudy day? A storm?
If so, don’t bother spending the energy to move the
array.
if (sunFail) { timeTommorrow = timeYesterday; }
You can also formulate a lookup table with sunrise and sunset times for given days of the year. That information should be available somewhere in a spreadsheet, and there are nodes available for node-red to access a spreadsheet.
Making the actuator move based on an on and off motion is simple. You would need to add some deadband to keep the relays from chattering.
For matching the sun position to the actuator, I may be wrong...but..
You could use a function to scale the sunrise time and sunset time into the length of the actuator.
To keep it simple, let sunrise = 0% and sunset = 100%, then calculate time of day and scale that between your sunrise and sunset to get percentage.
Actuator travel,
sunrise = 0”
sunset = actuatorLength
Then calculate,
multiplier = actuatorLength / 100%
positionCommand = percentOfDay x multiplier
It would also make your job much easier if there were someway for you to know what your current actuator position is. An encoder perhaps.
Then just compare,
if(currentPosition >= (positionCommand + deadband)){
// run actuator reverse
}
if(currentPosition =< (positionCommand - deadband)){
// run actuator forward
}