Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
84 views

Required Item-: Solar Tracking System Using Arduino

This document describes a solar tracking system using an Arduino that orients a solar panel toward the sun using two servo motors and feedback from four light dependent resistors (LDRs). The system includes an Arduino, solar panel, four LDRs, two servo motors to control the panel's horizontal and vertical position, and some wiring. The Arduino code uses the LDR readings to calculate the average light level in different positions and orient the servos to maximize light collection by moving the panel toward the position with the highest light reading.

Uploaded by

Fabio Novaes
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Required Item-: Solar Tracking System Using Arduino

This document describes a solar tracking system using an Arduino that orients a solar panel toward the sun using two servo motors and feedback from four light dependent resistors (LDRs). The system includes an Arduino, solar panel, four LDRs, two servo motors to control the panel's horizontal and vertical position, and some wiring. The Arduino code uses the LDR readings to calculate the average light level in different positions and orient the servos to maximize light collection by moving the panel toward the position with the highest light reading.

Uploaded by

Fabio Novaes
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Solar Tracking System Using Arduino

Required item-
1. Arduino
2. Solar Panel
3. LDR – quantity 4
4. Servo Motor- quantity 2
5. Wire

Connection-

Code-
#include <Servo.h>
//defining Servos
Servo servohori;
int servoh = 0;
int servohLimitHigh = 160;
int servohLimitLow = 20;
Servo servoverti;
int servov = 0;
int servovLimitHigh = 160;
int servovLimitLow = 20;
//Assigning LDRs
int ldrtopl = 2; //top left LDR green
int ldrtopr = 1; //top right LDR yellow
int ldrbotl = 3; // bottom left LDR blue
int ldrbotr = 0; // bottom right LDR orange
void setup ()
{
servohori.attach(10);
servohori.write(0);
servoverti.attach(9);
servoverti.write(0);
delay(500);
}
void loop()
{
servoh = servohori.read();
servov = servoverti.read();
//capturing analog values of each LDR
int topl = analogRead(ldrtopl);
int topr = analogRead(ldrtopr);
int botl = analogRead(ldrbotl);
int botr = analogRead(ldrbotr);
// calculating average
int avgtop = (topl + topr) / 2; //average of top LDRs
int avgbot = (botl + botr) / 2; //average of bottom LDRs
int avgleft = (topl + botl) / 2; //average of left LDRs
int avgright = (topr + botr) / 2; //average of right LDRs
if (avgtop < avgbot)
{
servoverti.write(servov +1);
if (servov > servovLimitHigh)
{
servov = servovLimitHigh;
}
delay(10);
}
else if (avgbot < avgtop)
{
servoverti.write(servov -1);
if (servov < servovLimitLow)
{
servov = servovLimitLow;
}
delay(10);
}
else
{
servoverti.write(servov);
}
if (avgleft > avgright)
{
servohori.write(servoh +1);
if (servoh > servohLimitHigh)
{
servoh = servohLimitHigh;
}
delay(10);
}
else if (avgright > avgleft)
{
servohori.write(servoh -1);
if (servoh < servohLimitLow)
{
servoh = servohLimitLow;
}
delay(10);
}
else
{
servohori.write(servoh);
}
delay(50);
}

You might also like