0% found this document useful (0 votes)
31 views6 pages

Arduino Solar Tracker Project Guide

This project uses an Arduino and sensors to automatically move solar panels to track the sun's movement and maximize energy production. Light dependent resistors (LDRs) placed around a central solar panel detect changes in light levels. The Arduino reads the LDR values and calculates the sun's position, then uses servo motors to adjust the panel orientation accordingly. When light levels drop at sunset, the panels return to a home position. By continuously optimizing the panel orientation, more solar energy can be harvested than with fixed panels.

Uploaded by

Ahmed Sowilm
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views6 pages

Arduino Solar Tracker Project Guide

This project uses an Arduino and sensors to automatically move solar panels to track the sun's movement and maximize energy production. Light dependent resistors (LDRs) placed around a central solar panel detect changes in light levels. The Arduino reads the LDR values and calculates the sun's position, then uses servo motors to adjust the panel orientation accordingly. When light levels drop at sunset, the panels return to a home position. By continuously optimizing the panel orientation, more solar energy can be harvested than with fixed panels.

Uploaded by

Ahmed Sowilm
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

instructables

Solar Panel Movement Project Using Arduino

by Code Black Zone

Well from when I was kid to till now I always kept on wondering is it possible to make something that allows us to make
the most e cient use of solar light using solar panels as solar panels had a xed shape and when sun was on another
side from which it faced they produced very little electricity
Supplies:

So for this project we need this material


SOLAR PANEL
LI-ION BATTERY
ARDUINO NANO
L293D DRIVER
7806 TRANSISTOR
10K RESISTORS
LDRs
SERVO MOTORS
MALE & FEMALE HEADERS
N20 GEAR MOTOR

Solar Panel Movement Project Using Arduino: Page 1


Step 1: How It Works

The project is based on LDR sensor, I made the rotatable Solar system which has the home position during night time but
when the light is available in day time the solar system automatically waking up through sensing the light presence and
all the solar panels rotate counter clockwise and open like a sun ower and follow the sun rotation, after the sun fallen
down all the solar panels are automatically rotate clockwise and go to the home position for next day sun light

Step 2: What Is a LDR

Light depending resistor is a photo-resistor, which decrease the resistance when the light increases.
An LDR or photo-resistor is made any semiconductor material with a high resistance. It has a high resistance because
there are very few electrons that are free and able to move – the vast majority of the electrons are locked into the crystal
lattice and unable to move. Therefore in this state there is a high LDR resistance.
As light falls on the semiconductor, the light photons are absorbed by the semiconductor lattice and some of their
energy is transferred to the electrons. This gives some of them su cient energy to break free from the crystal lattice so
that they can then conduct electricity. This results in a lowering of the resistance of the semiconductor and hence the
overall LDR resistance.
The process is progressive, and as more light shines on the LDR semiconductor, so more electrons are released to
conduct electricity and the resistance falls further.

Solar Panel Movement Project Using Arduino: Page 2


Step 3: How Does It Calculates the Position of the Sun

As you can see in the above gure that I have placed a sensor in the middle this is why
When the light is minimum, the micro controller Arduino read the resistance value and the the threshold value is sated in
the coding section, when the light is available and the threshold level breaks, the Arduino rotate the n20 gear motor
anticlockwise through the L293D Driver till the limit switch level high, when anticlockwise limit switch pressed the panel
stop rotating and panel is fully opened position when the button is pressed, now the main work is going to progress,
according the sun rotation other 4 LDRs sense the light and send data to the Arduino, and Arduino process the data then
rotate the servo motors according the sun rotation, the rotation position of the servo is max 170 degrees,when the sun
goes down the fth LDR sense data again and this time the process is reverse condition, the LDR data goes down blow
the threshold level and Arduino Rotate the N20 motor clockwise till the 2nd limit switch press and run the servo in home
position, when light is available in next day the same process goes on again.

Solar Panel Movement Project Using Arduino: Page 3


Step 4: The Schematic

Step 5: The Code

#include <Servo.h>

Servo horizontal; // horizontal servo


