Arduino Based Solar Tracker Using LDR & Servo Motor

INTRODUCTION

In this project we are going to show how to make a Arduino Based Solar Tracker using LDR & Servo Motor. The solar panel tracker is designed to follow the sun movement so that maximum light intensity hits on solar panel. Thus, increasing the power efficiency.

We have designed single axis solar tracker system. In this system the solar panel moves from east to west in a day to point in the direction of the sun. Use of solar tracker circuit in the field of energy production will increase its efficiency. This system can also be successfully implemented in other solar energy based projects like water heaters, and other solar devices.

Components Required:

Following are the list of components required to design a Solar Tracker

Arduino Uno Board
Servo Motor SG90
Tact Switch (Button)
Resistors 10K – 3 Nos
LDR – 2 Nos
Connecting Wires
5 to 12 Volt power Supply

Working of the project:

Two LDR’s (Light Dependent Resistor) LDR1 & LDR2 are connected to Analog pins of the Arduino. A solar plate is attached in parallel to the axis of the servo motor and both the sensors are kept on the solar plate as shown in the figure above.

The design & the arrangement is done in such a manner that the movement of the sun is from LDR1 to LDR2, as shown in the image below.


There are three cases that are to be followed:-

Case 1: Sun is in the left side
Light on LDR1 is high because the shadow of barrier falls on LDR2 so solar plate moves clockwise.


Case 2: Sun is in right Side
Light on LDR2 is high because the shadow of barrier falls on LDR1 so solar plate movie anticlockwise.

Case 3: Sun is in the Center
Light on both LDR’s is equal so, plate will not rotate in any direction.

Source Code/Program

For designing Arduino Based Solar Tracker Using LDR & Servo Motor you need to program Atmega 328 Arduino microcontroller. Below is the program that will interface servo motor & LDR with Arduino for Solar Tracking. Copy this code and upload it to your Arduino Board.

#include <EEPROM.h>
#include <Servo.h>

Servo myservo;

int sensor1=A1;
int sensor2=A0 ;
int calswitch=2;

int val1;
int val2;

int pos=0;
int error;
int state;

void setup() {
pinMode(sensor1,INPUT);
pinMode(sensor2,INPUT);
pinMode(calswitch,INPUT);

myservo.attach(10);
}

void loop() {
if(digitalRead(calswitch)==0) {
myservo.detach();

val1=analogRead(sensor1);
val2=analogRead(sensor2);

if (val1>val2) {error=val1-val2; state=0; }
else {error=val2-val1; state=1; }

EEPROM.write(0,error);
EEPROM.write(1,state);

delay(1000);
}

else{
myservo.attach(10);

val1=analogRead(sensor1);
val2=analogRead(sensor2);

state=EEPROM.read(1);
error=EEPROM.read(0);

if(state==0) { val1=val1-error;}
else { val2=val2-error;}

if (val1-val2>4) {myservo.write(pos); pos=pos-1; delay(10);}
else if (val2-val1>4) {myservo.write(pos); pos=pos+1; delay(10);}
else {myservo.write(pos);}

if (pos>90) {pos=90;}
else if (pos<0) {pos=0;}

}
}

Post a Comment

0 Comments