mini solar tracker






Matt Watts

Re: mini solar tracker
« Reply #6, on March 11th, 2017, 03:42 PM »
Nice!  Can't wait for a quick video demo of it doing its thing.



jeremy gwilt

Re: mini solar tracker
« Reply #9, on March 12th, 2017, 05:27 PM »
hopefully i can get to software tonight!

 IMG_0103.JPG - 3219.38 kB, 4000x3000, viewed 119 times.


jeremy gwilt

Re: mini solar tracker
« Reply #10, on March 12th, 2017, 08:26 PM »
test code (950 was chosen simply because it was above the ambient room light):

Code: [Select]
#include <Stepper.h>
#define STEPS 4096
Stepper stepper1(STEPS, 6, 7, 8, 9);
Stepper stepper2(STEPS, 10, 11, 12, 13);


void setup() {
Serial.begin(115200);
stepper1.setSpeed(6);
stepper2.setSpeed(6);
stepper1.step(100);
  delay(5);
  stepper1.step(-100);
  delay(5);
  stepper2.step(100);
  delay(5);
  stepper2.step(-100);
  delay(5);

}

void loop() {
 
  digitalWrite(6,LOW);
  digitalWrite(7,LOW);
  digitalWrite(8,LOW);
  digitalWrite(9,LOW);
  digitalWrite(10,LOW);
  digitalWrite(11,LOW);
  digitalWrite(12,LOW);
  digitalWrite(13,LOW);
 
  float sensor1 = analogRead(A0);
  delay(1);
  float sensor2 = analogRead(A2);
  delay(1);
  float sensor3 = analogRead(A4);
  delay(1);
  float sensor4 = analogRead(A6);
  delay(1);
  Serial.print(sensor1);
  Serial.print(",");
  Serial.print(sensor2);
  Serial.print(",");
  Serial.print(sensor3);
  Serial.print(",");
  Serial.println(sensor4);
 
  if (sensor1>950) {
    stepper2.step(100);
  }
  if (sensor4>950) {
    stepper2.step(-100);
  }
  if (sensor2>950) {
    stepper1.step(100);
  }
  if (sensor3>950) {
    stepper1.step(-100);
  }
 
 
}


Matt Watts

Re: mini solar tracker
« Reply #12, on March 12th, 2017, 11:50 PM »
Not bad at all Jeremy.  Tracks pretty decent even with the close range point source.

Have you checked the signal range on those photo-resistors to be sure full strength sunlight doesn't take them offscale?

The other little thing you will probably want to investigate is a stepper enable function, so that once the panel is aligned to the sun the stepper motors don't sit there drawing power trying to hold position.  Hopefully your gearing will have enough friction to hold things in place, maybe even with wind.

Look'n good so far.


jeremy gwilt

Re: mini solar tracker
« Reply #13, on March 13th, 2017, 04:35 AM »
i have tried to paste all over that this was just a  sample sketch to test movement......not final behavior at all. this little guy is just going to sit in the window......no wind.

jeremy gwilt

Re: mini solar tracker
« Reply #14, on March 14th, 2017, 08:13 PM »Last edited on March 16th, 2017, 09:48 AM
'zero' point added to the sketch. i was surprised something so simple works so well.

Code: [Select]
#include <Stepper.h>
#define STEPS 4096
Stepper stepper1(STEPS, 4, 5, 6, 7);
Stepper stepper2(STEPS, 8, 9, 10, 11);


void setup() {
Serial.begin(115200);
stepper1.setSpeed(6);
stepper2.setSpeed(6);
stepper1.step(100);
  delay(5);
  stepper1.step(-100);
  delay(5);
  stepper2.step(100);
  delay(5);
  stepper2.step(-100);
  delay(5);

}

void loop() {
 
  digitalWrite(4,LOW);
  digitalWrite(5,LOW);
  digitalWrite(6,LOW);
  digitalWrite(7,LOW);
  digitalWrite(8,LOW);
  digitalWrite(9,LOW);
  digitalWrite(10,LOW);
  digitalWrite(11,LOW);
 
 
  float sensor1 = analogRead(A0);
  delay(1);
  float sensor2 = analogRead(A6);
  delay(1);
  float sensor3 = analogRead(A2);
  delay(1);
  float sensor4 = analogRead(A4);
  delay(1);
  Serial.print(sensor1);
  Serial.print(",");
  Serial.print(sensor2);
  Serial.print(",");
  Serial.print(sensor3);
  Serial.print(",");
  Serial.println(sensor4);
 
  if (sensor1>(sensor4+50)) {
    stepper2.step(25);
  }
  if (sensor4>(sensor1+50)) {
    stepper2.step(-25);
  }
  if (sensor2>(sensor3+50)) {
    stepper1.step(25);
  }
  if (sensor3>(sensor2+50)) {
    stepper1.step(-25);
  }
 
 
}


jeremy gwilt

Re: mini solar tracker
« Reply #16, on March 25th, 2017, 07:15 AM »
finding some time this weekend for a little refinement.
photoresistors used:

http://www.digikey.ca/product-detail/en/luna-optoelectronics/NSL-5910/NSL-5910-ND/5436028

