Solar Tracker Arduino Project

Overview:

This device keeps a flat panel holding a solar cell continuously following the sun as it moves across the sky. The Arduino uses 2 light dependent resistors (LDRs) that are separated by a fin to compare the light levels on either side and then rotate the servo attached to the panel towards the more illuminated LDR until the two detectors are equal. This is a nice Arduino project which combines sensors with servos, with logic that can be tuned, and has a practical application relating to clean energy.

Background:

Solar panels generate the most electricity when the incoming light is perpendicular to the panel. A solar tracker rotates the panel along one or two axes (altitude and azimuth) so that it always facing the sun directly. This can add up to 25% more energy compared with a fixed panel. Trackers are also essential with concentrating or focusing collectors which don’t work well unless they are aligned with the sun exactly. A focusing collector could rotate the lens or reflector around the focal point.  This particular design is a single axis mount in which the rotating axis is directed at the North Star (an equatorial mount). This design will track the sun with a single rotation from east to west.

Earth Science- The sun moves across the sky at 15 degrees an hour (because the Earth rotate 360 degrees in 24 hours. In winter the day is short and the sun rises south of east and sets south of west, and the noon angle is low. In summer the day is long and the sun rises north of east and sets north of west. The peak noon angle for the sun on the equinox is 90 degrees – the latitude. At the summer solstice it is 23.38 degrees higher than this, and at winter solstice is 23.38 less than that.

Research Connection:

Scientists and engineers are trying to increase the efficiency of solar cells and decrease the expense. Trackers were considered practical when solar cells were very expensive. Now prices have come down so much that the emphasis is on large areas of fixed panels and on covering all available building surfaces with panels. Concentrating solar thermal collectors use hundreds of mirrors which rotate to reflect light to central power tower. Solar thermal trackers are still relevant because they have the potential to store energy with molten salts for several hours after sun down.  This helps deliver solar generated power in the evening when demand peaks.

NGSS Standards:

MS-PS3-3 Apply scientific principles to design, construct, and test a device that either minimizes or maximizes thermal energy transfer.*
MS-ESS1-1 Develop and use a model of the Earth-sun-moon system to describe the cyclic patterns of lunar phases, eclipses of the sun and moon, and seasons.
4-PS3-4 Apply scientific ideas to design, test, and refine a device that converts energy from one form to another.*
HS-PS3-3. Design, build, and refine a device that works within given constraints to convert one form of energy into another form of energy.*

 

Materials:

  • Arduino board, power supply, USB cable,
  • 2 light dependent resistors (LDR) with the same resistance range
  • Two 10K resistors
  • Servo
  • Cardboard, balsa, straight pins, wires, mounting screws

Procedure:

Introduction

Review with the students how the sun appears to move across the sky throughout the day, and seasonally. Work through the math to explain that if the earth rotates 360 degrees in 24 hours that equals 15 degrees per hour. Have students develop design requirements for their device. This could include rotating 15 degrees per hour, adjusting both the altitude and azimuth, resetting its position from the night before to be ready for the next morning.

Assembly

  1. Connect each LDR to 3 or 5 Volts and to one to Pin A0 and then to a 10K resistor connected to ground. Connect the other to Pin A1 and then to a 10K resistor to ground. This is a voltage splitter which will gives a variable voltage to the analog inputs depending the on the light hitting each detector.
  2. Connect the servo brown wire to ground, the red wire to 5V and orange wire to digital pin 9.
  3. If you are doing this as a class this would be a time to brainstorm a pseudo-code description of what the program needs to do. Basically if L > R then turn the servo one way, else rotate the other. You need a tolerance factor for the minimum difference so that it doesn’t just jitter with fluctuating measurements from the sensors.
  4. Convert your pseudocode into real code beginning with an example from Arduino IDE such as “Servo”.
  5. Load the program and test it to confirm that light cast on one LDR causes the servo to turn one way and vice versa. If you need to troubleshoot use the “digital write” function to test values from the sensors, and your if-then statement.
  6. After testing on the breadboard you can build a complete apparatus. A piece of balsa can be mounted to the servo mount arm using pins that are pushed through the hole and into the end grain of the board.
  7. Mount the two LDRs on either side of the shading fin made with cardboard or balsa. Push the leads through and so they are accessible from the back.
  8. Connect thin flexible wires to the LDRs so that they will present no resistance to the rotation of the balsa.
  9. Cut a box at a diagonal and mount the top with a pin pressed into a balsa strut at the top, and a pin holding the servo to struts at the bottom. The Axis angle should be set at the angle of your latitude.
  10. You can mount the Arduino on the side of the box using small bolts so that the board can be removed without damage. It is possible to wire this design using only the Arduino inputs and no breadboard. (press the resistors into the A0 and A1 hole in addition to the LDR lead, and then run the resistors to ground.)
  11. Test your finished apparatus. Adjust the delay to make it respond faster, and change the tolerance to make it more stable when it finds its optimal position.

 

Code Example

//Single axis solar tracker program

#include <Servo.h> // loads the servo library

Servo myservo;  // create servo object to control a servo

int pos = 90;    // variable to store the servo position 0-180

int sensorPin = A0;    // select the input pin for the potentiometer

int sensorPin2 = A1;

int sensorValue = 0;  // variable to store the value coming from the sensor

int sensorValue2 = 0;

int diffval = 0;

int errorval = 15;

void setup()

{

myservo.attach(9);  // attaches the servo on pin 9 to the servo object

//Serial.begin(9600); // uncomment if you need to measure outputs with the serial monitor.

}

void loop() {

sensorValue = analogRead(sensorPin);

sensorValue2 = analogRead(sensorPin2);

diffval = sensorValue – sensorValue2;

if (abs(diffval) > errorval) {

if (diffval > 0) {

pos = pos + 5;

}

else {

pos = pos – 5;

}

myservo.write(pos);

delay(100);

}

 

Extensions:

Make the Arduino/servo into a clock drive that rotates 15 degree per hour and resets each evening back to the sunrise position.

Scale up the model using relays and motors that could move a larger panel.

Make a solar powered tracker that uses two solar cells to power a motor to rotate the panel.

Mount a mirror on the panel and change the program so that it always reflects light to a fixed point on the wall.

Resources:

arduino tracker lesson

INO file for arduino tracker1

https://www.electronicshub.org/arduino-solar-tracker/

http://www.electroschematics.com/10182/arduino-solar-tracker-servo/

http://fritzing.org

Materials Sources:

Photoresister LDR  100  $7.99

https://www.amazon.com/gp/product/B074QLFCF6/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1

solar panel

https://www.ebay.com/itm/Mini-1-5V-0-65W-300mA-Solar-Panel-Module-Wires-for-DIY-Lights-Toys-Charger-Showy/172811803708?_trkparms=aid%3D222007%26algo%3DSIM.MBE%26ao%3D1%26asc%3D49564%26meid%3D1a31c4ba81424be7b7023a7da9ab3427%26pid%3D100011%26rk%3D6%26rkt%3D12%26sd%3D371433325541&_trksid=p2047675.c100011.m1850

 

“Providing clean energy to the inhabitants of our planet is a major challenge to future generations. The University of Washington is to be congratulated for establishing an Institute where faculty and students can work together to tackle the difficult global challenge of energy sustainability.”
– Mildred Dresselhaus, Professor of Physics and Electrical Engineering, Emerita and Institute Professor, Massachusetts Institute of Technology
“Energy competition is opening up in a variety of ways, the push for carbon control will continue, and the rate of technology advancement is exponential. All the things I’ve seen at the CEI are just perfect for the way we see things going in energy. You guys are at the cutting edge. We’re counting on you.”
– Ronald Litzinger, President, Edison Energy