int servoh = 180;
int servohLimitHigh = 175;
int servohLimitLow = 5;
// 65 degrees MAX

Servo vertical; // vertical servo


int servov = 0;
int servovLimitHigh = 60;
int servovLimitLow = 0;

// LDR pin connections


// name = analogpin;
int ldrlt = A1; //LDR top left - BOTTOM LEFT <--- BDG
int ldrrt = A2; //LDR top rigt - BOTTOM RIGHT
int ldrld = A3; //LDR down left - TOP LEFT
int ldrrd = A4; //ldr down rigt - TOP RIGHT
int ldrmt = A5;

const int button1 = 9;


const int button2 = 10;
const int motorA = 7;
const int motorB = 8;
int buttonStateA = 0;
int buttonStateB = 0;

int pos = 0;
int pos2 = 0;
int oldvalue;
int oldvalue2;

Solar Panel Movement Project Using Arduino: Page 4


void setup(){

[Link](5);
[Link](6);
[Link](180);
[Link](0);
pinMode(motorA, OUTPUT);
pinMode(motorB, OUTPUT);
pinMode(button1, INPUT);
pinMode(button1, INPUT);
delay(2500);
}
void loop() {
int ldrStatus = analogRead(ldrmt);
if (ldrStatus >30) {
buttonStateA = digitalRead(button1);
if (buttonStateA == LOW) {

digitalWrite(motorA, HIGH); //COUNTER clockwise


digitalWrite(motorB, LOW);
}else{digitalWrite(motorA, LOW);
digitalWrite(motorB, LOW);
}

int lt = analogRead(ldrlt); // top left


int rt = analogRead(ldrrt); // top right
int ld = analogRead(ldrld); // down left
int rd = analogRead(ldrrd); // down right
int dtime = 10; int tol = 90; // dtime=diffirence time, tol=toleransi
int avt = (lt + rt) / 2; // average value top
int avd = (ld + rd) / 2; // average value down
int avl = (lt + ld) / 2; // average value left
int avr = (rt + rd) / 2; // average value right
int dvert = avt - avd; // check the diffirence of up and down
int dhoriz = avl - avr;// check the diffirence og left and rigt

//if(lt>90){
//if(Switch_a==LOW){
// digitalWrite(9==HIGH);
// digitalWrite(10==LOW);
// delay(1000);
//}}

if (-1*tol > dvert || dvert > tol)


{
if (avt > avd)
{
servov = ++servov;
if (servov > servovLimitHigh)
{servov = servovLimitHigh;}
}
else if (avt < avd)
{servov= --servov;
if (servov < servovLimitLow)
{ servov = servovLimitLow;}
}
[Link](servov);
}
if (-1*tol > dhoriz || dhoriz > tol) // check if the diffirence is in the tolerance else change horizontal angle
{
if (avl > avr)
{
servoh = --servoh;
if (servoh < servohLimitLow)
{
servoh = servohLimitLow;
}
}
else if (avl < avr)
{
servoh = ++servoh;
if (servoh > servohLimitHigh)
{
servoh = servohLimitHigh;
Solar Panel Movement Project Using Arduino: Page 5
}
}
else if (avl = avr)
{
delay(10);
}
[Link](servoh);
}

delay(dtime);

else{
oldvalue = [Link]();
oldvalue2 = [Link]();

for (pos = oldvalue; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
[Link](pos);
delay(15);
}
for (pos2 = oldvalue2; pos2 <= 0; pos2 += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree

[Link](pos2); // tell servo to go to position in variable 'pos'


delay(15);}
buttonStateB = digitalRead(button2);
if (buttonStateB == LOW) {

digitalWrite(motorA, LOW); //clockwise


digitalWrite(motorB, HIGH);
}else{digitalWrite(motorA, LOW);
digitalWrite(motorB, LOW);
}}}

Solar Panel Movement Project Using Arduino: Page 6

Common questions

Powered by AI

The solar panel uses a combination of LDRs and a controlled motor mechanism to ensure it returns to its home position. At sunset, the LDRs detect low light levels, causing the data to fall below a threshold. The Arduino then commands the N20 motor, via the L293D driver, to rotate the panel clockwise until a second limit switch is pressed. This reverses the daytime adjustments and resets the servos and motor to their original position, preparing the system for the next day .

The setup achieves synchrony through coordinated software instructions and corresponding hardware responses. The Arduino code processes continuous inputs from strategically placed LDRs, computing the sunlight's position relative to the panel. Based on these computations, it directs horizontal and vertical servos to adjust positions accordingly. The code integrates limit switches to ensure the system remains within safe operational bounds, effectively synchronizing movement with environmental changes in sunlight direction .

The Arduino-controlled solar panel uses multiple Light Dependent Resistors (LDRs) to sense light intensity. The panel starts in a home position, and when light is detected, the Arduino assesses the resistance value of the LDRs. If the detected light surpasses a threshold level, the system actuates an N20 gear motor through the L293D driver to rotate the panel counterclockwise until a limit switch is activated, which stops the rotation. As the sun moves, other LDRs detect changes in light intensity, prompting the Arduino to adjust the position of servo motors, allowing the panel to track the sun up to 170 degrees horizontally. When the sun sets, the system reverses this process, returning to the home position for the next day .

The positioning of LDRs on the solar panel is crucial as it directly affects the detection of light from different directions, which informs the panel's movement. LDRs are placed at strategic points—top left, top right, bottom left, bottom right, and in the middle—to capture a comprehensive gradient of light intensity. This arrangement ensures that the panel can discern variations in sunlight direction effectively, allowing the system to compute differences in light intensity (both vertically and horizontally) and adjust the panel's orientation for maximum sun exposure .

The hardware setup includes key components such as the Arduino Nano, LDRs, servo motors, N20 gear motor, and limit switches, which work together to achieve automated functionality. The Arduino serves as the central controller, processing light data from LDRs and managing the servo and motor operations. Servo motors control the panel's horizontal and vertical angles, with the N20 motor providing rotational movement. Limit switches prevent excessive movement by indicating end positions, ensuring the panel operates within safe physical limits. This assembly allows the panel to adjust its orientation based on real-time light readings efficiently .

The Arduino code uses inputs from the LDRs to determine the direction and intensity of sunlight. It calculates average light values (both vertically and horizontally) and compares them against set tolerance levels. The code adjusts the position of the horizontal and vertical servos by incrementing or decrementing their values, keeping them within their predefined limits, to align the panel optimally with the sun. The system is designed to perform checks in regular intervals, ensuring continuous adjustment, which maximizes power generation efficiency .

The tolerance value in the Arduino code defines the range of light difference needed to trigger servo adjustments. It ensures that the panel reacts only to significant changes in light direction, preventing needless movements due to minor variations. This optimizes motor usage, reduces wear and tear, and saves energy, enhancing the system's overall efficiency by ensuring the panel makes adjustments only when beneficial for optimizing sunlight capture .

Limit switches play a critical safety role, preventing the excessive rotation of the solar panel that could lead to mechanical damage or system malfunction. They act as physical sensors that signal the Arduino when maximum rotation angles are reached, triggering the system to cease motor activity to avoid mechanical strain. This not only protects the hardware but also ensures accurate repositioning of the panel, essential for its functionality .

Potential limitations of LDRs include susceptibility to environmental anomalies like shadows or dust accumulation that can affect light reading accuracy. Enhancements could involve incorporating additional sensors like infrared or UV sensors to cross-verify LDR data or employing machine learning algorithms to predict sun paths and adjust movements accordingly. Cleaning mechanisms or protective coverings for LDRs could also reduce inaccuracies due to dirt or obstruction .

LDRs, or Light Dependent Resistors, are critical in the solar panel movement system as they detect variations in light intensity. Made from a semiconductor material, their resistance decreases as light intensity increases. This property is utilized to measure light levels around the solar panel. When the light intensity surpasses a set threshold, LDRs trigger the Arduino to adjust the panel's position for optimal sunlight exposure. Their ability to sense and differentiate light from different angles allows the system to accurately track the sun throughout the day .

You might also like