A solar tracker system built with Arduino is one of the most rewarding intermediate-level DIY electronics projects you can undertake. A well-designed solar tracker improves energy collection from a fixed solar panel by 25-45% for a single-axis tracker and up to 35-55% for a dual-axis system. This comprehensive guide covers the electronics, mechanics, and complete Arduino code for both single and dual axis solar trackers that Indian makers can build for under Rs 3,000.
Table of Contents
- Why Build a Solar Tracker?
- Single Axis vs Dual Axis Trackers
- Components Required and Cost
- LDR Sensor Circuit Design
- Single Axis Tracker Arduino Code
- Dual Axis Tracker Arduino Code
- Mechanical Design Tips
- Frequently Asked Questions
Why Build a Solar Tracker?
Fixed solar panels are typically tilted at a fixed angle (equal to local latitude) facing south. This is optimal for annual energy production but not for any given day. The sun moves across the sky from east to west (azimuth) and changes elevation throughout the day (altitude). A tracker follows this movement, keeping panels perpendicular to solar radiation for maximum power.
Expected energy gains for an Arduino-based solar tracker system:
- Single axis (East-West tracking): +25-35% over fixed panel
- Dual axis (full sun tracking): +35-55% over fixed panel
- Most gain in morning and evening when sun is at low angles
- Payback time for a tracking system: 2-4 years on a large panel array
Single Axis vs Dual Axis Trackers
For a DIY project, choose based on your requirements:
- Single axis (East-West): Tracks the sun’s daily path. One servo motor. Simpler mechanics. Best for most DIY and educational projects.
- Single axis (seasonal tilt): Adjusts panel tilt for winter/summer seasons. Manual or motorised. Only 3-5% improvement over fixed optimal tilt.
- Dual axis: Tracks both East-West (azimuth) and elevation (altitude). Two servo motors. Maximum energy harvest. More complex mechanically. Best for serious solar projects.
Components Required and Cost
| Component | Specification | Cost (INR) |
|---|---|---|
| Arduino UNO R3 | ATmega328P | Rs 350-500 |
| Servo motors | MG996R (1 for single axis, 2 for dual) | Rs 250-400 each |
| LDR sensors | GL5528 x 4 (2 pairs) | Rs 5-10 each |
| Resistors | 10k ohm x 4 | Rs 5 |
| Perfboard or breadboard | Standard size | Rs 50-100 |
| Jumper wires | M-M, M-F pack | Rs 50 |
| Power supply | 5V 2A adapter or 9V battery | Rs 100-200 |
| Acrylic/aluminium frame | For panel mounting | Rs 200-500 |
Total cost: Rs 1,200-2,000 for single axis, Rs 1,800-3,000 for dual axis.
LDR Sensor Circuit Design
Four LDRs are arranged in a cross pattern with a divider/shadow barrier between them. This creates differential light readings that tell the controller which direction has more sunlight.
/* LDR Placement for Dual Axis Tracker:
Sensor arrangement (top view):
[LDR_NW] | [LDR_NE]
---------+---------- (shadow barrier)
[LDR_SW] | [LDR_SE]
East-West: Compare (NE + SE) vs (NW + SW)
North-South: Compare (NW + NE) vs (SW + SE)
Voltage divider circuit for each LDR:
+5V ---[LDR]---+---[10k]--- GND
|
Analog input
When sun is in East: NE and SE brighter
When sun is in West: NW and SW brighter
*/
Single Axis Tracker Arduino Code
#include <Servo.h>
Servo azimuthServo;
// LDR pins
const int LDR_EAST = A0;
const int LDR_WEST = A1;
// Servo settings
const int SERVO_PIN = 9;
const int SERVO_MIN = 0; // 0 degrees (facing east)
const int SERVO_MAX = 180; // 180 degrees (facing west)
const int TOLERANCE = 50; // ADC units deadband
int servoPos = 90; // Start facing south
void setup() {
azimuthServo.attach(SERVO_PIN);
azimuthServo.write(servoPos);
Serial.begin(9600);
delay(1000);
}
void loop() {
int east = analogRead(LDR_EAST);
int west = analogRead(LDR_WEST);
int diff = east - west;
Serial.print("East: "); Serial.print(east);
Serial.print(" West: "); Serial.print(west);
Serial.print(" Diff: "); Serial.println(diff);
// Move servo toward brighter side
if (diff > TOLERANCE && servoPos < SERVO_MAX) {
servoPos += 1; // Move east
azimuthServo.write(servoPos);
} else if (diff < -TOLERANCE && servoPos > SERVO_MIN) {
servoPos -= 1; // Move west
azimuthServo.write(servoPos);
}
// Night reset: if total light very low, return to east
if (east < 50 && west < 50) {
servoPos = SERVO_MIN; // Reset to face east for sunrise
azimuthServo.write(servoPos);
delay(30000); // Wait 30 sec to confirm darkness
}
delay(500); // Check every 500ms
}
Dual Axis Tracker Arduino Code
#include <Servo.h>
Servo azimuth, altitude;
// LDR pins (4 sensors)
const int LDR_NE = A0, LDR_NW = A1;
const int LDR_SE = A2, LDR_SW = A3;
const int TOLERANCE = 50;
int azPos = 90, altPos = 45; // Start south, 45 deg tilt
void setup() {
azimuth.attach(9);
altitude.attach(10);
azimuth.write(azPos);
altitude.write(altPos);
Serial.begin(9600);
}
void loop() {
int ne = analogRead(LDR_NE), nw = analogRead(LDR_NW);
int se = analogRead(LDR_SE), sw = analogRead(LDR_SW);
// Average for each direction
int avgEast = (ne + se) / 2;
int avgWest = (nw + sw) / 2;
int avgNorth = (ne + nw) / 2; // Higher elevation (for India, south is sun-facing)
int avgSouth = (se + sw) / 2;
// East-West tracking (azimuth)
if (avgEast - avgWest > TOLERANCE && azPos < 180) {
azPos++;
azimuth.write(azPos);
} else if (avgWest - avgEast > TOLERANCE && azPos > 0) {
azPos--;
azimuth.write(azPos);
}
// Elevation tracking (altitude)
// In India: sun is to the SOUTH, so higher reading on S sensors
// means panel needs to tilt more toward sun (increase tilt angle)
if (avgSouth - avgNorth > TOLERANCE && altPos < 85) {
altPos++;
altitude.write(altPos);
} else if (avgNorth - avgSouth > TOLERANCE && altPos > 5) {
altPos--;
altitude.write(altPos);
}
// Night reset
int totalLight = ne + nw + se + sw;
if (totalLight < 200) { // Very dark
azPos = 0; // Face east for morning
altPos = 20; // Low tilt for sunrise
azimuth.write(azPos);
altitude.write(altPos);
delay(60000); // Wait 1 minute
}
delay(300);
}
Mechanical Design Tips
- MG996R servo: Provides 9.4 kg-cm torque — sufficient for panels up to 200W (about 1.5 kg). For larger panels, use 12V DC motors with motor drivers (L298N).
- Ball bearing pivot: Use a 25mm ball bearing at the central pivot point to reduce friction and servo load. Available at Rs 50-100 at bicycle shops.
- Counterbalancing: Balance the panel on the pivot axis to reduce torque requirement by 70-80%. This allows using smaller, cheaper servos.
- Weatherproofing: Use IP65 junction boxes for the Arduino and circuit board. Seal cable entry points with silicone. Arduino UNO itself is not weatherproof.
- Wind load: For panels above 50W, add wind stops (limit switches) at extreme positions to prevent over-rotation in strong winds.
Frequently Asked Questions
How much energy does a solar tracker actually save?
For a 100W panel, a single-axis tracker adds approximately 25-35W average extra output, translating to 0.8-1.5 kWh extra per day depending on location. At Rs 7/unit, this is Rs 5-10/day or Rs 150-300/month extra income/saving — significant for a Rs 1,500 tracker investment.
Can I use a stepper motor instead of a servo?
Yes. Stepper motors (NEMA 17 with A4988 driver) provide more precise positioning and higher torque. They are better for large panel trackers but require more power (400mA-1.5A per motor vs servo’s 100-300mA). Modify the code to use step count instead of servo write commands.
Will the tracker survive Indian monsoon?
Standard Arduino and MG996R servos are not waterproof. For permanent outdoor installation, waterproof the Arduino in a sealed IP65 enclosure, use waterproof servos (DS3235 or MG996R with silicone seal), and use UV-stabilised nylon hardware for the mechanical structure.
What is the accuracy of this LDR-based tracker vs an astronomical tracker?
LDR-based trackers achieve ±5-10 degree accuracy in clear conditions. Diffuse (cloudy) light confuses LDR trackers as there is no directional light source. Astronomical trackers (GPS + RTC + solar position algorithm) achieve ±0.1-1 degree accuracy and work in all weather. See Michalsky (1988) solar position algorithm for Arduino implementation.
Add comment