Arduino Solar Tracker | Science Project
Summary
TLDRIn this video, Dr. Benino from Science Buddies demonstrates how to build an automatic solar tracker using Arduino. The project uses a solar panel mounted on a servo motor, controlled by two light-dependent resistors (LDRs). As the sun's position changes, the Arduino rotates the panel to optimize energy capture by aligning it perpendicularly to the sun's rays. The tutorial covers the circuit design, Arduino code, and practical considerations such as resistor values and sensor calibration. This simple yet effective project enhances solar panel efficiency by dynamically tracking the sun.
Takeaways
- 🔧 The video demonstrates how to make an automatic solar tracker using Arduino.
- ☀️ The solar panel is mounted on a servo motor and tracks sunlight using two photoresistors.
- 📉 Photoresistors, also known as light-dependent resistors, change resistance based on the amount of light hitting them.
- 🔄 The Arduino code uses the difference in light intensity between the two sensors to rotate the solar panel toward the light source.
- ⚙️ The solar tracker adjusts the panel to remain perpendicular to the sun’s rays, maximizing energy production.
- 🌞 The setup is designed to follow the sun’s east-to-west movement throughout the day, optimizing the panel’s output.
- 🔍 A dual-axis tracker can also be built, adding a second motor for vertical adjustments.
- 🛠️ The project uses simple materials like popsicle sticks and hot glue for the solar panel's structure.
- 💡 The video explains how to wire the circuit, which includes the solar panel, servo motor, and photoresistors connected to the Arduino.
- 📈 The Arduino reads voltage from the solar panel, but it still requires an external power source.
Q & A
What is the purpose of the automatic solar tracker project?
-The automatic solar tracker project is designed to optimize the energy output of a solar panel by adjusting its orientation to follow the sun's movement throughout the day, ensuring the panel remains perpendicular to the sun's rays for maximum energy production.
What components are used in this solar tracker setup?
-The solar tracker setup includes a solar panel, a servo motor, photo resistors (light-dependent resistors), a support structure made from popsicle sticks and hot glue, an Arduino, and resistors to form a voltage divider.
How do photo resistors (light-dependent resistors) work in this project?
-Photo resistors change their resistance based on the amount of light they receive. In this project, they are used to detect light from the sun. When one of the two sensors is shaded, the Arduino compares the readings and rotates the solar panel to align it with the sun.
Why is it important to orient the solar panel perpendicular to the sun’s rays?
-A solar panel produces maximum power when it is oriented perpendicular to the sun’s rays. If the sun’s rays hit the panel at a steep angle, the panel will generate less power, especially in the morning and evening.
What is the difference between a single-axis and a dual-axis solar tracker?
-A single-axis tracker moves the solar panel left and right to follow the sun’s east-to-west movement throughout the day. A dual-axis tracker, on the other hand, adjusts the panel both horizontally and vertically to account for seasonal variations in the sun’s position.
What is a voltage divider, and why is it used in this project?
-A voltage divider is a circuit with two resistors in series that converts the resistance of a photo resistor into a measurable voltage. The Arduino cannot measure resistance directly, so this technique is used to measure the light sensor readings.
Can the solar panel power the Arduino directly in this project?
-No, the solar panel does not power the Arduino directly. The solar panel's voltage is measured using one of the Arduino’s analog input pins, but the Arduino still requires external power.
What precautions must be taken when connecting a solar panel to an Arduino?
-It is important to ensure that the solar panel outputs less than 5 volts. Connecting a panel with a higher voltage can damage the Arduino, which is designed to operate at 5 volts.
How does the Arduino control the movement of the servo motor in this project?
-The Arduino reads the difference between the two light sensors. If the difference exceeds a certain threshold (e.g., greater than 50), the Arduino adjusts the servo motor's angle to rotate the solar panel towards the sensor receiving more light.
What role does the delay function play in the Arduino code for this project?
-The delay function controls how frequently the solar panel adjusts its position. A longer delay can prevent the panel from jittering back and forth, especially on partly cloudy days when light conditions change rapidly.
Outlines
🌞 Introduction to Solar Tracker with Arduino
In this introduction, Dr. Benino from Science Buddies explains the objective of the video: creating an automatic solar tracker using an Arduino. He starts by showcasing the setup with a solar panel mounted on a servo motor, supported by popsicle sticks and hot glue. The system uses photoresistors (light-dependent resistors) to detect light and adjust the panel's direction. Dr. Benino also briefly mentions the importance of the voltage divider, and how the Arduino controls the panel’s movement by comparing light intensity on the sensors.
💡 How Photoresistors Help Track the Sun
This section delves into how photoresistors function within the solar tracker. Photoresistors alter their resistance based on light intensity, and by placing two sensors on opposite sides of a vertical piece of cardboard, the Arduino can detect discrepancies in sunlight hitting them. The tracker adjusts the solar panel’s position to keep it perpendicular to the Sun for optimal energy capture. Dr. Benino demonstrates the process using a flashlight, highlighting how the tracker adjusts its position to balance the light on the sensors.
🔧 Circuit Setup and Wiring
Dr. Benino explains the circuit setup, utilizing a solar panel, servo motor, and two photoresistors. He clarifies that the solar panel doesn't power the Arduino directly; instead, its voltage is measured by the Arduino. The servo motor has three wires (ground, power, and control), which are connected to a breadboard along with the photoresistors. The photoresistors are part of a voltage divider circuit that converts resistance into voltage, which the Arduino can read. The correct wiring ensures that the system can control the solar panel’s movements accurately.
🛠️ Servo Motor Control and Code Explanation
In this paragraph, Dr. Benino walks through the Arduino code that controls the solar tracker. He introduces the Servo library and explains how the code reads analog values from the sensors to determine the light intensity. Based on the difference between sensor readings, the code adjusts the servo angle to point the solar panel toward the Sun. He also discusses how the margin variable helps prevent the servo from jittering due to small fluctuations in light intensity. Lastly, he shows how to calculate the actual voltage from the solar panel for experimentation purposes.
🔄 Fine-Tuning and Debugging the Solar Tracker
Dr. Benino discusses calibration and fine-tuning of the solar tracker. He emphasizes adjusting the resistor values and the position of the cardboard to ensure the system accurately tracks sunlight. The importance of monitoring light sensor readings during setup is highlighted, as it allows for better design adjustments. He also mentions how adding delays between rotations can prevent constant movements caused by passing clouds. The section wraps up with a TinkerCAD simulation demonstration, showing how light sensor values impact the servo motor’s rotation.
🔚 Conclusion and Project Resources
In the final segment, Dr. Benino provides concluding remarks and encourages viewers to try the solar tracker project using real sunlight. He reiterates the need for real-world testing due to the differences in sensor readings compared to the simulation. Lastly, he points viewers to additional resources for written instructions, the code, and over a thousand other STEM projects on the Science Buddies website.
Mindmap
Keywords
💡Arduino
💡Photoresistor
💡Servo Motor
💡Solar Panel
💡Voltage Divider
💡Analog Input
💡Single-Axis Tracker
💡Servo Angle
💡Light Sensors
💡Tinkercad
Highlights
Introduction to making an automatic solar tracker using Arduino.
Demonstration of solar tracker setup with servo motor, solar panel, and light sensors (photo resistors).
Explanation of how photo resistors work by changing resistance based on light exposure.
Arduino uses analog input pins to measure voltage from photo resistors and track sunlight.
Servo motor rotates the solar panel based on the difference in light hitting two photo resistors.
Single-axis solar tracker adjusts solar panel left and right to follow the sun's movement.
Comparison of single-axis and dual-axis trackers, which follow both east-west and seasonal sun movements.
The purpose of a solar tracker is to maximize power output by keeping the panel perpendicular to the sun's rays.
Overview of the circuit assembly using an Arduino, breadboard, servo motor, and photo resistors.
Important safety note: solar panel voltage should not exceed 5V to avoid damaging the Arduino.
Code logic for reading photo resistor values and adjusting the servo angle based on the difference in light.
Servo movement is restricted between 0 and 180 degrees to prevent over-rotation.
Photo resistor readings are stabilized by setting a margin to prevent small fluctuations from causing servo jitter.
Code explanation for converting analog inputs into actual voltage values for measuring solar panel efficiency.
Simulating the solar tracker setup in Tinkercad and showing how the light sensor readings affect servo movement.
Transcripts
hi this is Dr benino with science
buddies and in this video I will show
you how to make an automatic solar
tracker using an Arduino now that
previous clip was a time lapse of the
setup working outside in direct sunlight
here I have it set up indoors so I can
demonstrate its use with a flashlight so
first let's take a look at the physical
setup I have a solar panel mounted on a
Servo motor and a support structure
built from popsicle sticks and hot GL
blue here that holds the solar panel at
an angle and most importantly up here
above the solar panel I have two light
sensors these are called photo resistors
or light dependent resistors they are
resistors that change their resistance
value depending on the amount of light
that hits them the resistance gets lower
when there's a lot of light and higher
when it's dark and we have a separate
tutorial video all about using these
sensors with an arduinos I'm not going
to go over all those details again in
this video but long story short you
can't measure their resistance directly
but you can measure the voltage from the
arduino's analog input pins by
connecting them to another resistor
forming something called a voltage
divider again go check out our other
video Linked In the description of this
one if you want to learn more about
these light sensors and how they work
what we are doing with them in this
project is using two of them mounted on
opposite sides of this vertical piece of
cardboard so so what happens is
depending on the location of the Sun in
the sky if the Sun is slightly off to
one side one of these will be shaded
while the other one gets hit directly
with light and the Arduino code looks at
the difference between these two sensor
readings and will rotate the solar panel
until the readings are approximately
equal meaning that this piece of
cardboard is pointed directly at the Sun
and both of the light sensors are
getting hit by light so you can see that
if I demonstrate with the flashlight
here right now just based on the ambient
internal Lighting in the room I'm in
this has kind of found its equilibrium
position but if I take the flashlight
and add more light on one of the sensors
it is going to rotate the solar panel
towards that side and then if I switch
to the other side it's going to rotate
back in that direction so again I am
just using a flashlight here to quickly
demonstrate this if this was outside you
would have the sun gradually moving
through the sky throughout the day so
moving much more slowly and as it moves
it's slowly going to start shading One
of Those sensors and rotate the solar
panel to track the sun now the reason
for doing this is that a solar panel
produces maximum power when it is
oriented perpendicular to the sun's Rays
so for a fixed solar panel installation
where the panel does not move the panel
is going to produce less power early in
the morning and later in the evening
when when the rays are hitting the solar
panel at a very steep angle so this is a
single axis tracker that rotates the
panel left and right to follow the sun's
east to west movement throughout the day
you can also make a dual Axis or two
axis tracker with a second motor that
has motion to adjust the panels up and
down to account for seasonal variation
in the sun's position as it moves up and
down in the sky throughout the year what
I will do in the rest of this video is
show you how to assemble the circuit and
code for a single AIS tracker with a
single Servo motor and two photo
resistors but you could duplicate this
setup and add another motor and another
pair of photo resistors to make a two
AIS tracker let's switch over to the
computer to take a closer look at the
circuit diagram and the code so here we
have the circuit built in a simulation
program called Tinker cat we also have a
tutorial about this software Linked In
Our Arduino tutorial playlist in the
description of this video so in the
circuit we have the four main components
spread out here since we can't do the
physically physical assembly in the
simulation we have the servo motor the
two photo resistors and the solar panel
which again are all connected together
with hot glue and popsicle sticks you
can check out the link to the project
for more pictures of that setup they are
all wired to a breadboard and connected
to our Arduino one note the the solar
panel itself is not actually powering
the Arduino in this project we are
measuring the voltage from the solar
panel using one of the arduino's analog
input pins this allows you to do an
experiment for example to compare the
voltage throughout the day with a fixed
panel and a movable panel mounted on the
servo but it is not powering the Arduino
the Arduino still requires external
power one very important note if you
connect your solar panels output
directly to an Arduino like this you
must have a small solar panel that will
output less than 5 volts trying to send
a higher voltage into your Arduino can
damage it it is only designed to operate
at 5 volts and measure up to 5 volts on
the analog input pin you can use
something called a voltage divider to
lower the voltage of your solar panel
and measure the voltage from a bigger
panel but I'm not going to cover that in
this video for purposes of a science
project we just recommend a smaller
panel that outputs less than 5 Vols and
then you don't need to worry about it
looking at the connections on the
breadboard here we have the ground or
black wire from the solar panel going to
the ground bus on the breadboard we have
the positive wire from the solar panel
going to one of the uo's analog input
pins we have the servo motor which has
three wires now depending on where you
buy your Servo the colors of the wires
may vary for this common type of Servo
we have brown which is is ground and
going to the ground bus on the
breadboard red which is power going to
the positive BR bus on the breadboard
which is connected to 5 Vols from the
Arduino and orange which is the control
signal in this case going to Arduino pin
9 we then have the two photo resistors
each photo resistor has two pins one of
those pins is connected to 5 volts and
the other pin is connected to one end of
a resistor and that resist
then goes to ground the size of this
resistor is going to depend on the
resistance of your photo resistors you
might have to tweak this and try
different resistor values to get the
best readings but 10 kiloohms is
generally a good place to start I should
have mentioned that you can also find
this diagram and a link to the tinkercad
Circuit simulation in the description of
the
video finally we have two more wires
going over to other analog inputs we
have a connection on the breadboard
between this fixed resistor and the one
leg of the photo resistor that goes over
to an analog input and again that is
taking the voltage from this circuit
called a voltage divider where you have
two resistors in series converting the
resistance of this photo resistor to a
voltage that can be measured directly by
the Arduino because the Arduino cannot
measure resistance directly and again we
have another tutorial video All About
these photo resistors so you can learn
more about them in that video I'm not
going to going to cover it here we have
another wire that does the same thing
connecting from between this photo
resistor and this resistor over to one
of the aro's analog inputs so that is it
for the circuit let's take a look at the
code looking at the code and if you want
to copy paste this again you can find a
link to it in the description the first
thing we do is include the Arduino Servo
Library we then declare a bunch of
variables for the pins we are using so
we have two analog pins for the light
sensors we have one for measuring the
solar panel
and we have one for controlling the
servo we declare a variable for the
servo angle variables for the two light
sensor readings and the difference
between them and then we have a margin
variable where we are going to take
action to move the servo if the
difference is greater than this margin
but if it's less than that margin which
you'll see later we won't do anything
because we don't want the servo to
constantly Jitter back and forth due to
small
variations we also have a variable to
read the voltage from the solar panel
but the arduino's analog inputs as we
will see later do not directly give you
the voltage so we have another variable
to convert that to the actual voltage of
the panel and then we create a Servo
object that we are going to use to refer
to our servo motor using the Arduino
Servo library in our setup function we
attach our Servo object to the servo pin
we set the initial angle of the servo
motor and and we initialize serial
communication so we can print out some
information to the serial monitor later
in the loop function we use the analog
read command to get the value for both
of our light sensor pins we then
calculate the difference between them
and then again here is the key part of
the code that's going to move the servo
motor depending on this reading now if
you were watching very closely you might
have seen that I changed something there
which I will explain in a minute but
first if the difference is greater than
the margin variable that we declared
earlier so if the difference is greater
than 50 then we want to increase the
servo angle but the servo only has a
range of 0 to 180 so we only want to in
this case if I'm adding five to the
angle increase it if the angle is
already less than 176 so if the angle is
equal to 175 I will add five and get 180
but the angle can't go over 180 so I
don't want to add it if for example the
angle is 176 and I add five add five I
would get 181 I don't want that what you
may have noticed earlier in the video
this said
180 that would work if I was only
changing the angle by one at a time so
for example if the angle is
179 that would be less than 180 then
this would be true I would add one to
the angle and get 180 but if you were
changing it by larger increments you
need to change this value accordingly so
in this case 176
and then same thing down here if the
difference is less than negative margins
so if the difference is less than -50
then I want to decrease the angle but
again I only want to do that if I'm not
going to make the angle itself negative
because the angle should not go below
zero so again if the difference between
the two light sensor values is greater
than 50 I'm going to rotate the servvo
one way if it's less than -50 I'm going
to rotate the servo the other way but if
it's in between between -50 and postive
50 I'm just not going to do anything and
that is because I don't want the servo
to constantly Jitter back and forth just
due to very small fluctuations in the
light sensor reading I really only want
it to start rotating with larger
changes I'm then going to write the new
angle to the servo motor and I could
have done this earlier but I'm going to
get the reading from the solar panel and
the analog read command on the Arduino
gives you a number between 0 and
1,23 so you can convert that to a
voltage between 0 and 5 using this
formula here so again you can use this
to record your actual solar panel
voltage or you could also do this with a
multimeter if you have one available and
track that throughout the day comparing
the results with a fixed panel to that
with a movable panel finally I have a
bunch of Serial print commands to print
out the light sensor readings and the
solar panel voltage printing out these
readings is useful for calibration as
you adjust things like the size and
position of that piece of cardboard
where the sensors are mounted and maybe
changing the value of this fixed
resistor to make sure that you are
getting a difference in the two readings
when one of the sensors is shaded and
the other one is not so again that is
mostly useful for the initial setup and
debugging and design process and then
once everything is working you're going
to want to look at the solar panel
voltage print out finally in the actual
code running on the physical Arduino I
have a delay here I have that commented
out in Tinker CAD because the simulation
was running kind of slow but you don't
necessarily need to reposition the panel
every second especially maybe if it's a
partly cloudy day and you don't want to
be moving back and forth all the time
with clouds so you could add an even
longer delay here if we run the
simulation in tinkercad it will let us
click on the light sensors to simulate
the amount of light hitting them so it
starts with a default of very dark but
you can see if I
increase the amount of light hitting
this sensor it makes the servo rotate
towards that one if I click on the other
one and increase the amount of light
here as I
exceed that first sensor and then maybe
drop this one down a little bit it
rotates over towards this sensor and I
can look at that in the serial monitor
here you see it is printing out both
sensor readings and in this case I'm
getting 974 on One sensor 879 on the
other sensor so that difference was
greater than 50 so it was rotating but
if I move these back
down the servo is already at its maximum
position so it's not going to rotate
anyway but for example if I start
increasing this one again you see it's
not rotating yet because the difference
here is not greater than 50 yet but if I
increase this one all the way and drop
this one down a little bit as the
difference becomes greater than 50 the
servo is going to rotate back in the
opposite direction this is just a
simulation so clearly you will need to
try this with real sunlight on your
physical Arduino because the readings
you're going to get from your physical
photo resistors are going to be
different remember that for written
instructions for this project you can
check out the link in the video
description and for over a thousand
other projects in all areas of Science
and Engineering not just Arduino and
electronics check out the rest of our
YouTube channel and our website
www.sciencebuddies.org
Browse More Related Video
Automatic Dog (or cat) Treat Dispenser with Arduino | Science Project
FULL ILMU GRATIS !! INILAH CARA MEMBUAT LAMPU TANPA LISTRIK PLN TERMUDAH !!
Solar PV (Part 1)
INTEGRATION OF SENSOR AND ACTUATORS WITH ARDUINO-I
How to Use a TCS3200 Color Sensor with Arduino (Lesson #38)
شرح طريقة تحكم step motor من خلال الاردوينو Arduino
5.0 / 5 (0 votes)