Solar Tracker to control linear actuator

Hey all,

I need a bit of input to help my brother with a project. Is it even possible and is Node-Red the best solution ?

We want control a linear actuator to move a solar array through out the day. The actuator is controlled by 12Volts , +- is switched for in and out. We would use two relays to do this and an input for the end switches.

For the program we need to calculate sunrise and sunset, hours of sun per day and calculate a number of movements per day. We are thinking around 30 per day. The time between moves would be adjusted based on hours per day...hope that makes sense :).

To start I am thinking bigtimer and GPIO's connected to two relays.

Thoughts please.

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
}

Yes, Node-RED could be very well suited for this task. Question is how many nodes there are available to support the functionality. I was thinking, just write a javascript in a function node but there might be better ways

Finding standard or contributed nodes would be one task. I would also try to break down the use case a bit.

But I wonder, this is just my thoughts, the 'horizontal position' for sunrise/sunset changes during the year. So the panels starting and endpoint will vary. In between sunrise/sunset you could have a fixed adjustment applied every minute (or every x minutes). When you reach sunset, you could wait a quarter of an hour and then return the panel back to the next mornings starting position

This setup has one major shortage. You can't really know what is actual position of the panel (or actuator). To hold you control system and equipment in sync you'll need some kind of feedback from actuator.
Read more ...

In addition, if you really want to collect most possible energy from the panel, I assume you also have to adjust the vertical angle of the panel during the run-time period

About motor control: I remember having a motorized satellite dish a couple of years ago. It had a very precise positioning motor (in degrees) using diseqc as communication protocol. However the vertical angle was in this case fixed

For an application like this where the absolute position is not super critical then your approach might well work, it depends on how reliable the movement for a given drive time is. You might find that it varies dependant on temperature for example as lubrication oil thins with increasing temperature. There are a number of ways of determining whether it is sunrise and sunset, for example the node red flows site came up with, amongst others, node-red-contrib-astrodata, which might be ideal for what you want.

I think that you will have to use a function node for the timing during the day. You could drive the astrodata node from a once a minute inject and then feed the result into a function node which determines whether it is time for a drive output, and if so passes that on, using a Trigger node to drive the output for the required time.

I suggest that each time you get a transition to night that you drive the motor for an ample length of time to the morning position that you can be sure it has hit the end stop, connect the end stop switches directly into the motor connections so that you don't have to worry about a fault in the s/w leaving it driving against the end stop.

Hi Seth,

Thanks for the reply, I believe that is the current way most actuators are controlled. My brother is buying a pie today and setting up his account here. The addiction starts now :).
I don't believe there is a position feed back from the actuator. I need to read the specs and literature on it. My background is HVAC and building automation so I do have a bit of a base of knowledge.

We can time the actuator travel to get an average and we will reset at night. The safest position is all the way in which will be morning start.

Hi Kram,
Thanks for the input. My brother may correct me, the actuator will always start in the AM at an fully in position. The hardware is already set on an horizontal arc I believe.You are correct we would rest at dusk to full in position.

Hi Hotnipi,
Thanks for the input and link :). I am famiar with the feed back issue from my HVAC days with VAV boxes and dampers. We would run a routine to drive full open and full closed to learn its position as they would wonder. I don't believe we have this issue and the "exact position isn't that critical plus we reset everyday back to the start. I"m guessing but I think the overall length of travel is between 18"-24" .

Hi Collin,
Thanks for the input. We will research Astodata and start to post our flow as we progress. We are lucky to have this forum and wealth of knowledge. This about learning with an end goal and maybe solve an up and coming market issue for a no longer supported device.
I fully agree with a hard wired safety.

You might be able to get a slidewire or something to work as position feedback.

Or, a cable pot here.

It should then be done also after every system reset / restart (whatever reasons but those will happen for sure) . Otherwise it's needs quite heavy logic to determine current conditions which adds another weak link into reliability chain....

Hang on.......

Ok, there will need to be two axis altered "in the bigger picture" though.....

From "sun up" to "sun down" there only needs to be one.

That's how telescope tripods work.

(Some fancy term)

But you align them with TRUE NORTH and you only adjust one axis.

The next day you will need to tweak the second one. But that will be a one off done once every day.

Then you can get the azimuth and all that fancy stuff (node names escape me at this time) but they are out there.

That drives a "motor" and all is good.

You can use the Circadian Light node to know the sun positon according your location. If you only have an axis you can use the azimuth, the position of the Sun in radians (direction along the horizon, measured from south to west).

Then you need a feedback system to know the actual position of your solar array and a PID loop controller node to act to the linear actuator. If you want to limit the travel position of your actuator you can use the altitude output, (the hight of the Sun above the horizon in radians).

You don't need to do it that way. On open loop drive system may well be perfectly good enough. If it is found that open loop is not sufficiently accurate for the whole day you can always put 'return to end stop' and re-position every few hours.

I assume you did see this already?

Could it be as simple as monitoring with some photoresistors placed on the panel mounting?
Moving to where the light is most powerful each minute.
Something like this:

Use a 4 photosensitive light sensor! Check this out: https://www.youtube.com/watch?v=_6QIutZfsFs

I was going to suggest something similar. An array of photosensors perhaps with tubing to limit their angle of view. Set at slightly diverging angles, each would detect a different quadrent of the sky (vertically and horizontally). If any were brighter than the current position, you could then move the panel accordingly.

This has the advantage of not really needing to know anything about sun position and wouldn't move anything if the cloud cover is so heavy there is no benefit.

It should also make the logic a lot simpler.

The downside is needing an array of photosensors all feeding back.