Hi everyone , I have come up with a project called solar tracker 2.0 . It is a single axis vertical sun tracker . I have used two ldrs to find the difference with two values. But due to some reasons ,I got some bugs.Here is the code I used:
#include <Servo.h>
Servo myservo;
int pos = 90;
int sens1 = A0;
int sens2 = A2;
int tolerance = 2;
hi arduino-x ,I want the sun tracker to track the sun so I made the servo to turn to the side that has more light intensity. the bugs I got were like the servo started vibrating and started making some noise and it ignored the light sometimes
If the error is within tolerance, then nothing should happen.
Dude, you are only allowing 75 milliseconds for the servo to react to a change. And each time you discover that the sun is still off-target, you increase the target position by one. So if your sketch starts way off target, that target vlaue will get jammed all the way over to 180 or 0 before the servo catches up.
The sun moves pretty slowly. Try increasing that delay to something bigger - say, 500ms, and see if that gets rid of the vibration.
If the error is within tolerance, then nothing should happen.
So the test is not necessary and the else could be replaced by a test to see if the range is outside of the tolerance which would make the code more logical.
Your alignment can be off center by 10° in either direction and lose only 1.5% of the energy. The deadband can be increased greatly. You can slew past center then let the sun catch up.
What is the physical arrangement of the sensors? There is a very simple way of doing this, even with CdS cells.
This could be done with 1 servo and 2 LDRs if the axis of rotation were pointed due North (or South) and tilted up to match your latitude, also, the Sun moves across the sky at only 1/4 degree per minute so high speed, high precision positioning is not needed.
I'm working on a drawing for the sensor where the panel only needs to be moved every 45 minutes and will have 99.5% collection efficiency or greater(+/- 5.7° error). A gearbox motor driven by an H-bridge will be sufficient. The panel will stop at the west end when the light level falls below the DUSK_DAWN definition and automatically return to the east when the level increases above the threshold the next morning. Any pair of reasonable matched sensors can be used.
@Arctic_Eddie:
Yep that would work, what I was thinking about is is a contraption with the rotation axis pointed at the celestial pole, (35 degrees above the due North horizon here), and another platform with a East / West (horizontal) axis on top of that for seasonal declination adjustment, it would only complete a cycle once a year.
You probably don't need the seasonal tracker as it can be hand cranked once a month. If you set the declination to NCP-90 and leave it there then your lowest capture efficiency at the solstices is still 89% when the error is 23°. Look for one of the old C-band satellite dish mounts. They can be hand cranked for declination and motor driven for hour angle.
Here's a drawing of a simple tracker sensor setup. The device consists of two sensors, reasonably balanced, and mounted above the top edge of the panel. There is a third fixed sensor aimed at the eastern horizon to detect sunrise. The drawing view is from above the panel looking down it's face toward the ground.
The ratio of H/D determines the deadband angle. With a ratio of 10, both sensors will be illuminated in the angular range +/- 5.7°. The panel would be moved about every 45 minutes. It would be moved when the sun moves to the west so that the east sensor becomes shadowed by the partition. The panel is moved west until the west sensor is shadowed. At that point, it will be 45 minutes until the east sensor is shadowed. During this time, the panel collection efficiency is 99.5% or greater.
The drive mechanism can be a 24VDC gearmotor driven by an H-bridge. There are numerous sources on eBay.