Arduino Robotics Automation LDR Sensors
Solar Tracking System

Project Overview

An automated solar tracking system that uses LDR (Light Dependent Resistor) sensors to track the sun's position and adjust solar panels for maximum efficiency.

Completed: 2024
Status: Completed

Project Simulation

Technical Implementation

The system uses four LDR sensors arranged in a cross pattern to detect light intensity from different directions. Two servo motors control the panel's movement in both horizontal and vertical axes.

solar_tracker.ino
Copied to clipboard!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

#include <Servo.h>

Servo servo1;

Servo servo2;

int LDR1;

int LDR2;

int LDR3;

int LDR4;

int offset1 = 0;

int offset2 = 200;

int val1 = 90;

int val2 = 90;

void setup() {

pinMode(A0, INPUT);

pinMode(A1, INPUT);

pinMode(A2, INPUT);

pinMode(A3, INPUT);

servo1.attach(9);

servo2.attach(10);

servo1.write(90);

servo2.write(90);

Serial.begin(9600);

delay(1000);

}

void loop() {

LDR1 = analogRead(A0) + offset1;

LDR2 = analogRead(A1);

LDR3 = analogRead(A2);

LDR4 = analogRead(A3) + offset2;

Serial.print("LDR1: ");

Serial.print(LDR1);

Serial.print(" LDR2: ");

Serial.print(LDR2);

Serial.print(" LDR3: ");

Serial.print(LDR3);

Serial.print(" LDR4: ");

Serial.print(LDR4);

Serial.print(" val1: ");

Serial.print(val1);

Serial.print(" val2: ");

Serial.println(val2);

if ((LDR2 > LDR4) && (val1 > 0 && val1 <= 175)){

val1 = val1 + 1;

servo1.write(val1);

}

if ((LDR2 < LDR4) && (val1 > 0 && val1 <= 175)){

val1 = val1 - 1;

servo1.write(val1);

}

if ((LDR1 < LDR3) && (val2 > 0 && val2 < 180)){

val2 = val2 + 1;

servo2.write(val2);

}

if ((LDR1 > LDR3) && (val2 > 0 && val2 < 180)){

val2 = val2 - 1;

servo2.write(val2);

}

delay(100);

}

Project Demonstrations

Project Photo

Solar Tracking System in action

Solar Tracking System in action

Key Features

  • Dual-axis solar tracking using two servo motors
  • Four LDR sensors for precise light detection
  • Automatic adjustment based on light intensity
  • Serial monitoring for debugging and calibration
  • Configurable offset values for sensor calibration

How It Works

The system uses four LDR sensors arranged in a cross pattern to detect light intensity from different directions. The sensors are paired (LDR1/LDR3 for vertical movement and LDR2/LDR4 for horizontal movement). When there's a difference in light intensity between paired sensors, the corresponding servo motor adjusts the panel's position to maximize light exposure.

Future Improvements

  • Add weather protection for outdoor use
  • Implement power saving mode during low light conditions
  • Add wireless monitoring capabilities

Go Back