Since writing up our project on how to make an Arduino Solar Tracker which makes use of a single or multiple PWM servo(s) to actuate the panel, we have had a number of requests to modify the design and code to allow for a linear actuator to be used to move a heavier load; a large panel or array of panels.
The circuit for the light detection remains the same as the original solar tracker while the servo is now replaced by a 12V DC linear actuator which is supplied by a 12V battery or power supply and controlled by two relays. Alternately, you can also drive the tracker with a stepper motor which is also controlled by the Arduino
This project is not a stand alone project but is meant to supplement our original Arduino Solar Tracker project. You will need to follow this guide in conjunction with the original guide in order to produce the linear actuator solar tracker.
What You Will Need For A Linear Actuator Solar Tracker
The parts required are as for the Arduino Solar Tracker without the PWM servo. The additional components required are:
- 12V DC Linear Actuator (Sized to suite the weight of your array) – Buy Here
- 12V DC Power Supply (Rating sufficient for your actuator) – Buy Here
- 5V DC Double Pole Relay (Current rating sufficient for your actuator) – Buy Here
- 5V DC Single Pole Relay (Current rating sufficient for your actuator) – Buy Here
How To Make The Control System
Again, the light sensor part of the control system is the same as in the Arduino Solar Tracker. The diagram for this circuit has been drawn in Autodesk Circuits and is shown below:
The design and code are both slightly more complex with a linear actuator as the Arduino needs to control the actuators movement duration and the direction.
A 5V DC double pole relay is used to reverse the polarity of the supply to the linear actuator. This enables the actuator to move forwards and backwards. The second 5V DC single pole relay is used to switch the movement of the actuator on and off, when activated the actuator will move. The linear actuator is represented by a DC motor in the above circuit diagram, a DC motor drives the actuating arm in your assembly.
Upload the Sketch
Now you can upload your sketch onto your Arduino, if you haven’t uploaded a sketch before then follow this guide on getting started.
//The DIY Life
//10 October 2016
int eastLDRPin = 0; //Assign analogue pins
int westLDRPin = 1;
int reverserPin = 7; //Assign the digital pins
int motorPin = 8;
int eastLDR = 0; //Create variables for the east and west sensor values
int westLDR = 0;
int error = 0;
int calibration = 0; //Calibration offset to set error to zero when both sensors receive an equal amount of light
int trackerPos = 180;
eastLDR = calibration + analogRead(eastLDRPin); //Read the value of each of the east and west sensors
westLDR = analogRead(westLDRPin);
if(eastLDR<350 && westLDR<350 && trackerPos<180) //Check if both sensors detect very little light, night time
while(trackerPos<180) //Move the tracker all the way back to face east for sunrise
error = eastLDR - westLDR; //Determine the difference between the two sensors.
if(error>15&&trackerPos<180) //If the error is positive and greater than 15 then move the tracker in the east direction
digitalWrite(reverserPin,LOW); //Change motor direction to east
digitalWrite(motorPin,HIGH); //Move the tracker to the east
else if(error<-15&&trackerPos>0) //If the error is negative and less than -15 then move the tracker in the west direction
digitalWrite(reverserPin,HIGH); //Change motor direction to west
digitalWrite(motorPin,HIGH); //Move the tracker to the west
Here is the link to download the Solar Tracker Linear Actuator code.
Would you like to learn more about this project? Are you interested in projects similar to this one? Then Practical Arduino Projects is the book for you, available now on Amazon as an eBook or in Print form.
The calibration of the sensor error, the tracker stand and the tracker in operation details and videos can also be found on our Arduino Solar Tracker project.
My name is Michael Klements and I started this blog in 2016 to share my DIY journey with you. I love fixing, renovating and building – I’m always looking for new projects and exciting DIY ideas. If you do too, grab a cup of coffee and settle in, I’m happy to have you here.