Arduino, Green Living, Projects

Arduino Solar Tracker – Linear Actuator Modification


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.

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.

Practical Arduino Projects

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.



  1. Albert Roldan

    I am confused concerning the Tracker Position. Isn’t the Tracker Position redundant in this sketch since there is no Tracker Position pin or any other reference to identify the tracker position?

    • The DIY Life

      Hi Albert,
      I assume that you are referring to the trackerPos variable? This variable is just used to provide travel limits for the actuator. The actuator in the example doesn’t provide any position feedback and we don’t have any limit switches so we rely on a time based interval to determine how far the actuator has driven. This way we can define limits for the starting position 0, and ending position 180, of the tracker.

      • Albert Roldan

        Thank you for the reply. So there would be no harm with removing any reference to TrackerPos? In my instance, the power supply involved, a 24vdc unit, is controlled by a timer. The power supply will direct 24vdc to the actuator and 12vdc to the actuator relays and the Arduino unit. The Arduino unit will send the control signals to the 12vdc relays via 5vdc relays. The timer will turn the power pack on for five minutes four or five times a day.

  2. Albert Roldan

    I have set this up as I had mentioned and it is working great. I only had to change the values for calibration to -10 and the value for (eastLDR<450 && westLDR<450) to get it to work properly. I also changed the delay times so as not to burn up the actuator motor as rapid on off will do that. Thanks again for a great project.

  3. JohnV

    Thanks Diy Life,Michael Klements on an excellent project.
    I’m an old electrician new to this environment and trying to learn,I have this set up as a bench test and it works perfectly,but when the time comes to put it in use I’ll need to drive a larger DC Motor, I have been trying to incorporate a single VNH2SP30 Motor shield and include PWM speed control,but I’m not having a lot of success,any hints or help much appreciated.

    • The DIY Life

      Hi John,
      Good luck with your project, it sounds great! Have a look at this Tutorial on using a VNH2SP30 shield, it takes you through it step by step –
      Using this shield should make your motor quite easy to control, you just need to make sure everything is wired correctly and then learn the programming controls.

      • JohnV

        Thanks for the reply that site looks good,
        I haven’t got to implementing it yet, but I have discovered a problem with the original circuit that I missed previously.
        When the light value falls below 350 [night time] the code locks up and does not return to the east requires reset to continue but this also resets tracker count to 180 ?
        Again any help much appreciated.

        • Albert Roldan

          Hi JohnV, I had the same problem, was driving me nuts, see my comments above. After changing the values to >450 instead of >350, it works like a charm. I’m using a 24v 5amp 24 inch actuator to raise my panels up on one end to face east.

          • The DIY Life

            Hi Albert,
            Thanks for the feedback. I should have put a note in the post regarding calibration and setup of the limits.

        • The DIY Life

          Hi John,
          As Albert has said below, you may need to adjust the light value limits. I would suggest running the system with the Serial monitor open on your PC and sending the measurements from the LDRs to the monitor. The measured values from the LDRs depend on the components, the wire resistance and distance from the Arduino etc, they are very sensitive. So it may be the case that your measured light level is not dropping to below 350 and triggering the return to East function. Once you have these values then you’ll be able to properly set the night time limit and the error margin before the actuator is triggered. Thanks for the feedback!

          • JohnV

            Thanks a lot Diy Life and Albert.
            Its great to receive help so rapidly,I would have been struggling for days.
            Albert your project sounds interesting.
            All is good now

Leave a Reply