DUAL AXIS SOLAR TRACKER

www.suren.space

This is so popular that it’s even made available on the official arduino blogs DIY. Being a no brainer, This one actually teaches to to meddle with close soldering and a bit of electronics.

Dualaxis.jpg

WHY TRACK THE SUN?

It seems you can’t walk down the street these days without coming across a solar panel. You can find them lighting up crosswalk signs, mobile power for construction, as well as simple little sidewalk path lights. Solar is easy to use, readily available, and inexpensive.
So why aren’t we using it to power our homes?
For the most part our common every day solar cells run at an efficiency of 18-20%, meaning they convert 18-20% of the every they receive into electricity. While this is far better than the 3-6% efficiency that most green plants end up with, it doesn’t quite meet our power needs. To bring in enough power we either need to improve the efficiency of our panels or find ways of getting more from our current solar panels.
Every panel you see in your day to day life is in a fixed position, most likely facing south at a 45 degree angle. While this approach is extremely simple and meets the needs of most small applications, it isn’t producing as much energy as it could be.
The single most simple way of getting more energy out of a solar panel is to have it track the sun. In fact solar panels that track the sun create around 30% more energy per day than a fixed panel. With that kind of power increase you’d think everyone would be doing it, but there are some good reasons why it’s not overly common. First, the initial cost of setup is higher since it requires moving parts. Second, it also require maintenance and upkeep since they’d be exposed to outdoors conditions year round. Third, you’d need to power this equipment in order to keep it running and moving which then takes away from your output.
For most applications and home use, tracking is overkill. We typically don’t see tracking used unless it’s in large industrial power generation systems. Though that doesn’t mean you can’t make your own version at home.

The mounted servo motors along with body frame is available online in few robotics marts.

CODE BELOW :

#include 
//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);
}

Other useful images below

Solar-Tracker-Arduinostepp

Thanks to Vijay Karthik on helping me with this.