Arduino Forum

Topics => Product Design => Topic started by: dsmith5167 on Aug 05, 2012, 04:35 pm

Title: 2 Axis Solar Tracker (The evolution of an idea)
Post by: dsmith5167 on Aug 05, 2012, 04:35 pm
Good Day…
I have been developing this project for about a month now and thought I would share and hopefully get some feedback.

The idea is that it will track the sun and just wait for morning to realign again. No counting steps or any other absolute positioning required. Set it up, connect it to a battery, and walk away.

I have built a mock on the breadboard and successfully driven the gear motors as intended with the schematic shown below. Was hoping to get some peer review/proofing of the schematic and code before finalizing the design and committing to the actual build.
Thanks



Still need to incorporate battery charging circuitry and probably some fuse/overload protection also.
(http://sphotos-a.xx.fbcdn.net/hphotos-ash4/s720x720/304809_453995671300668_995706159_n.jpg)
Readable PDF File:
http://www.gertweb.com/images/Solar%20Tracker.pdf



Initial Design Concept
(http://sphotos-a.xx.fbcdn.net/hphotos-prn1/s720x720/531575_445882892111946_1935847687_n.jpg)



Early design layouts of drive mechanism.
(http://sphotos-a.xx.fbcdn.net/hphotos-ash4/s720x720/396946_445882915445277_1182799969_n.jpg)
On the left a $7.00 Gear Motor. On the right a $25.00 Stepper Motor.
Hmmmm
(http://sphotos-a.xx.fbcdn.net/hphotos-ash3/552752_445974135436155_296964813_n.jpg)



Testing some “recycled” relays to reverse motor direction.
Uses the 5v from the microcontroller output pin to drive the relays controlling the 12v to the motors.

Truth Table
J1 Low + J2 Low = Armature Grounded
J1 Low + J2 High = Rotate Right
J1 High + J2 Low = Rotate Left
(http://sphotos-b.xx.fbcdn.net/hphotos-ash3/s720x720/563988_446216105411958_1205457932_n.jpg)



The drive motors and design configuration I intend to use.
(http://sphotos-a.xx.fbcdn.net/hphotos-ash3/s720x720/563554_446995512000684_2128671934_n.jpg)

The gearbox gives an 8 to 1 gear ratio and it has a lot more torque than one might think. (a good thing)
(http://sphotos-a.xx.fbcdn.net/hphotos-ash3/s720x720/560898_450097268357175_1645207430_n.jpg)



Rev 4 of the prototype circuit board.
The more I contemplate the design the more I realize it will probably need an additional position sensor.
IE: How do you get it to turn and face East for the morning sun? Tracking the sun itself is easy.
But not getting it positioned correctly to start with could mean the panels will track facing directly away from the sun. Thoup!!

The chip will be programmed on the Arduino board and then transplanted to the solar assembly.
By doing this I freed up a lot of real-estate on the proto-board.
(http://sphotos-a.xx.fbcdn.net/hphotos-ash3/s720x720/599733_450130448353857_1419097712_n.jpg)



Built a quick mock up to program, test, and debug the sensor array.
Some Aluminum tubing, Styrofoam hamburger tray, a little masking tape, and a chunk of 7 wire cable.
(Who’s your daddy MacGyver?)
(http://sphotos-b.xx.fbcdn.net/hphotos-prn1/524441_450455741654661_1773499697_n.jpg)



The un-calibrated sensor readings feed a much larger, more precise, data set to the microcontroller (as was expected). By skipping the calibration process I can remove a large layer of complexity from the design solution. The down side to this is that it is way more precise than need be. To get the sensor array I built to work correctly it needs to be within about ¼ to an 1/8 of a degree perpendicular to the sun. This will cause a large number of motor steps to keep alignment throughout the day. Great tracking performance (if you want to shoot down missiles), but poor utilization of collected solar energy. Tradeoffs are needed.

Using a solar cell and a volt meter I found I need to be within about plus or minus 5 degrees of perpendicularity for best collector efficiency. Instead of trying to tweak the design parameters with the software it will be easier to alter the array to give a bit more freedom to the perpendicularity tolerance.

Of Interest…
I was reading Wikipedia after writing the above comments and it stated that a plus minus 5 degree angle will be greater than 99.6% efficient. It turns out the rod in my eye is a pretty accurate protractor. (grin)

---------------

The redesigned sensor array. I went with a plus minus 6 degree variance. This is probably still more accurate than need be.
(http://a6.sphotos.ak.fbcdn.net/hphotos-ak-snc7/412517_450802201620015_54527326_o.jpg)



Baby Steps…
I started developing the software by just acquiring the sensor data. Next, using that data, I wrote the code to compare values and turn switches on and off accordingly. The next step will be to actually wire relays in place of the indicator LED’s and drive the motors. I was pleasantly surprised when I realized I had 80% of the code done in one afternoon.
(http://sphotos-b.xx.fbcdn.net/hphotos-prn1/s720x720/547943_450802224953346_1945338751_n.jpg)



The code
Code: [Select]
/*
  Solar Tracker (Preliminary Example Code)

Uses 3 photoresistors to track the suns movement.
The microcontroller evaluates the photoresistor values and
drives the appropriate positioning motor for correct alignment.

created 28 Jul 2012
By David A Smith
modified 28 Jul 2012
By David A Smith

 
This code is in the public domain.

*/

// These constants won't change:
const int sensorPinA0 = A0;    // pin that the Bottom/Left sensor is attached to
const int sensorPinA1 = A1;    // pin that the Right sensor is attached to
const int sensorPinA2 = A2;    // pin that the Top sensor is attached to

//const int pmotorPinA0 = 11;        // pin that the pan motor relay is attached to
//const int pmotorPinA1 = 10;        // pin that the pan motor relay is attached to
//const int tmotorPinA0 = 9;        // pin that the tilt motor relay is attached to
//const int tmotorPinA2 = 8;        // pin that the tilt motor relay is attached to


// variables:
int sensorValueA0 = 0;         // Bottom/Left photoresistor
int sensorValueA1 = 0;         // Right photoresistor
int sensorValueA2 = 0;         // Top photoresistor

int panDelay = 1000;           // The amount of time the pan and tilt motor will run
int tiltDelay = 1000;          // this will vary depending on motor and drive train


void setup() {
 
    // Send debugging information via the Serial monitor
  Serial.begin(9600);
   
    //Assign and set motor driver pins to low
    pinMode(11, OUTPUT);
    digitalWrite(11, LOW);
    pinMode(10, OUTPUT);
    digitalWrite(10, LOW);
    pinMode(9, OUTPUT);
    digitalWrite(9, LOW);
    pinMode(8, OUTPUT);
    digitalWrite(8, LOW);
}

void loop() {
  // read the sensor:
  sensorValueA0 = analogRead(sensorPinA0);
  sensorValueA1 = analogRead(sensorPinA1);
  sensorValueA2 = analogRead(sensorPinA2);



  // Compare sensor readings and drive pan motor left or right
  // If the sensor values are equal (what we want) it will skip adjusting the pan motor
    // Pan Right
    if (sensorValueA0 > sensorValueA1){
      digitalWrite(11, HIGH);
      delay(panDelay);
      digitalWrite(11, LOW);
    }
    // Pan Left
    if (sensorValueA0 < sensorValueA1){
      digitalWrite(10, HIGH);
      delay(panDelay);
      digitalWrite(10, LOW);
    }

  // Compare sensor readings and drive tilt motor up or down
  // If the sensor values are equal (what we want) it will skip adjusting the tilt motor
    // Tilt Down
    if (sensorValueA0 > sensorValueA2){
      digitalWrite(9, HIGH);
      delay(tiltDelay);
      digitalWrite(9, LOW);
    }
    // Tilt Up
    if (sensorValueA0 < sensorValueA2){
      digitalWrite(8, HIGH);
      delay(tiltDelay);
      digitalWrite(8, LOW);
    }

   
  //Print debugging information
  Serial.print("Left/Bottom reading = ");
  Serial.println(sensorValueA0);     // the left/bottom sensor analog reading
  Serial.print("Right reading = ");
  Serial.println(sensorValueA1);     // the right sensor analog reading
  Serial.print("Top reading = ");
  Serial.println(sensorValueA2);     // the top sensor analog reading
 
  delay(1000);
}




Nothing I have presented here is finalized and all information is for review and informational purposes only.
For a more in-depth look at the development stages of this and other related projects visit my Facebook page.
(New friend requests are always welcome)
http://www.facebook.com/media/set/?set=a.445878665445702.103623.100000707171935&type=3&l=bfcf6b8267 (http://www.facebook.com/media/set/?set=a.445878665445702.103623.100000707171935&type=3&l=bfcf6b8267)

EDIT 8-19-2012
Updated my personal web page to include this and other projects.
http://www.gertweb.com/arduino.html
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: Jantje on Aug 05, 2012, 04:46 pm
Interesting project.
Why have you chosen to use pulleys and not directly drive the axis from the motors (as you are using gearmotors anyway)?
Best regards
Jantje
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: dsmith5167 on Aug 05, 2012, 05:46 pm

Why have you chosen to use pulleys and not directly drive the axis from the motors (as you are using gearmotors anyway)?


Good Question…

Originally I was going to cannibalize an old scanner and printer for the drive components. I found some timing belts and pulleys that matched the drives on the scavenged stepper motors I had at http://www.mcmaster.com/#mxl-series-timing-belts/=ipu9sj. Later I decided I did not want the added cost and complexity of using steeper motor driver(s). I would also have to energize the steppers continuously to get them to "hold" the array in place due to wind loading. I also looked into worm gear drives but could not justify their cost for this project. In the end I just substituted DC gear motors for the stepper motors in the design and went forward with the project.

If all goes well I want to build a bigger better version. I was thinking the worm gear drives in your cars electric windows would be something to investigate.

I'm pretty sure I can get the direct drive approach to work for both the pan and tilt functions reducing the part count and cost. (good call)

This is exactly why I posted here at this time. We sometimes become so involved in the process we tend to overlook the obvious things that fresh eyes will catch. (Thanks)
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: CrossRoads on Aug 05, 2012, 05:57 pm
Don't forget diodes across the relays.
Missing 0.1uF caps from pins 7, 20, 21 to  Gnd.
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: johnwasser on Aug 05, 2012, 05:58 pm
You might want to provide a rechargeable battery.  If the tracker follows the sun until sunset it will be in just the wrong position to power the motors at sunrise.  With no power it will have to wait until it gets enough energy from the reflected sunrise light to move the array back to the sunrise position.

The linear regulator wastes some of that precious solar energy.  A DC-to-DC converter would be more efficient.
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: dsmith5167 on Aug 05, 2012, 06:56 pm

Don't forget diodes across the relays.
Missing 0.1uF caps from pins 7, 20, 21 to  Gnd.


I updated the original schematic at the top of the thread per your suggestions.

I used 1N4007 diodes as I have them on hand.
A good choice? or is there something better?
What parameters qualifies as better?
I am thinking low leakage high breakdown voltage ratings.

Curious:
There is no circuitry after the coil (it goes directly to ground) and as I have it shown now any spikes can feed back to the microcontroller.
It would make more sense to me to have the diodes in-line with the controller pins blocking any return voltage.
Is the Newbie looking at this the right way?


Quote

Protection diodes for relays
Transistors and ICs must be protected from the brief high voltage produced when a relay coil is switched off.
The diagram shows how a signal diode (eg 1N4148) is connected 'backwards' across the relay coil to provide this protection.
http://www.kpsec.freeuk.com/components/relay.htm



Also I added the .1uF (100nF) cap across the 7, 20, 21 node.
I notice you used the word "caps" (plural) in your post.
Do you recommend 3 (one for each pin)?

Your comments and thoughts are greatly appreciated.
Thanks
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: dsmith5167 on Aug 05, 2012, 07:28 pm

You might want to provide a rechargeable battery.  If the tracker follows the sun until sunset it will be in just the wrong position to power the motors at sunrise.  With no power it will have to wait until it gets enough energy from the reflected sunrise light to move the array back to the sunrise position.


:*...
I forgot to mention that in the write up, but you are correct.
I have an old cordless wall phone that I am going to scavenge the rechargeable battery out of (possibly circuitry also).
It is only 3.6v so I will have to expirement to see if it will be big enough to trip the relay and drive the assembly.


The linear regulator wastes some of that precious solar energy.  A DC-to-DC converter would be more efficient.


Any recommendations or links to an appropriate converter?

I was also thinking of replacing the photoresistor circuit(s) with plain LED's to improve efficiency.
I wouldn't have to power them as they work like mini solar cells (light in - electrons out).
It would also reduce part count and cost.

Thanks for the input.
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: CrossRoads on Aug 05, 2012, 08:49 pm
Yes, cap on each pin: Vcc, AVcc, Aref. Aref is cap only, do not connect to 5V.

Here are three ways to drive a relay coil.  Keep the inductor spike off the arduino pin.
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: pito on Aug 07, 2012, 02:42 am
1. mind the total current through 328p when all relays on, better use the transistors for switching the relays.
2. I would not use the tracking with those optical homing sensors - add simply an RTC and you can calculate the SUN's position with GREAT precision even at night :)
p.
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: dsmith5167 on Aug 07, 2012, 03:24 am

1. mind the total current through 328p when all relays on, better use the transistors for switching the relays.
2. I would not use the tracking with those optical homing sensors - add simply an RTC and you can calculate the SUN's position with GREAT precision even at night :)
p.


As the software is programmed now only 1 relay will ever be on at any given time.
But I will be measuring the current through the relay just for curiosity now.  ;)

RTC (Real Time Clock?)
Incorporating a clock into the system will add a layer of complexity I am not familiar with at this time.
It may be a better alternative/solution but I don't have that knowledge in my tool bag.
The three photoresistors, as I originally configured them, were more accurate than was necessary.
I would also think that using an absolute type of positioning system would mean I have to position the system in a particular manner at a particular time.

If you have a good example of using the RTC in a solar tracker I would like to look at it.

Your post also made me realize the photoresistors are probably sensitive enough to track the moon.
Possibly wasting energy throughout the night. Hmmmm :~
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: dsmith5167 on Aug 07, 2012, 03:29 am
Updated the schematic at the top of the thread.
Added caps to pins 7, 20, and 21.
Also added blocking diode to the solar panel(s).
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: pito on Aug 07, 2012, 10:24 am
@dsmith5167: the average number of sunny days in your state is 49-53% based on city. So in half of days your optical tracker might have troubles. An RTC based Sun's position prediction could be used as a backup then..  :)
BTW the best results I've got in past was with 5mm ultra-violet LED as the detector - it had a quite narrow radiation diagram (+/- few degrees) and among other LED's  colours gave the biggest photo current when positioned precisely to the Sun..
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: dsmith5167 on Aug 08, 2012, 01:39 am
@Pito
Excellent observations and insights. (Thanks)

Some time ago I took some measurements on a handful of LED's I have.
Using a consistent light source I measured the output voltage.

I want to avoid doing a calibration process so the actual output voltage is not as critical as finding 3 LED's that give the same measurement under the same lighting conditions. Alternatively if you are going to calibrate the sensors it won't matter as the various outputs will be converted to an equal min max scale.

LED as Light Sensor Output Voltage (mV)
Transparent Red                  112.9
Clear Red                            73.1
Opaque Red                        34.6
Clear Green                        78.1
Clear Green (Mini) 1            56.8
Clear Green (Mini) 2            46.4
Clear Green (Mini) 3            57.6
Clear Green (Mini) 4            47.7
Clear Green (Mini) 5            34.8
Clear Green (Mini) 6            28.6
Clear Green (Mini) 7            51.5
Opaque Green                     45.3
Clear Yellow                       158.7
Opaque Yellow                    70.8
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: pito on Aug 08, 2012, 03:41 pm
Water clear ultraviolet LED 5mm gave 2.4Volt on 1Meg resistor (photo voltage, voltmeter's R=10Meg), clean sky (June24th, at high noon). The other colours (all water clear 5mm) did between 1.5V - 2.0V.
PS:
uv        2.36V
white   2.12V
yellow  1.69V
red      1.51V
green   0.02V ??
It seems the Sun is not green enough.. :)

So with an high impedance buffer (an opamp) you are exactly in the ADC range. Mind the LED's radiation diagrams might be VERY narrow, so it was not easy to find the maximum voltage while measuring..
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: gavpop on Sep 06, 2012, 10:02 am
Looks very interesting.
And also looks to be following some similar ideas to my Arduino Dual Axis Tracker.

I've nicked one or two of your ideas...so only fair I offer some of mine - http://www.binaryorbit.org (http://www.binaryorbit.org)
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: rockwallaby on Oct 25, 2012, 03:30 pm
Nice to see development in this area.

Now I am doing much the same, except that my project incorporates the complete monitoring and control for both solar panel array as well as a micro-hydro system.
I intend also to install a tracking system on the solar array, and am digging big hole in ground as we speak for a 8 metre or for you usa folks a 4x6' triangle mast tower.

Now what i noticed with your design that did strike me with some concern is potential problems with wind loading.
With using pulleys and such, I tend to think that one good gust of wind and your belts would be snapped or slipped and your nice panel will then likely be a lovely weather cock.
I am wondering, is this something you have thought about, or is the total surface area of your panels so small that it would not e effected by such a strong gust?

I will be using a good solid ram drive, similar to what is used for satellite dish positioning, welded steel frame and suitable bearings.

Also, someone mention using a RTC as a backup, that is a good idea.
The system I am designing will not use light sensors for directional operation, but using NTP, network time protocol as my system is connected to the internet anyhow.

You have obviously spent a great deal of time making fantastic CAD drawings which makes it far easier to see and visualise your design.
Looking forward to hearing of your results.

rockwallaby
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: graynomad on Oct 25, 2012, 03:47 pm
Wind loading can be a huge force, I would have a real good look at that.

Speaking of having a good look, anyone doing this sort of thing should check out this thread on the Aussie electronics forum

http://www.ozelecforum.com/viewtopic.php?f=33&t=108 (http://www.ozelecforum.com/viewtopic.php?f=33&t=108)

As for the second axis, I think most people reckon it's not worth automating, just go out every 2-3 months and adjust them.

______
Rob
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: Khalid on Dec 27, 2012, 10:46 am
i have worked on my own dual axis sun tracking system. It is menu driven and all the parameters can be set using 6-key keypad and LCD. Saving the parameters in EEPROM is added.
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: graynomad on Dec 27, 2012, 03:53 pm
Nice Khalid, interesting blogs as well.

______
Rob
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: Khalid on Dec 27, 2012, 07:21 pm
Rob,
Thank you. This blog happen just with the help of nice helpful guys like youl
Regards
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: AJITnayak on Jan 14, 2013, 02:26 pm
Hi,

I suggest to use following methods

1) SPA algorithm code that gives you the exact position of sun.
2) use Inclinometre to measure the inclination for reference input
3)use suitable linear actuator and motor drive , that can drive the load
4) use gps sensor for  getting date and time
5) real time  clock has been used to provide back up incase GPS fails

Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: Khalid on Jan 15, 2013, 11:52 am
Hi AMPS,
The bad thing about the stepper and servo is:
1- The whole system got too much costly
2- You have always keep energize the system ( In case of stepper if you remove the power it will loose holding torque and accuracy may suffer)

When you have a low cost approach then why to complicate the things?
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: AJITnayak on Jan 15, 2013, 12:04 pm
@KHALID.

ITS MY OPINION  , Main  agenda is to provide track the sun . To measure the sun angle accurately for many years with 0.0003 deg.
2) for that time and date has to be accurate , so i suggested GPS and real time clock for keeping time  accurate.
3) in ordered to measure the usually u can use potentiometer ckt  after few year it will loss its accuracy, So i refereed Inclinometre   
4) The person who are going to design the tracking system , He has to take care of the drive and driver unit. I suggested linear actuator and linear actuator drive for that assuming the tracking system for home or residental.

Even we are in to solar tracking system we are successfully running with arduino from past 3 years.
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: Khalid on Jan 15, 2013, 02:08 pm
@AMPS
Actually if you use LEDs or LDRs then you have no worries of degradation. Both have long life.. In Solar Panel you no need that much accuracy. Question is why?
If you move the panels at 0.003 degree interval, then you have to move each second the panel. This will at the end of the day consumes lot of Motor, its drivers and controllers energy.
I am also running the solar panels for past year and i find the good accuracy in positioning of panels.
Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: AJITnayak on Jan 15, 2013, 02:19 pm
@khalid



1)It all depend on  programming technique, you can save power whenever motor is not being used
2) LDR  are sensitive dust. When Some dust fall on it . it might not work. It need periodic maintenance
3) 0.003 deg mentioned is not per degree  to moved in everyday. I mentioned because if we use simple code using LDR after year if you reading 30deg for particular time  , U might degrade to  + or - 5 degree after year on same time, If we calculate for long period track will be out of position.

Title: Re: 2 Axis Solar Tracker (The evolution of an idea)
Post by: toxman on Mar 12, 2013, 02:27 pm
i made this project using bearings and mechanics of an old hard disk.....
nice idea!