and an updated code that adjusts sensitivity for ambient room light (basically it jitters around less).

Code: [Select]
int gain;
#include <Stepper.h>
#define STEPS 4096
Stepper stepper1(STEPS, 4, 5, 6, 7);
Stepper stepper2(STEPS, 8, 9, 10, 11);


void setup() {
Serial.begin(9600);
stepper1.setSpeed(6);
stepper2.setSpeed(6);
stepper1.step(100);
  delay(5);
  stepper1.step(-100);
  delay(5);
  stepper2.step(100);
  delay(5);
  stepper2.step(-100);
  delay(5);

}

void loop() {
 
  digitalWrite(4,LOW);
  digitalWrite(5,LOW);
  digitalWrite(6,LOW);
  digitalWrite(7,LOW);
  digitalWrite(8,LOW);
  digitalWrite(9,LOW);
  digitalWrite(10,LOW);
  digitalWrite(11,LOW);
 
  delay(1);
  float sensor1 = analogRead(A0);
  delay(1);
  float sensor2 = analogRead(A6);
  delay(1);
  float sensor3 = analogRead(A2);
  delay(1);
  float sensor4 = analogRead(A4);
  delay(1);
  Serial.print(sensor1);
  Serial.print(",");
  Serial.print(sensor2);
  Serial.print(",");
  Serial.print(sensor3);
  Serial.print(",");
  Serial.println(sensor4);
  gain = 1;
 
  if (((sensor1)+(sensor2)+(sensor3)+(sensor4))/4<950) {
    gain = 1;
  }
  if (((sensor1)+(sensor2)+(sensor3)+(sensor4))/4<950) {
    gain = 3;
  }
  if (((sensor1)+(sensor2)+(sensor3)+(sensor4))/4<900) {
    gain = 5;
  }
  if (((sensor1)+(sensor2)+(sensor3)+(sensor4))/4<850) {
    gain = 7;
  }
  if (((sensor1)+(sensor2)+(sensor3)+(sensor4))/4<800) {
    gain = 10;
  }
  if (sensor1>(sensor4+(gain))) {
    stepper2.step(15);
  }
  if (sensor4>(sensor1+(gain))) {
    stepper2.step(-15);
  }
  if (sensor2>(sensor3+(gain))) {
    stepper1.step(15);
  }
  if (sensor3>(sensor2+(gain))) {
    stepper1.step(-15);
  }
 
 
}

jeremy gwilt

Re: mini solar tracker
« Reply #17, on March 25th, 2017, 07:21 AM »
due to a conflict on the arduino nano between the serial communications and the stepper controllers, it looks like a second board will be needed for data-logging.
as it stands, accessing the serial monitor on the tracker causes hang-ups in the tx/rx buffers.....which makes the panel (stepper motors) just jitter around non-stop. apparently you can get into the hardwareSerial and muck around....but thats a bit beyond me and ill do more harm than good.
second board = easier   :)

Matt Watts

Re: mini solar tracker
« Reply #18, on March 25th, 2017, 08:21 AM »
Jeremy, do you already have a second board?  If not, don't buy one, I'll send you mine.

Looks like you are bumping into some of the same kind of difficulties I had.  Got so frustrated that I changed gears and went with the Cypress PSoC 5LP.  For the price and what it can do, I'm just not an Arduino guy anymore.

jeremy gwilt

Re: mini solar tracker
« Reply #19, on March 25th, 2017, 08:24 AM »
ha...no worries man. ive got a ton of em kickin around.
hardware restrictions......ive had a couple projects hit them now with arduino as well. im not quite ready to move up, but the time is soon coming  :)

Matt Watts

Re: mini solar tracker
« Reply #20, on March 25th, 2017, 08:26 AM »
Take a peek at that link when you're bored (if that ever happens).  If you like what you see, I can help you get going.  Learning curve is a bit steep at first, but once a few concepts set-in, you'll be good to go with anything you can throw at it.

jeremy gwilt

Re: mini solar tracker
« Reply #21, on March 26th, 2017, 07:40 PM »
first bit of sketchy data. i spent the morning calibrating, so this starts at about 1PM.
ill do up a quick sketch of the circuit used. all data was collected using PLX-DAQ and excel, graph generated by Plotly.

 Snap 2017-03-26 at 20.28.29.png - 36.49 kB, 851x483, viewed 39 times.


jeremy gwilt

Re: mini solar tracker
« Reply #22, on March 26th, 2017, 07:57 PM »
im using a couple solar gardenlight panels in series for each station. after a few different configurations, i settled on measuring across the resistor simply because it showed the best comparison of the two situations. panel voltage is relatively similar in different light compared to how much the current increases with proper orientation.
when i get some more time ill add a voltage measurement across the led and just use a wattage line instead of current (not to scale by the way).

at least i can start to see the curves im looking for. maybe a night with less clouds will look better.

 trackercircuit.jpg - 173.72 kB, 1456x2128, viewed 47 times.



Matt Watts

Re: mini solar tracker
« Reply #24, on March 28th, 2017, 05:40 PM »
That's just cool Jeremy.

So the panel can produce a voltage pretty easily from any light, but to get current you need it as direct as possible.  I did not know that.  See people, this is the place to learn things.