Department of Electrical and Electronic Engineering
Jashore University of Science and Technology
PROJECT REPORT
Course Code: EEE 4201
Name of the Project: Smart Solar Tracker with Dual-Axis Control
Submitted by
Ahir Supto ( 201130) Siyam Azad (201135)
Mahfuze Alam Shahin ( 201132) Shakil Hossain (201136)
Misun Kumar Paul ( 201133) Nabila Rahman Ritu(201137)
Date of Submission: 04/08/2025
1. Project Objective
The goal of this project is to develop and implement an intelligent solar panel tracking system. The
system's primary function is to automatically adjust the orientation of a solar panel to align it
perpendicularly with the sun's rays. This dynamic adjustment maximizes the panel's exposure to sunlight,
thereby significantly increasing its energy generation efficiency throughout the day. The energy generated
is then stored in a rechargeable battery for later use.
2. Working Principle
The solar tracker operates on a closed-loop feedback control system using a Proportional-Integral-
Derivative (PID) controller.
• Sensing: The system uses four Light-Dependent Resistors (LDRs) positioned in a cross pattern
(Top-Left, Top-Right, Bottom-Left, Bottom-Right) on a mount. These sensors provide an analog
voltage signal that varies with light intensity.
• Error Calculation: The Arduino continuously reads the LDR values and calculates the
difference in light intensity between opposing pairs of sensors (e.g., Top vs. Bottom, Left vs.
Right). This difference serves as the "error" signal for the PID controller.
• PID Control: The PID algorithm processes the error signal to generate a precise control output.
o Proportional (Kp): Corrects the current error.
o Integral (Ki): Eliminates small, persistent errors, ensuring the panel aligns perfectly.
o Derivative (Kd): Dampens the system's response, preventing overshooting and
oscillations for smooth movement.
• Actuation: The PID output is used to control two servo motors.
o One servo adjusts the horizontal axis (left-right movement).
o The other servo adjusts the vertical axis (up-down movement).
• Feedback Loop: The servo movements change the light distribution on the LDRs, and the entire
process repeats, creating a continuous feedback loop that keeps the panel centered on the sun.
• Power Management: The energy captured by the solar panel is routed to a TP4056 charger
module to safely charge a lithium-ion battery, making the system self-sufficient.
3. Component List
Table 1: Components needed
Component Quantity Description
Arduino Uno 1 Microcontroller for control logic and sensor processing.
LDR Module 4 Light-dependent resistors for sensing sunlight direction.
Servo Motor MG90S 2 Actuators for dual-axis (horizontal and vertical) panel
(180°) movement.
Mini Solar Panel 1 The energy source for the system.
(60x60mm)
14500 Lithium Battery 1 A 3.7V, 1200mAh rechargeable battery for energy storage.
TP4056 Charger Module 1 A charge controller for the lithium battery with built-in
protection.
9V Battery 1 A temporary power source for testing the buck regulator.
Buck Regulator 1 A DC-DC step-down converter to provide a stable 5V
output.
Breadboard 1 For prototyping the circuit without soldering.
AA Size Battery Holder 1 Used for connecting the 9V battery.
Jumper Wires Varies For making all the electrical connections.
4. Hardware Wiring and Schematics
A well-organized wiring setup is critical for this project.
1. Power Supply:
o The 9V battery is connected to the input of the Buck Regulator.
o The Buck Regulator's output is set to 5V and connected to the power and ground rails
of the Breadboard.
o A common ground is established by connecting a jumper wire from the Breadboard's
GND rail to an Arduino GND pin.
o Important: The servos are powered directly from the breadboard's 5V rail, not the
Arduino's 5V pin, to prevent overloading the Arduino's voltage regulator.
2. LDR Sensors:
o The four LDR modules are connected as follows:
▪ VCC pin of each module to the 5V rail on the breadboard.
▪ GND pin of each module to the GND rail on the breadboard.
▪ Signal pins connect to Arduino's analog pins A0, A1, A2, and A3.
3. Servo Motors:
o The two MG90S servos are connected:
▪ Red wire (VCC) to the 5V rail on the breadboard.
▪ Brown/Black wire (GND) to the GND rail on the breadboard.
▪ Yellow/Orange wire (Signal) to Arduino's digital pins 9 and 10.
4. Charging Circuit:
o The Mini Solar Panel's + and - wires connect to the IN+ and IN- terminals of the
TP4056 module.
o The BAT+ and BAT- terminals of the TP4056 connect to the + and - terminals of the
14500 Lithium Battery.
5. Software and Code
The project code is written for the Arduino IDE. It requires the Servo.h and PID_v1.h libraries. The code
implements a dual-axis PID control loop to manage the servo movements based on LDR sensor feedback.
A small delay in the main loop is crucial to prevent rapid, jittery movements and allow the servos time to
respond to commands. PID constants (Kp, Ki, Kd) may need to be tuned for optimal performance based on
the specific hardware setup and environment.
Code:
#include <Servo.h>
// Define pins for LDRs
#define LDR_TL_PIN A0 // Top-Left LDR
#define LDR_TR_PIN A1 // Top-Right LDR
#define LDR_BL_PIN A2 // Bottom-Left LDR
#define LDR_BR_PIN A3 // Bottom-Right LDR
// Define pins for servo motors
#define HORIZONTAL_SERVO_PIN 9
#define VERTICAL_SERVO_PIN 10
Servo horizontalServo; // Servo for horizontal movement
Servo verticalServo; // Servo for vertical movement
// Variables for servo positions
int horizontalPos = 90; // Start at 90 degrees (center)
int verticalPos = 90; // Start at 90 degrees (center)
// Threshold for movement
int tolerance = 10;
void setup() {
[Link](HORIZONTAL_SERVO_PIN);
[Link](VERTICAL_SERVO_PIN);
[Link](horizontalPos);
[Link](verticalPos);
[Link](9600); // For debugging
void loop() {
// Read all four LDR values
int tl = analogRead(LDR_TL_PIN);
int tr = analogRead(LDR_TR_PIN);
int bl = analogRead(LDR_BL_PIN);
int br = analogRead(LDR_BR_PIN);
// Calculate average light for horizontal and vertical axes
int topAvg = (tl + tr) / 2;
int botAvg = (bl + br) / 2;
int leftAvg = (tl + bl) / 2;
int rightAvg = (tr + br) / 2;
// Calculate the difference for each axis
int vertDiff = topAvg - botAvg;
int horzDiff = leftAvg - rightAvg;
// --- Vertical Movement (Up-Down) ---
if (abs(vertDiff) > tolerance) {
if (vertDiff > 0) {
// Top is brighter, move panel up
verticalPos++;
} else {
// Bottom is brighter, move panel down
verticalPos--;
// --- Horizontal Movement (Left-Right) ---
if (abs(horzDiff) > tolerance) {
if (horzDiff > 0) {
// Left is brighter, move panel left
horizontalPos++;
} else {
// Right is brighter, move panel right
horizontalPos--;
}
// Constrain the servo positions to a safe range (0-180)
horizontalPos = constrain(horizontalPos, 0, 180);
verticalPos = constrain(verticalPos, 0, 180);
// Write new positions to the servos after all calculations
[Link](horizontalPos);
[Link](verticalPos);
// Small delay to prevent jittering
delay(50);
[Link] Diagram:
Fig:1 Circuit Diagram
7. Implementation and Tuning
1. Hardware Assembly: Follow the wiring diagram to connect all components on the breadboard.
2. Software Setup: Install the Arduino IDE and the PID_v1 library.
3. Code Upload: Copy the provided Arduino code into a new sketch, select the correct board
(Arduino Uno) and COM port, and upload the code.
4. Tuning: Use the Serial Monitor to observe sensor readings and PID outputs. Adjust the Kp, Ki,
and Kd values in the code to achieve smooth, accurate, and stable tracking without overshooting
or oscillation.
8. Future Improvements
• Integrated Power Supply: Design a single, unified power management system that intelligently
switches between the solar charger, battery, and load.
• Low-Power Sleep Mode: Implement a routine to put the Arduino into a low-power sleep mode
during the night to conserve battery power.
• MPPT: Integrate a more sophisticated Maximum Power Point Tracking (MPPT) algorithm to
optimize the electrical output of the solar panel, working in conjunction with the physical tracker.
• Weather Resistance: Enclose the electronics in a weather-resistant casing for long-term outdoor
deployment.
9. References
• Arduino Documentation and Tutorials: [Link]
• PID Control Theory: [Link]