Saturday, 13 July 2013

Sun Tracking Solar Panel

      In this post I am going to show you the step-by-step procedure to make your own home made sun tracker. Before going to do that let me give a brief description on what is a sun tracker and what are its advantage.

What is a Sun Tracker?

            A sun tracker is a automatic platform for solar panel which always turns its face towards the sun throughout the day like a sun flower by using some photo sensors like Photoresistors.

Advantage of Sun Tracker:

            The sun tracker system is mostly used to expose the surface of the Solar panel towards the sun which enables the solar panel to convert the maximum available sun light to electrical energy. When compared to the electrical energy generated by a stationary solar panel with a solar panel on a sun tracking system the amount of energy generated is more than 200 %.
            The following video will show you how the sun tracking system will work.

Steps to build a Sun tracking solar panel:


            First of all you have to gather all the materials required to build the sun tracking system.

     Materials required:

1.      Solar panel
2.      Arduino
3.      Servo motor
4.      Photoresistors (two)
5.      Resistors (2 x 3K ohms)
6.      Connecting wires and
7.      9 V battery to power the Arduino

Step 2-Creating the base for solar panel:

            In this step make a platform to place the Solar panel and photoresistors.
            Take a cardboard sheet and divide it into three equal parts (don’t cut the sheet into three parts just mark some lines) then bend the cardboard at the markings and stick the ends with a tape. The final piece will looks like the one in the following picture.


           Make two holes at the center of both the sides (right and left) of the cardboard to place the Photoresistors (sensors). After that insert the two legs of the photoresistor into the holes made in the previous step then connect some long wires to the legs of both the photoresistors by soldering. Make sure that the wires connected to the photoresistors are long enough so that they dont comes out of the breadboard when the base of Solar panel turns completely towards its right or left.
           Now attach the Triangular base on the axis of the Servo motor with some double sided tape. After that place the solar panel on the Triangular base and stick the panel to the base so that it won't fell down when the servo rotates.
          Now attach the whole setup (Servo motor along with the triangular base and Solar panel) on a stationary base. I had used an cardboard box as its base. left some place on the base to place the breadboard to make the connections for the servo, sensors and Arduino.

Step 3-connecting the circuit:

            The following picture shows you the connections for the photoresistors and Servo motor with the Arduino.


Step 4-Programming the Arduino:

                   Now its time to write some code for the Arduino to make it work. Here is the simple code for the Arduino microcontroller. I tried to make the code as simple as possible.

 #include <Servo.h>  
 Servo myservo;          // create servo object to control a servo  
 int sensorOne=2;         //digital pin 2 has connected to the resistor of first sensor  
 int sensorTwo=3;         //digital pin 3 has connected to the resistor of second sensor  
 int inputOne=0;          //variable to store the values from the analog pin 0  
 int inputTwo=1;          //variable to store the values form the analog pin1  
 int currPos=0;          // variable to store the servo position  
 void setup()  
  pinMode(sensorOne,OUTPUT);   //initialize the digital pin as output  
  pinMode(sensorTwo,OUTPUT);   //initialize the digital pin as output  
  myservo.attach(9);         // attaches the servo on pin 9 to the servo object   
  myservo.write(currPos);    // tell servo to go to position in variable 'pos'  
 void loop()  
  int valueOne=analogRead(inputOne);   //reads the value from the right sensor  
  int valueTwo=analogRead(inputTwo);   //reads the value from the left sensor  
  int diff=valueOne-valueTwo;          //difference of two values from the sensors  
  if(valueOne<950 || valueTwo<950)    //if light is present  
    if(diff>=100)                //if light source is towards right  
     myservo.write(currPos);     // tell servo to go to position in variable 'pos'  
     delay(30);                 // waits 30ms for the servo to reach the position  
    else if(diff<=-100)              //if light source is towards left  
     myservo.write(currPos);     // tell servo to go to position in variable 'pos'  
     delay(30);                // waits 30ms for the servo to reach the position  
    }                            //end of inner if block  
  }                           //end of main if block  
 }                            //end of void loop() method  

             Now, upload the code into the Arduino by using the Arduino IDE. It will take only few seconds. Make sure that you have selected the correct Arduino board and the chip used on your Arduino board. My board is Arduino UNO with ATmega328 chip.

How the code works:

            In the above program the main if block (if(valueOne<950 || valueTwo<950)) executes only when light is present. The inner if-else is used to know in which side the sun is present (right side or left side). If the sun is present towards the right side of the solar panel the servo moves the solar panel towards the right side in steps of two degrees until the difference of the values from two sensors is less than 100 units. If the sun is present towards the left side of the solar panel then the servo moves towards its left in steps of two degrees until the difference of the values from two sensors is greater than -100 units.

Step 5-Testing:

            The final step is to test your own Sun tracking solar panel system in the presence of sun or under a light source like touch light. Make sure that the wires connected to the two sensors are long enough to reach when the base of the solar panel moves towards its left and right.

                               Is this post helpful to you? Please feel free to comment.

Related posts:


  1. great post yar ....

  2. Hi sir, I want to try this myself. Only trouble I am facing is I am unable to find which servo suits for this project. Can you tell me the model of the servo used in this project and please tell me where can I find that servo

    1. Chetan,
      You can use any servo available with you. anyway, the servo used in this project is VS-1. If you are from INDIA here is the list of Online stores where you can find the hardware used in this project -

  3. Hi, i need hex file with this simulation. can u send me. my email.

  4. How to program the arduino

    1. Use Arduino IDE to upload the code into Arduino microcontroller. you can find more information on official site of arduino -->

  5. nice info ! about sun tracking solar panel system

  6. You really delivered reliable information. Thank you regarding discussing power

  7. Is there any way to purchase this as a kit or better yet, fully completed and pre programmed? For those of us who aren't as tech savvy, but who would also like to experiment, or engage in a project like this one, a prefab, or a kit would be awesome! :)

  8. Thank you for sharing this. I am hoping to use this to track the sun for a solar oven. I hope to document it and share like you did.

  9. Great post! I am going to try this to keep a solar oven focused on the sun. Do you think a blinder my be useful for the Photoresistors?

  10. I know it's been better than a year since you posted this. This is really a good idea. However I am having a hard time getting it to work correctly. I have followed the schematic and applied the code. However the servo instantly starts spinning. Short later it changes direction and continues to spin. What is the wattage rating of the resisters? I am using 1/2 watt.

  11. Great job. But we need identical photo resistors right?
    Also you built it for just one dimension which means just right and left. If we need to build it as 2 dimensions which mean two servos and more productive. How can we write the code by doing addition?

  12. This comment has been removed by a blog administrator.

  13. Where would I connect the solar panel t, in order to operate a small water pump.

    I have a similar working module in my yard.