

The Automatic Solar is a device designed to optimize the efficiency of solar panels by automatically adjusting their position to track the sun's movement throughout the day. This ensures maximum sunlight exposure, significantly improving energy generation. The device is equipped with sensors and a motorized mechanism to align the solar panels with the sun's position in real-time.








| Pin Name | Type | Description |
|---|---|---|
| VCC | Power Input | Connect to a 12V DC power supply. |
| GND | Ground | Connect to the ground of the power supply and circuit. |
| LDR1 | Analog Input | Input from the first light-dependent resistor (used for sunlight detection). |
| LDR2 | Analog Input | Input from the second light-dependent resistor (used for sunlight detection). |
| MOTOR+ | Motor Output | Positive terminal of the motor for panel movement. |
| MOTOR- | Motor Output | Negative terminal of the motor for panel movement. |
| EN | Digital Input | Enable pin to activate or deactivate the tracking system. |
| DIR | Digital Input | Direction control pin for motor movement. |
// Automatic Solar Tracking System Code for Arduino UNO
// This code uses two LDRs to control the motor for solar panel alignment.
#define LDR1 A0 // LDR1 connected to analog pin A0
#define LDR2 A1 // LDR2 connected to analog pin A1
#define MOTOR_EN 9 // Motor enable pin connected to digital pin 9
#define MOTOR_DIR 8 // Motor direction pin connected to digital pin 8
void setup() {
pinMode(MOTOR_EN, OUTPUT); // Set motor enable pin as output
pinMode(MOTOR_DIR, OUTPUT); // Set motor direction pin as output
Serial.begin(9600); // Initialize serial communication for debugging
}
void loop() {
int ldr1Value = analogRead(LDR1); // Read value from LDR1
int ldr2Value = analogRead(LDR2); // Read value from LDR2
Serial.print("LDR1: "); // Print LDR1 value for debugging
Serial.print(ldr1Value);
Serial.print(" LDR2: "); // Print LDR2 value for debugging
Serial.println(ldr2Value);
if (ldr1Value > ldr2Value + 50) { // If LDR1 detects more light
digitalWrite(MOTOR_DIR, HIGH); // Set motor direction to one side
analogWrite(MOTOR_EN, 150); // Enable motor with moderate speed
} else if (ldr2Value > ldr1Value + 50) { // If LDR2 detects more light
digitalWrite(MOTOR_DIR, LOW); // Set motor direction to the other side
analogWrite(MOTOR_EN, 150); // Enable motor with moderate speed
} else {
analogWrite(MOTOR_EN, 0); // Stop the motor if light is balanced
}
delay(100); // Small delay for stability
}
Motor Not Moving:
Inaccurate Sunlight Tracking:
Overheating of Components:
No Response from the System:
Can this device handle larger solar panels?
Is it compatible with other microcontrollers?
What happens during cloudy weather?
Can I use a battery as the power source?