Pages: [1] 2   Go Down
Author Topic: 2 Axis Solar Tracker (The evolution of an idea)  (Read 14248 times)
0 Members and 1 Guest are viewing this topic.
Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Readable PDF File:
http://www.gertweb.com/images/Solar%20Tracker.pdf


Initial Design Concept



Early design layouts of drive mechanism.

On the left a $7.00 Gear Motor. On the right a $25.00 Stepper Motor.
Hmmmm



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



The drive motors and design configuration I intend to use.


The gearbox gives an 8 to 1 gear ratio and it has a lot more torque than one might think. (a good thing)



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.



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?)



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.



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.



The code
Code:
/*
  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

EDIT 8-19-2012
Updated my personal web page to include this and other projects.
http://www.gertweb.com/arduino.html
« Last Edit: August 19, 2012, 05:55:19 pm by dsmith5167 » Logged

Belgium
Online Online
Edison Member
*
Karma: 58
Posts: 1734
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 441
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 180
Posts: 8096
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: August 05, 2012, 12:41:30 pm by dsmith5167 » Logged

Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

 smiley-kiss...
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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 441
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* Relay_drive_examples.jpg (36.64 KB, 960x720 - viewed 139 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Rapa Nui
Offline Offline
Edison Member
*
Karma: 53
Posts: 1990
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
p.
« Last Edit: August 06, 2012, 07:44:54 pm by pito » Logged

Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
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.  smiley-wink

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 smiley-confuse
Logged

Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 53
Posts: 1990
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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..  smiley
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..
« Last Edit: August 07, 2012, 03:38:16 am by pito » Logged

Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 53
Posts: 1990
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.. smiley

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..
« Last Edit: August 09, 2012, 04:38:31 am by pito » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Pages: [1] 2   Go Up
Jump to: