Dual Axis Solar Tracker

by TECHATRONIC in Circuits > Arduino

49 Views, 0 Favorites, 0 Comments

Dual Axis Solar Tracker

solar-tracker.png

Hey Folks, Welcome back to another interesting Project based on Arduino. This project is highly demanding among engineering students and hobbyist, so enjoy and do try to DIY it. Today we're going to make a dual-axis solar tracker using Arduino UNO and few other passive components. This can easily be built as all the components are easily available in the local market.

We'll use some components like Servo motor, Solar Panel which are main components for this project. As you all know, Arduino UNO is a most popular microcontroller which is used for most of the projects. As it has 10-bit ADC, it is very helpful in reading and writing Analog values. So we’re going to use LDR for calculating the intensity of Light falling on the 4 LDR's to calculate the area where most of the light is falling to make the Solar Panel rotate in the desired direction using servo motors.

Note: As this project is for demonstration purpose, so I'll shall not guarantee the fullest potential of the LDR's and Solar Panel to come out from this DIY. So you may think twice before making a choice for better quality components. Also, the power generated from this project may also depend on intensity of light and rotation of the servo motors.

For more information about this project visit original post of this project also bookmark TECHATRONIC.COM as all my further projects and tutorials will be pre-uploaded here.

Material Required

510775989.jpg

  • Arduino Uno
  • 4 LDR
  • 4- 10K Ohm Resistor
  • 2- Servo Motor
  • Solar Panel
  • Jumper wire
  • Breadboard

Circuit Diagram

Solar-4.jpg

Code

#include <Servo.h>
Servo horizontal; // horizontal servo
int servoh = 180;
int servohLimitHigh = 175;
int servohLimitLow = 5;
// 65 degrees MAX

Servo vertical; // vertical servo
int servov = 45;
int servovLimitHigh = 100;
int servovLimitLow = 1;


 
// LDR pin connections
// name = analogpin;
int ldrlt = A0; //LDR top left – BOTTOM LEFT <— BDG
int ldrrt = A3; //LDR top rigt – BOTTOM RIGHT
int ldrld = A1; //LDR down left – TOP LEFT
int ldrrd = A2; //ldr down rigt – TOP RIGHT

void setup(){
horizontal.attach(9);
vertical.attach(10);
horizontal.write(180);
vertical.write(45);
delay(2500);
}
void loop() {
int lt = analogRead(ldrlt); // top left
int rt = analogRead(ldrrt); // top right
int ld = analogRead(ldrld); // down left
int rd = analogRead(ldrrd); // down right
int dtime = 10; int tol = 90; // dtime=diffirence time, tol=toleransi
int avt = (lt + rt) / 2; // average value top
int avd = (ld + rd) / 2; // average value down
int avl = (lt + ld) / 2; // average value left
int avr = (rt + rd) / 2; // average value right
int dvert = avt – avd; // check the diffirence of up and down
int dhoriz = avl – avr;// check the diffirence og left and rigt

if (-1*tol > dvert || dvert > tol)
{
if (avt > avd)
{
servov = ++servov;
if (servov > servovLimitHigh)
{servov = servovLimitHigh;}
}
else if (avt < avd)
{servov= –servov;
if (servov < servovLimitLow)
{ servov = servovLimitLow;}
}
vertical.write(servov);
}
if (-1*tol > dhoriz || dhoriz > tol) // check if the diffirence is in the tolerance else change horizontal angle
{
if (avl > avr)
{
servoh = –servoh;
if (servoh < servohLimitLow)
{
servoh = servohLimitLow;
}
}
else if (avl < avr)
{
servoh = ++servoh;
if (servoh > servohLimitHigh)
{
servoh = servohLimitHigh;
}
}
else if (avl = avr)
{
delay(5000);
}
horizontal.write(servoh);
}

delay(dtime);

}

This is the only brief information for this project for full version visit original posts for detailed explanation about code