>> ARDUINO POWERED SOLAR TRACKER TURRET
With summer just around the corner; I am so going to replicate and play
around with this project.
I came across the
solar tracker turret
project and I had a "damn, I wish I had thought of that" moment. Utilizing
four light sensors, two servos and an Arduino - you can follow the sun
as it progresses through the day. The implications for solar based projects
are dramatic; as aligning the solar panels perpendicular to the sun means
optimal electrical production. Of course; the angle depends on latitude and
while there are guides online, you can be 100% spot on with this.
So, how does it work exactly?
The secret is in the four light sensors and a cross shaped protrusion
coming out the face of the device. As light shines on the device, each
light sensor will either have light shining on or, or a shadow from the
protrusion. When all light sensors detect direct sunlight; the device is
perpendicular. If using a UV sensor; you can more accurately
determine the source is the sun.
The Arduino
sketch
has been posted online; the core logic (simplified, documented):
void loop()
{
int lt = analogRead(0); // top left -> A0
int rt = analogRead(1); // top right -> A1
int ld = analogRead(2); // down left -> A2
int rd = analogRead(3); // down right -> A3
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 delta of up and down
int dhoriz = avl - avr; // check the delta of left and rigt
// vertical: tolerance check, do we need to move servo
if (ABS(dvert) > TOLERANCE)
{
if ((avt > avd) && (servov < 179)) servov++;
if ((avt < avd) && (servov > 1)) servov--;
vertical.write(servov);
}
// horizontal: tolerance check, do we need to move servo
if (ABS(dhoriz) > TOLERANCE)
{
if ((avl > avr) && (servoh > 1)) servoh--;
if ((avl < avr) && (servoh < 179)) servoh++;
horizontal.write(servoh);
}
delay(DELAY);
}
A nice feature the included was to use potentiometers to control the
tolerance and the delay period between loop iterations. It would make
sense to use these to calibrate the device, but definitely wouldn't be
required for a deployment scenario. It is fun to see that something
that normally one would think would be so complicated to solve is
actually in fact so simple.