Solar Tracking with an Arduino Uno - Project Guidance

Hi! I and a friend are trying to build a solar tracker with solar panels. However, we have very limited knowledge on using Arduinos and coding, so we would like some guidance and advice with our project. So far, we have the following materials for our project:

  • 1 Arduino Uno
  • 2 bipolar stepper motors (I have heard servo motors work better, however they were unavailable at my electronics store)
  • 2 potentiometers (to aid with position indicating)
  • 4 photoresistors
  • 1 breadboard
  • other wires and jumpers

Our plan was to use the photoresistors to determine the brightest point, then use the potentiometer as a positition indicator to tell the stepper motors how much they should turn so that the solar panel faces the brightest spot in the room.

Is this a feasable idea, or should we be utilizing our materials in a different way? I have tried to start coding to learn the syntax (I managed to make the stepper motor turn when I turn the knob of the potentiometer). However, knowing if our plan would work would be great before trying to code it.

Thanks in advance for any help I recieve! I’m very new to this, so let me know if anything I have said was unclear and I will do my best to clarify my project!

Several questions for you:

What exactly are you trying to achieve?

Is the idea to keep the panel out of the shade from a building or tree or to have it pointing directly at the sun as much as possible?

If so, do you plan to allow for seasonal adjustments between the equinox and the solstice?

Would you be better off trying to move the light via a mirror or some sort of focusing mechanism?

How much do your panels weigh and how much current do you expect the motors to draw to move them?

Assuming this will be outside, how do you plan to power it? Protect it from the elements?

Hi, I think you need to use the "Search the Arduino Forum" facility in the top right hand corner of this screen.

There are many PV array systems made with arduino.

Even google arduino PV array

You only need to mount the photoresistors on the PV array and using the photoresistor response to the light, move the panel to the position of received maximum solar energy.

All you need to do is workout which directions to move the panels, not the complicated way of working out the position that they need to be pointing, that way you do not need the potentiometers and avoid the calcs for location, time of year etc.

You use the photoresistors as the feedback,

Thank you for the questions, @TheTinkerer. I'll answer each question one by one. I think some background info on the project would help: This is for a science fair project in school. My partner and I are looking to optimize the solar panels in a cheap, easy way so that they utilize as much light as possible. As a light source, we are using a Solar Simulator at our local university.

1. What exactly are you trying to achieve? We are trying to build a solar tracker that, in a real-life scenario, track the sun based on the brightest point in the sky.

2. Is the idea to keep the panel out of the shade from a building or tree or to have it pointing directly at the sun as much as possible? The idea is to have the solar cell point directly at the sun (or the light source) as much as possible.

3. If so, do you plan to allow for seasonal adjustments between the equinox and the solstice? Since we have a Solar Simulator, we are not accommodating seasonal adjustments at this stage.

4. Would you be better off trying to move the light via a mirror or some sort of focusing mechanism? Due to time constraints/lack of resources, we would rather not investigate moving the light via a mirror or focusing mechanism.

5. How much do your panels weigh and how much current do you expect the motors to draw to move them? We will look into that. Unfortunately, the solar panels are with the University for a week. However, they are small; approximately 17 cm x 17 cm (6.7 inches x 6.7 inches).

6.Assuming this will be outside, how do you plan to power it? Protect it from the elements? Luckily, the Solar Simulator is indoors, so we will not have to worry about adequately supplying power or protecting it.

I hope that clarifies some of the details! Thanks!

@TomGeorge, thanks, you just made this project a whole lot simpler! I will look into the PV array, thanks for the directions.

Using photoresistors only works when the Sun is clear in the sky and there are no clouds. If there are clouds, then the light is diffused and you wont get a clear location in which to aim the tracker. A better way is to simply junk the photoresistors and use an Solar almanac which will tell you precisily where in the sky the sun is on any day of the year, given your latitude and the time of day. That way the tracker is always aimed at the Sun even if you cant see it.

With a pair of Light Dependent Resistors the code can be very simple. Like this pseudo code

void loop() {
  readLDRs();
  if (left brighter than right) {
    move left a little
  }
  if (right brighter than left) {
    move right a little
  }
}

Stepper motors are very inefficient. If you use them to hold position they need full power all the time and would probably consume more energy than the solar panels can produce.

You could use the motors to turn a threaded rod and then the panels could not reverse the motion and you could depower the motor. But you might as well use a cheap DC motor.

Another option is a DC motor with a worm drive. Screen-wiper motors from crashed cars are a good source of cheap powerful motors.

IMHO if the LDR's can't detect any difference of lightness in the sky, neither will the solar panels. I prefer siimplicity to the complexity of almanacs and clocks and longitude. But each to his own.

...R

Hi,

mauried:
Using photoresistors only works when the Sun is clear in the sky and there are no clouds.
If there are clouds, then the light is diffused and you wont get a clear location in which to aim the tracker.
A better way is to simply junk the photoresistors and use an Solar almanac which will tell you precisily where in the sky the sun is on any day of the year, given your latitude and the time of day.
That way the tracker is always aimed at the Sun even if you cant see it.

The panels need to be pointed at the part of the sky that is the brightest, why won’t photoresistors work in overcast sky.
They will still find the area of sky with the highest solar radiation.
If a solar almanac can tell you where the sun is, why can’t an array of photoresistors looking at the REAL sky.
MarsSolar.jpg
The picture attached and shown is of a local factory PV array, they have two of these and both only use solar radiated energy tracking, no solar algorithm. And this part of Australia is not known for its bright sunny and warm days.

Tom… :slight_smile:

Hi,

Google Map. -37.5360075, 143.8037132

Tom.... :)

Alright, here is the code I have so far. It is supposed to read the values of the two photoresistors (I intend on adding more), then make the Stepper Motor move right or left accordingly.

My intention was to have the motor move, stop, read the values of the LDRs, move, stop, read values, repeat.

#include <Stepper.h>
#define STEPS 200

Stepper myStepper(STEPS, 8, 9, 10, 11);
int rightLDR = A0; // position of the right LDR
int leftLDR = A1; // position of the left LDR

void setup() {
  pinMode(rightLDR, INPUT);
  pinMode(leftLDR, INPUT);
  delay(2000); // a 2 second delay to set up the solar panel
  myStepper.setSpeed(30); //setting speed to 30 RPM
}

void loop() {
  int valRight = analogRead(rightLDR); // read the value of the right LDR
  int valLeft = analogRead(leftLDR); // read the value of the left LDR 
  if(valRight > valLeft)
  {
    myStepper.step(-50); // move 50 steps one way
    myStepper.setSpeed(0);
  }
  else if(valRight < valLeft)
  {
    myStepper.step(50); // move 50 steps the opposite way
    myStepper.setSpeed(0);
  }
  
  delay(50);
}

The motor turns 90 degrees clockwise and stops like I intended it to. But I want it to move again, for as many times as necessary. Is there a practical way of doing this, like an infinite loop?

As well, the motor does not respond to the photoresistor in pin A1, so it ONLY moves counterclockwise. Anyone have an idea as for why? Thanks so much for your help.

But I want it to move again, for as many times as necessary. Is there a practical way of doing this, like an infinite loop?

It is already in an infinite loop, namely the function loop().

Leave out the stepper for the time being and print out analogRead values from the two LDRs, in various light levels. They may not be working as you expect.

Hi, To stop any jittering around the point that it needs to got to, you need to put in some hysteresis. That is only move if the difference between the two readings is greater than a certain level, like 5.

Tom.... :)