Solar tracking system project

Solar energy is a clean and abundant renewable resource. However, the efficiency of solar panels depends on the angle at which they receive sunlight. As the sun moves across the sky throughout the day, a fixed solar panel won’t be directly facing the sun all the time. This is where solar tracking systems come in. A solar tracking system uses sensors and motors to automatically adjust the position of a solar panel throughout the day. This ensures the panel remains perpendicular to the sun’s rays, maximizing the amount of sunlight it captures.

There are two main types of solar tracking systems based on the number of axes they rotate on: single-axis and dual-axis. Single-axis systems are simpler and more common for hobbyist projects. They typically rotate the solar panel along a horizontal axis, tracking the sun’s east-west movement. Dual-axis systems offer more precise tracking by adjusting the panel on both horizontal and vertical axes, following the sun’s position throughout the day. These are more complex but can achieve higher efficiency gains.

Let us design a solar tracker using two servo motors, a light sensor consisting of four LDRs and Arduino UNO board.

Circuit Diagram

The circuit design of solar tracker is simple but setting up the system must be done carefully.

Four LDRs and Four 100KΩ resistors are connected in a voltage divider fashion and the output is given to 4 Analog input pins of Arduino.

The PWM inputs of two servos are given from digital pins 9 and 10 of Arduino.

Components Required

Arduino Solar Tracker Working

LDRs are used as the main light sensors. Two servo motors are fixed to the structure that holds the solar panel. The program for Arduino is uploaded to the microcontroller. The working of the project is as follows.

LDRs sense the amount of sunlight falling on them. Four LDRs are divided into top, bottom, left and right.

For east – west tracking, the analog values from two top LDRs and two bottom LDRs are compared and if the top set of LDRs receive more light, the vertical servo will move in that direction.

If the bottom LDRs receive more light, the servo moves in that direction.

For angular deflection of the solar panel, the analog values from two left LDRs and two right LDRs are compared. If the left set of LDRs receive more light than the right set, the horizontal servo will move in that direction.

If the right set of LDRs receive more light, the servo moves in that direction.

Setup

Step-1

Step 2

Step 3

Step 4

Step 5

Step 6

Step 7

Take another straight Perforated metal strip and bend it as shown in the figure.

Step 8

Now place the set up of solar panel and first servo motor to the metal strip of second servo motor as shown.

Project Code

#include <Servo.h>
//defining Servos
Servo servohori;
int servoh = 0;
int servohLimitHigh = 160;
int servohLimitLow = 20;
Servo servoverti;
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);
  servohori.write(0);
  servoverti.attach(9);
  servoverti.write(0);
  delay(500);
 }
void loop()
{
  servoh = servohori.read();
  servov = servoverti.read();
  //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);
}