Back to Advanced Projects

☀️ Dual-Axis Solar Tracker

Maximize solar panel efficiency by tracking the suns position.

📋 Overview

Solar panels produce maximum power when perpendicular to the sun. By placing LDRs (Light Dependent Resistors) on each side of the panel, we can tilt it towards the brightest light source.

What you'll learn: Differential analog sensing, dual-servo control, and closed-loop position feedback.

Estimated time: 3-4 hours. Difficulty: ⭐⭐⭐ Intermediate.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R35V1
LDRsPhotoresistors4
Resistors10k Ohm4For LDR voltage dividers
Servo MotorsSG90 or MG90S2Pan and Tilt
Mini Solar Panel5V Output1For demonstration

📖 Step-by-Step Tutorial

1

Build the Divider Array

Create a cross-shaped baffle with cardboard. Place one LDR in each quadrant. Wire each LDR with a 10k resistor to analog pins A0-A3.
2

Mount the Servos

Attach a Pan servo to the base, and mount the Tilt servo on top of the Pan servo horn.
3

Logic Implementation

Calculate averages: Top (A0+A1), Bottom (A2+A3), Left (A0+A2), Right (A1+A3). Move servos to balance them.
4

Tuning

Add a deadband tolerance so the servos dont jitter rapidly when light levels are almost equal.
💡
Physical baffles (dividers) between the LDRs are required. Without shadows falling on the LDRs when pointing away from the light, tracking won't work.

💻 Code / Configuration

solar_tracker.ino
INO
// Solar Tracker
#include <Servo.h>

Servo panServo, tiltServo;
int panAngle = 90, tiltAngle = 90;

void setup() {
  panServo.attach(9); tiltServo.attach(10);
  panServo.write(panAngle); tiltServo.write(tiltAngle);
}

void loop() {
  int tl = analogRead(A0); int tr = analogRead(A1);
  int bl = analogRead(A2); int br = analogRead(A3);

  int avgTop = (tl + tr) / 2;
  int avgBot = (bl + br) / 2;
  int avgLeft = (tl + bl) / 2;
  int avgRight = (tr + br) / 2;
  
  int tol = 30; // Deadband tolerance

  if (abs(avgTop - avgBot) > tol) {
    if (avgTop > avgBot) tiltAngle--; else tiltAngle++;
  }

Reviews & Ratings

0 reviews
5★
0
4★
0
3★
0
2★
0
1★
0
...

Loading reviews...