mini solar tracker
work in progress
early look at panel axis
and some early movement on the base axis
https://www.youtube.com/watch?v=UnLXis7kb9M&feature=youtu.be
https://www.youtube.com/watch?v=UnLXis7kb9M&feature=youtu.be
...
both axis
Nice! Can't wait for a quick video demo of it doing its thing.
working on the sensor!
...
hopefully i can get to software tonight!
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);
}
}
jittery movement due to no 'zero' point being established yet.....just testing movement.
https://www.youtube.com/watch?v=NCYNjrhktUI
https://www.youtube.com/watch?v=NCYNjrhktUI
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.
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.
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);
}
}
...
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]
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).
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);
}
}
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 :)
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 :)
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.
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.
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 :)
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 :)
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.
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.
ill do up a quick sketch of the circuit used. all data was collected using PLX-DAQ and excel, graph generated by Plotly.
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.
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.
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.
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.