Solar Tracking System

Dual-Axis Solar Tracking System Using Arduino

Build a Dual-Axis Solar Tracking System Using Arduino

In this project, we'll create a DIY dual-axis solar tracking system that adjusts a solar panel's orientation in two directions for optimal sunlight capture. By using light-sensitive sensors and Arduino, the system dynamically tracks sunlight to maximize energy generation.


How the System Works

The dual-axis system uses four LDR sensors and four resistors in voltage divider circuits to measure light intensity from multiple directions. These readings are processed by the Arduino, which controls servo motors to adjust the panel's horizontal and vertical positions for optimal sunlight exposure.


Materials Required


3D Model Files

Download the 3D printable files for the project enclosure and mounting brackets:

Google Drive

Print these files using JLCPCB's 3D printing service:

Order Now

Circuit Diagram

🎥 Watch the video above for full assembly and demonstration.


Arduino Code

#include <Servo.h>  

Servo horizontal; // Horizontal Servo Motor
int servohori = 180;  
int servohoriLimitHigh = 175;
int servohoriLimitLow = 5;

Servo vertical; // Vertical Servo Motor
int servovert = 45;  
int servovertLimitHigh = 100;
int servovertLimitLow = 1;

// LDR pin connections
int ldrlt = A0; // Bottom Left LDR
int ldrrt = A3; // Bottom Right LDR
int ldrld = A1; // Top Left LDR
int ldrrd = A2; // Top Right LDR

void setup() {
  horizontal.attach(2);
  vertical.attach(13);
  horizontal.write(180);
  vertical.write(45);
  delay(2500);
}

void loop() {
  int lt = analogRead(ldrlt); // Top left
  int rt = analogRead(ldrrt); // Top right
  int ld = analogRead(ldrld); // Bottom left
  int rd = analogRead(ldrrd); // Bottom right

  int dtime = 10;  
  int tol = 90; // Tolerance value for adjustment

  int avt = (lt + rt) / 2; // Average value of top sensors
  int avd = (ld + rd) / 2; // Average value of bottom sensors
  int avl = (lt + ld) / 2; // Average value of left sensors
  int avr = (rt + rd) / 2; // Average value of right sensors

  int dvert = avt - avd; // Difference between top and bottom
  int dhoriz = avl - avr; // Difference between left and right

  if (abs(dvert) > tol) {  
    if (avt > avd) {
      servovert = ++servovert;
      if (servovert > servovertLimitHigh) servovert = servovertLimitHigh;
    } else {
      servovert = --servovert;
      if (servovert < servovertLimitLow) servovert = servovertLimitLow;
    }
    vertical.write(servovert);
  }

  if (abs(dhoriz) > tol) {  
    if (avl > avr) {
      servohori = --servohori;
      if (servohori < servohoriLimitLow) servohori = servohoriLimitLow;
    } else {
      servohori = ++servohori;
      if (servohori > servohoriLimitHigh) servohori = servohoriLimitHigh;
    }
    horizontal.write(servohori);
  }

  delay(dtime);
}

Code Explanation:

Setup:

Initializes the servo motors and sets their initial positions. The horizontal servo starts at 180 degrees and the vertical servo at 45 degrees.

Loop:

Continuously reads the four LDR sensors, calculates average light intensities from different directions, and adjusts the servo positions accordingly to maximize sunlight exposure. The system compares light intensity differences and moves the panel toward the brighter direction within predefined limits.


Why Choose Dual-Axis?

  • Improved Tracking: Captures sunlight from both vertical and horizontal directions, maximizing energy generation
  • 🔄 Scalability: Can be adapted for larger panels or more sensors for higher precision
  • 🌞 Higher Efficiency: Increases solar energy capture by up to 40% compared to fixed panels

Key Benefits

This system provides an excellent opportunity to explore renewable energy technologies while increasing the efficiency of solar panels. It's an engaging and practical project for anyone interested in Arduino and sustainable energy solutions.

Comments

Post a Comment

Popular posts from this blog

Arduino Code Car Parking System

Arduino Code