Sun Tracking Solar Panel Project with Arduino

AS we talk about Renewable energy sources. A name solar energy source come in our mind. So, this project is related to Solar energy. It helps to get more Sunlight and more energy from the sun. In this Sun Tracking Solar Panel Project with Arduino, we work on the movement of the solar tracking system. the sun moves in the sky and the density of the sunlight change with the time. when the sun rises, means in the morning
if something is in that direction it will definitely get more sunlight. and after some time it gets less sunlight because the position of the sun has changed. so, to get more sunlight you have to move with the sun. the sun tracking solar panel project system follows the sun with their position. so the system gets more sunlight than the normal solar system.
In this project, the solar panel placed over a plate. which moves in two directions with the help of servo motor. the solar panel system having some sensors which track the sun. the system moves in 2 axes that’s why we call it dual axis system. it moves in a negative and positive direction in the x-axis. and same in the y-axis. there are more projects on Arduino you must see the smart irrigation system
There are Two servo motors used in the Sun Tracking Solar Panel project. one is for the horizontal movement and another is for the vertical movement. so, with the help of these two motors, the system moves in both directions. when the system needs to move in the horizontal direction the horizontal servo motor starts to rotate. and when the system needs to move in the verticle direction.
There are Four LDR used in the projects to track the sun. You can see the placement of LDR in the below image. four led placed at the four different sections. these all LDR track the sunlight. 
the Working principle of Sun Tracking Solar Panel Project. 4 LDR placed in four different directions. in all LDR there is a comparison of the amount of light. on which LDR have more light the movement of the system occurs in that direction. For ex:-  if the upper right LDR have more light than the other 3 LDR then the movement of the system occurs in the Upper right direction. the working for other three LDR will same. we have to calibrate the servo with the value of LDR. 

Component Required in Sun Tracking Solar Panel Project 

1. Arduino Uno  
2.Servo Motors
1. Arduino:-
Arduino is an open Source Development Board having ATmega328p.For the beginner, we have Arduino Tutorial on another webpage.
2. Servo Motors:- 
Servo Motors is widely used in robotics and embedded projects due to its accuracy and efficiency. Servo motor is a setup of DC motor and some electronics components. which is a feedback circuit. We can say servo motor is a dc motor with feedback. 
3. LDR(Light Dependent Resistor):-
LDR is Resistor basically. it’s resistivity change according to the intensity of light. It gives maximum resistance when it is in dark. and gives minimum resistance when it is in Light. 
4. Resistor:- 
Resistor opposes the flow of current in any conductor. here resistor blocks the extra current driven to the LDR. so we calibrate the LDR value accurately. 

How to construct the Sun Tracking Solar Panel Project

To construct the Project see the below images. 
LDR position in Solar Tracker
in this picture, you can see clearly the position of the LDR. Placed four LDR in that manner with a cross structure. this structure helps in to not interact with the other LDR. this cross structure having wall among all the LDR. which help to track the sunlight.
servo motor position in Solar Tracker
In this picture, you can see the image of the Vertically placed servo motor. which help to move the solar panel in one direction as you can see in the image.
servomotor in sun tracking projects
In this image a horizontally place motor under the whole setup. which rotate the setup according to the sunlight grab by the LDR.
Circuit Diagram for Sun Tracking Solar Panel Project with Arduino
circuit diagram for for Sun Tracking Solar Panel Project with Arduino
Servo 1 is Horizontal servo and Servo 2 is verticle servo
C Code for Sun Tracking Solar Panel Project with Arduino
#include <Servo.h>
Servo servohorizontal;
int servoh = 0;
int servohLimitHigh = 160;
int servohLimitLow = 20;

Servo servoverticle; 
int servov = 0; 
int servovLimitHigh = 160;
int servovLimitLow = 20;
//Assigning LDRs

int ldrtopl = 2; //top left LDR green int ldrtopr = 1; //top right LDR yellow int ldrbotl = 3; // bottom left LDR blue int ldrbotr = 0; // bottom right LDR orange void setup () { servohori.attach(10); // horizontal servo connect to the pin 10 servohori.write(0); servoverti.attach(9); //verticle servo connect on the pin 9 servoverti.write(0); delay(500); } void loop() { servoh =; servov =; //capturing analog values of each LDR int topl = analogRead(ldrtopl); int topr = analogRead(ldrtopr); int botl = analogRead(ldrbotl); int botr = analogRead(ldrbotr); // calculating average int avgtop = (topl + topr) / 2; //average of top LDRs int avgbot = (botl + botr) / 2; //average of bottom LDRs int avgleft = (topl + botl) / 2; //average of left LDRs int avgright = (topr + botr) / 2; //average of right LDRs if (avgtop < avgbot) { servoverti.write(servov +1); if (servov > servovLimitHigh) { servov = servovLimitHigh; } delay(10); } else if (avgbot < avgtop) { servoverti.write(servov -1); if (servov < servovLimitLow) { servov = servovLimitLow; } delay(10); } else { servoverti.write(servov); } if (avgleft > avgright) { servohori.write(servoh +1); if (servoh > servohLimitHigh) { servoh = servohLimitHigh; } delay(10); } else if (avgright > avgleft) { servohori.write(servoh -1); if (servoh < servohLimitLow) { servoh = servohLimitLow; } delay(10); } else { servohori.write(servoh); } delay(50); }
Upload the code into Arduino and assemble the components
note:- this code is for Arduino Uno if you are using Nano Or mega just Change pin according to your need. 


5 thoughts on “Sun Tracking Solar Panel Project with Arduino

  • April 15, 2019 at 6:04 pm

    Your “How to construct the Sun Tracking Solar Panel Project” needs more detail…… Specifically, how to mount the servos to move it horizontally and vertically. Pictures are good but need either more of them to show the rotation points and how you put it together to work…..

    Thank you


    • April 16, 2019 at 6:34 pm

      Hello David,
      thanks for your valuable comment. we will upload a video tutorial soon. we have your email id we will send you the video link and photos as soon as possible.
      Thanks & Regard

  • April 17, 2019 at 1:17 am

    Can you send me the video link and photos to construct daul axis rotating Solar panel. It’s very nice. I would like to construct it.

    • April 17, 2019 at 8:58 am

      Hello Abhijit,
      Thanks for the appreciation. we have your email id. we will send you the link as soon as possible.
      Thanks & Regards


Leave a Reply

Your email address will not be published. Required fields are marked *