Sun Tracking Solar Panel Using Arduino Project: A Step-by-Step Guide with Code
Here, we have designed the prototype of the Sun-Tracking Solar Panel using Arduino Uno. The servo motors are mounted on the 3D printed rotating fixture to rotate the solar panel.
Nowadays, we can see the use of the solar system everywhere. The sun is a natural and free source of energy. The sun emits solar radiation or electromagnetic radiation. In the solar energy system, these radiations are used to generate electricity with the help of photovoltaic cells, or solar cells. In this tutorial, we learn about the prototype of the Sun Tracking Solar Panel using Arduino.
Before understanding the workings and advantages of the solar tracker, we need to know why we have built it.
Need for a solar tracker
Rotationally, every season comes with its own translation movements, which affect the cycles of day and night and the temperature differences around the world. Electromagnetic radiation depends on these movements. These radiations will change depending on the latitude and the time of year.
The above image shows the angle of incidence of sun rays at noon and on a horizontal surface in winter and summer. Thus, daily solar orientations vary depending on the latitude, and they directly affect the angle of incidence of sun rays. This angle of incidence is a key point in producing solar energy.
Therefore, a solar tracking system is essential to knowing the exact orientation and inclination of our location.
Types of solar tracking system
As per the mode of motion, the solar tracking system is classified into two types:
- Single-axis solar tracking system
- Dual-axis solar tracking system
There are two horizontal axes and one vertical axis for a moving surface. The surface rotates around each axis to get the right angle for receiving the maximum sunlight.
The surface is adjusted around a single axis in a single-axis tracking system. When using a dual-axis tracking system, the surface rotates simultaneously around two axes.
Advantages of solar tracking system
- In the same amount of space, solar trackers generate more electricity than a fixed solar system, which makes them ideal for optimizing land usage.
- There are two kinds of solar trackers, such as single-axis and dual-axis. A suitable solar tracker can be installed according to the Installation size, local weather, degree of latitude, electrical requirements, etc.
- Solar trackers generate more electricity than their stationary solar systems due to direct exposure to solar rays.
- Also, the tracker system does not require long-term maintenance because of the advancements in technology and reliability of mechatronics.
- In certain states, some utilities offer time-of-use (TOU) rate plans for solar power. This utility will purchase the power generated during the peak time of the day at a higher rate. The solar tracking technology is utilized to enhance energy gains during these peak periods.
How will the sun tracking solar panels function?
The solar panel uses photovoltaic cells (PV cells). The PV cells detect the light intensity, and according to that, the tracker adjusts the direction of the solar panel to the position of the sun in the sky.
When the tracker moves the panel perpendicular to the sun, more sunlight strikes the solar panel and less light is reflected. Hence, it absorbs more energy, which can be converted into power.
In this prototype, we are using the LDR sensor to detect the light (sun) intensity and servo motors for automatic rotation of the panel using the Arduino microcontroller. The Arduino Uno board controls the motor as per the output of the LDR sensor. You can also use the potentiometer to operate this panel manually.
Building a Rotating fixture for sun tracking solar panel
In this sun-tracking solar panel with Arduino, we use 3D-printed components to create a rotating fixture. Here, we have designed the necessary small parts for the movement. In your project, you can use anything like cardboard, wood, plastic, etc. to make this fixture.
Here is our final assembly for the solar panel rotating structure. We have used two servo motors for horizontal and vertical movement. On the upper side, we have fixed four LDRs (light-dependent resistors) to detect the sun's intensity.
To create these 3D-printed components for the rotating fixtures, you can get the necessary STL files by clicking the link below.
STL Files - 3D Printed Parts for Sun Tracking Solar Panel Using Arduino
Now let's do some real work. Keep reading to understand the connection and code for this system.
Connection Diagram
The below image shows the connection of the LDR sensor and servo motor with the Arduino Uno. The Arduino Uno takes an analog input from the LDR sensor, and according to their values, the servo will rotate.
The components required for this interface are:
- Arduino Uno
- SG 90 180 Degree servo motor
- Power supply for Arduino
- 5mm LDR
- connecting wires
- Solar Panel (use the small size for this prototype)
- 1k resistor
Software & Code
Download the Arduino IDE Software for this code from the below links,
#include <Servo.h>
//definiamo i servomotori orizzontale e verticale
Servo servohori;
int servoh = 0;
int servohLimitHigh = 160;
int servohLimitLow = 60;
Servo servoverti;
int servov = 0;
int servovLimitHigh = 160;
int servovLimitLow = 60;
//Pin fotoresistenze
int ldrtopl = 2; //top left
int ldrtopr = 1; //top right
int ldrbotl = 3; // bottom left
int ldrbotr = 0; // bottom right
void setup ()
{
servohori.attach(10);
servohori.write(60);
servoverti.attach(9);
servoverti.write(60);
Serial.begin(9600);
delay(500);
}
void loop()
{
servoh = servohori.read();
servov = servoverti.read();
//Valore Analogico delle fotoresistenza
int topl = analogRead(ldrtopl);
int topr = analogRead(ldrtopr);
int botl = analogRead(ldrbotl);
int botr = analogRead(ldrbotr);
// Calcoliamo una Media
int avgtop = (topl + topr) ; //average of top
int avgbot = (botl + botr) ; //average of bottom
int avgleft = (topl + botl) ; //average of left
int avgright = (topr + botr) ; //average of right
if (avgtop < avgbot)
{
servoverti.write(servov +1);
if (servov > servovLimitHigh)
{
servov = servovLimitHigh;
}
delay(10);
}
else if (avgbot < avgtop)
{
servoverti.write(servov -1);
if (servov < servovLimitLow)
{
servov = servovLimitLow;
}
delay(10);
}
else
{
servoverti.write(servov);
}
if (avgleft > avgright)
{
servohori.write(servoh +1);
if (servoh > servohLimitHigh)
{
servoh = servohLimitHigh;
}
delay(10);
}
else if (avgright > avgleft)
{
servohori.write(servoh -1);
if (servoh < servohLimitLow)
{
servoh = servohLimitLow;
}
delay(10);
}
else
{
servohori.write(servoh);
}
delay(50);
}
The Final Output
The below GIF shows the final output of the sun-tracking solar panel using Arduino Uno.
Final Words
I hope this article helps you understand the concept of a solar tracking system, its importance, and the prototype of a sun-tracking solar panel using Arduino Uno. Similarly, you can implement a real-time-based solar tracker at home.
Excellent!
Excellent article, have plans to use solor panels that will track the sun.