Welcome to Kerala Project Center.

Sun Tracking Solar Panel Using Arduino

Sun Tracking Solar Panel Using Arduino

Components




Arduino
Solar Panel
Servo SG90
LDR Sensor
Breadboard
resistor 1K Ohm



Components Hexkart Flipkart
Arduino Buy Now Buy Now
solar Panel Buy Now Buy Now
Servo motor Buy Now Buy Now
Breadboard Buy Now Buy Now


Circuit Diagram





Arduino Code



#include
int servo = 0;
int servoLimitHigh = 160;
int servoLimitLow = 60;
Servo servoverti;
int servov = 0;
int servovLimitHigh = 160;
int servovLimitLow = 60;
//Pin fotoresistenze
int ldrtopl = 2; //top left
int ldrtopr = 1; //top right
int ldrbotl = 3; // bottom left
int ldrbotr = 0; // bottom right
void setup ()
{
servohori.attach(10);
servohori.write(60);
servoverti.attach(9);
servoverti.write(60);
Serial.begin(9600);
delay(500);
}
void loop()
{
servoh = servohori.read();
servov = servoverti.read();
int topl = analogRead(ldrtopl);
int topr = analogRead(ldrtopr);
int botl = analogRead(ldrbotl);
int botr = analogRead(ldrbotr);
int avgtop = (topl + topr) ; //average of top
int avgbot = (botl + botr) ; //average of bottom
int avgleft = (topl + botl) ; //average of left
int avgright = (topr + botr) ; //average of right
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);
}




Hours

Monday - Saturday: 9:00 AM - 5:00 PM
Sunday: Not Working

Location

Door No. 510, Samastha Jubilee Memorial Soudham,
Mele thampanoor, Trivandrum, Kerala – 695001

Book Now

+91 9633118080