Wednesday, May 18, 2011

Solar Tracker

That's right, a solar tracker. The principle behind it is quite simple: automatically point directly at the sun throughout the day. As the sun arcs across the sky, a solar tracker adjusts its azimuth and altitude in order to, say, keep a solar panel facing the sun at all times. I had all the parts necessary to make a working solar tracker, so I did.


I fiddled around with gearboxes and wood and scrap plastic pieces until i came up with this monstrosity:

And after determining that this thing was awful at doing anything but fall apart, I decided to whip out the trusty Legos:
It ended up being an even bigger monstrosity. Admittedly, the bulk of the Legos just control the azimuth drive. The altitude is controlled by a non-Lego servo motor, strapped onto that black beam with a rubber band. There are two photocells that I stuffed down those (olive colored?) tubes at the top of the gray beam. All of the electronics are connected through that breadboard for now. I'm not really planning on making this a permanent installment; it's just a fun project that I wanted to do.


You may be asking why I stuffed photocells down some tubes. I think it's time for a diagram:
As the servo changes the angle of incidence of the sun's rays, the photocells change resistances. The reason why there are two of them is to measure a difference in light levels. If one cell is getting more sunlight than the other, the altitude adjusts so that the difference between them is a minimum. They are offset both in altitude and azimuth, so the light levels in each will dictate which way the tracker moves. I haven't yet considered adding a third photocell for "triangulation" because I have yet to test the machine in automatic mode. I have a feeling that the addition of a third photocell exposed to ambient light will give better control of directionality. 

If you noticed in the picture, the azimuth drive is powered by a big Lego battery pack (~9V) which has two red buttons. The buttons control which way the Lego motor spins. Not very automatic, huh? This is the main reason why I haven't tested or calibrated the tracker. I am waiting for an order from Sparkfun that contains among other things an H-bridge IC (integrated circuit). An H-bridge is essentially a digitally-controlled version of those two red buttons. The Arduino will be able to toggle the direction of the Lego motor with the H-bridge.


I did write a little sketch for the Arduino so that I could see what values the photocells were sensing, and a rudimentary altitude control using that big black knob attached to a potentiometer.

#include <Servo.h>
 
Servo myservo; 
 
int potpin = 2; 
int cellone = 0;
int celltwo = 1;
int val;   
int val2;
int val3;
int val4;
 
void setup()
{
  myservo.attach(3); 
  Serial.begin(9600);
}

 
void loop()
{
  val = analogRead(potpin);
  val2 = map(val, 0, 500, 0, 179);
  myservo.write(val2);
  val3 = analogRead(cellone);
  val4 = analogRead(celltwo);
  Serial.print(val2);
  Serial.print(",");
  Serial.print(val3);
  Serial.print(",");
  Serial.println(val4);
  delay(50);
 
}
OK, you might be thinking that I spent very little time on this project, and you'd be right. I built the Lego part and wired it up within a half-hour. I even modified some servo control code that I wrote earlier. The upcoming coding after I get that H-bridge shouldn't be too hard to do, but it might take me longer than a half-hour. I'll keep you updated in the next post.


Link to Sparkfun. Awesome site for just about any DIY electronics.

1 comment:

  1. Good idea provide for solar tracker installation that beneficial for us....
    Solar Tracker

    ReplyDelete