Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

CHAPTER 3

IMPLEMENTATION OF THE SYSTEM

3.1. Block Diagram of the System

Fig. 3.1 Block Diagram of the Dual Axis Solar Tracking System
The block diagram is showing that LDR sensors once sensing the sunshine
forward the signal to Microcontroller. The microcontroller is a logical device that’s
enchanting dealings on the root of sensor put in and starting the motor driver’s track
consequently. Assume if the sun changes its individual locality and go from east to
west, it’ll cause light absorption to vary on one sensor as related to different one. On
the base of light intensity feature on sensors, the controller starts driver circuits and
moves DC geared motor to new positions wherever light falling on sensor pairs is
same. The same method can maintain it up with a change in sun’s locality surrounded
by the sky. As a result, this proposed model can capture supplementary sun rays and
system’s solar energy conversion capability is greatly superior. How control
algorithm is performing gesture assessment and is that the key deciding constituent
which shows it in “Fig. 3.2,”. When it collects data from LDR sensors then main
algorithm is started. Sensor’s productivity is analogue that’s stimulated to digital
21

signals. This serviceable task is performed using analogue to digital converter (ADC).
The digitized signals are
20

forwarded to Arduino microcontroller. After collecting digital signals, it decides


relating to the movement direction and steep angle of servo motors. Control algorithm
is viewing that Arduino microcontroller drives DC geared motors as long as sensor
light sensing is not equal to one another and if sensor signals are equal. It goes to start
of the algorithm. This methodology is incessant till light falling on detector pairs is
equal and PV panel is adjusted in a position for optimum power. The voltage
generated by the solar panel is assorted and desires to be synchronized. A regulator is
often used when the solar panel which may regulate the voltage coming back from
solar panel. For this principle, supply is provided by generated solar energy. There is
not any would like to give exterior power supply that makes our system economical
and cost effective too. The purposed model can also use as an impartial system by
introducing battery storage and proper supervision of storage system. Battery storage
is controlled by the thought of generated voltage. Charging and discharging events for
storage are electing the idea of generated voltage.
Four light dependent resistors sense light intensity and Arduino receive this
signal and give output to DC motor Driver. The two DC motors, one for left-right
movement and other for top-down movement, rotate the solar panel by means of the
output sent by motor driver. This system is powered by its solar panel through Step-
Down Converter.

3.2. Flowchart of the system


This flowchart shows how the algorithm in this system work. When the
program is started, it will initialize all inputs unit equal to zero. Then it will check if
the solar panel is right angle with the sunrays to get maximum power which means
the difference between values of LDR is zero. if it is center, give delay longer to wait
for the sun to change its locality and if not, it will check alignment of panel again. If
the panel is not right angle with sun, it will check alignment for two directions,
vertical(altitude) alignment and horizontal (azimuth) alignment. For the vertical
alignment, average value of top LDRs is greater than the down, it will rotate the
motor to the desired top position and give delay. if it is less than the down, the motor
will rotate to the down position and give delay. if the conditions described above are
not occurred, it will give delay and then check for horizontal alignment. for the
horizontal rotation, average value of right LDRs is larger than the left, it will rotate
the motor to the right that is desired and give delay. if it is smaller than the right, the
21

motor will rotate to the opposite direction and give delay. Since the solar tracker are
working through the whole day, the system is made as endless system. so finally, it
will start again.
Start

Initialize all
inputs equal 0

Center YES
Delay Longer
LDR=0?
NO

Check
Alignment

Vertical NO
avt>avd? Horizontal
NO avr>avl?

YES NO YES
NO
avt<avd? avl<avr?
Rotate Motor 1 Rotate Motor 2
CW CW
YES
YES
Rotate Motor 1 Rotate Motor 2
Delay CCW CCW
Delay

Delay Delay

Delay Delay

Fig3.2 Flow Chart of the System


3.3. Schematic diagram
22

Figure.3.3. Schematic Diagram of the System


The circuit diagram of the Dual axis solar tracking system is shown in Figure.
This circuit diagram consists of eight main components. They are Arduino Uno board,
four Light dependent resistors, two DC motors, motor driver and Step-down voltage
regulator.
The two DC motor is connected to DC motor output pin of Dual H-bridge
motor driver. Output pins of Arduino, Digital output pins 11, 10, 9 and 13 are
connected to the input pins of motor driver, IN1, IN2, IN3 and IN 4 respectively. Four
LDRs are connected to the pin A0 to A3. East, West, Top and Bottom Push button
that is used for manual mode are interfaced with Digital output pins, 2, 4, 8, 12 of
Arduino respectively. The motor driver is powered by the voltage received from the
Solar panel and the Step-Down voltage regulator is used to regulate the voltage
received from the solar panel.

3.4 Arduino Program


This part of the program is about setting the constant pin numbers Pin
for West Button is pin 4, East Button pin 2, Top button pin 8, Down button pin
12, Switch 1 for Auto and Manual mode pin 7, and Switch 2 for Auto and Manual
mode pin 5 respectively. And the set the Analog input pins for Fout LDRs like
East LDR to A0, West LDR to A1, Top LDR to A2 and Down LDR to A3 And
again set the pin for H-bridge DC motor Driver. Motor Driver has four Input pins
IN1, IN2, IN3 and IN4 so set IN1 to pin 13, IN2 to 9, IN3 to 10 and IN4 to 11.
After that the program set the values for Four LDRs to zero, so the difference of
the light intensity is visible. And the set the all the error values(error, position
error, top-down position error) to zero After that the switch values to zero.
*/
//set constant pin numbers
int wbuttonPin = 4;
int ebuttonPin = 2;
int tbuttonPin = 8;
int dbuttonPin = 12;
int switch1Pin = 7;
int switch2Pin = 5;
int eldr = A0;
23

int wldr = A1;


int tldr = A2;
int dldr = A3;
int IN1 = 13;
int IN2 = 9;
int IN3 = 10;
int IN4 = 11;
int eastldr = 0;
int westldr = 0;
int topldr = 0;
int botldr = 0;
int error = 0;
int poserror = 0;
int tberror = 0;
int tbposerror = 0;
int westbutton = 0;
int eastbutton = 0;
int topbutton = 0;
int botbutton = 0;
int onoffswitch = 0;
int singledualswitch = 0;
This part of the program is defining the Input Pins and Output Pins. A0, A1,
A2, and A3 pins where the signal from the LDRs sent to (analog inputs) are defined
as INPUT; then Pins 8, 12, 4, 2, 5 and 7 (Pins for Top button, Down button, West
button, East button, Switch 2 and Switch 1) as INPUT_PULLUP and finally Pins
from Motor drivers (Pin 12, 9, 10, 11) as OUTPUT. After that the program will be
ready to operate.
void setup() {
pinMode (A0, INPUT);
pinMode (A1, INPUT);
pinMode (A3, INPUT);
pinMode (A4, INPUT);
pinMode (8, INPUT_PULLUP);
pinMode (12, INPUT_PULLUP);
24

pinMode (13, OUTPUT);


pinMode (9, OUTPUT);
pinMode (10, OUTPUT);
pinMode (11, OUTPUT);
pinMode (4, INPUT_PULLUP);
pinMode (2, INPUT_PULLUP);
pinMode (5, INPUT_PULLUP);
pinMode (7, INPUT_PULLUP);
Serial.begin(9600);
}
Then the program is stared with digitally writing IN1, IN2, IN3, IN4 to LOW which
means the controller send the signal to the motor controller to stop the Motors at first.
And then the controller will detect the state of switch by digitally read the Switch 1
and Switch 2. If the Switch 1 is LOW .i.e., Manual Rotating Mode is ON. Then Read
the Analog values of East LDR, West LDR, Top LDR and Down LDR. After that
Digitally read the East Button. If the East Button is HIGH, the controller write the
IN1 HIGH and IN2 LOW. That makes the Motor Controller to rotate the panel to the
East side. If not, the controller will write the IN1 LOW so both IN1 and IN2 are LOW
now. As the result the motor stop rotating, when stop pushing East Button. As like
the process described above, other three buttons will perform.
void loop() {Serial.print("start programm");
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
onoffswitch = digitalRead(switch1Pin);
singledualswitch = digitalRead(switch2Pin);
while (onoffswitch == LOW ) {
//manual rotating of the panel

eastldr = analogRead(A0);
westldr = analogRead(A1);
topldr = analogRead(A2);
botldr = analogRead(A3);
25

eastbutton = digitalRead(ebuttonPin);
if (eastbutton == HIGH)
{ digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
} // rotate to east side when you push the right button
else {
digitalWrite(IN1, LOW);
}
westbutton = digitalRead(wbuttonPin);
if (westbutton == HIGH)
{ digitalWrite(IN2, HIGH);
} //rotate to west side when you push the right button
else {
digitalWrite(IN2, LOW);
}
topbutton = digitalRead(tbuttonPin);
if (topbutton == HIGH)
{ digitalWrite(IN4, HIGH);
} //rotate to top side when you push the top button
else {
digitalWrite(IN4, LOW);
}

botbutton = digitalRead(bbuttonPin);
if (botbutton == HIGH)
{ digitalWrite(IN3, HIGH);
} //rotate to down side when you push the down button
else {
digitalWrite(IN3, LOW);
}
onoffswitch = digitalRead(switch1Pin);
singledualswitch = digitalRead(switch2Pin);
Serial.println(eastldr);
26

Serial.println(westldr);
Serial.println(topldr);
Serial.println(botldr);
}

After the Manual Rotating, the Program will process the automatically rotating
of the panel. In this part, at first the program checks the east-west orientation first. If
the values of east LDR and West LDR less than 400, the controller will write IN1
HIGH and wait for the delay and after that digitally Write IN1, LOW. While on-off
switch (switch 1) is HIGH and single-dual switch (switch 2) is LOW which means the
Auto mode is on and the single mode is on. So, the analog values of the East, West,
Top and Down LDRs are read.

//automatically rotating of the panel


//check east-west orientation first
/* if (eastldr < 400 && westldr < 400)
{digitalWrite(IN1,HIGH)
delay(7500)
digitalWrite(IN1,LOW)}*/
onoffswitch = digitalRead(switch1Pin);
singledualswitch = digitalRead(switch2Pin);
while (onoffswitch == HIGH && singledualswitch == LOW ){
eastldr = analogRead(A0);
westldr = analogRead(A1);
topldr = analogRead(A2);
botldr = analogRead(A3);
And to calculate the error, subtract the average values of West and Down LDR
from the average values of East and Top LDR. Then take the values of position error
as absolute value of error. If the absolute value of error is greater than 10, check
again if the error is greater than 0. If it happens that means the sun in the West
position of the tracker, write the IN2 High digitally. If the error is lesser than 0 that
means, the sun in the east position of the system, so the controller write IN1 HIGH.

error = (((eastldr+topldr)/2) - ((westldr+botldr)/2));


27

poserror = abs(error);
if (poserror > 10){
if (error > 0) {
digitalWrite(IN2, HIGH);

// Serial.print("IN2 HIGH");
}
else if (error < 0) {
digitalWrite(IN1, HIGH);
//Serial.print("IN1 HIGH");
}}
And another condition, The error is less or equal to 10, that means the sun
light is fall on the panel in right position. So, the controller write IN1 and IN2 LOW
to make the driver to stop the rotation.

else if (poserror <= 10 ) {


digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
//Serial.print("LOW BOTH");
}

Serial.println(eastldr);
Serial.println(westldr);
Serial.println(topldr);
Serial.println(botldr);

And Read the on-off Switch Pin and single-dual Switch again.

onoffswitch = digitalRead(switch1Pin);
singledualswitch = digitalRead(switch2Pin);}
onoffswitch = digitalRead(switch1Pin);
singledualswitch = digitalRead(switch2Pin);
28

While the on-off Switch is HIGH and single-dual switch is HIGH, read the Analog
values of four LDRs again.

while (onoffswitch == HIGH & singledualswitch == HIGH ){


topldr = analogRead(A2);
botldr = analogRead(A3);
eastldr = analogRead(A0);
westldr = analogRead(A1);

And then Top-Down error is calculated by subtracting average value of Down


and East LDRs from average value of Top and West LDRs. And the set the Top-
Down error to absolute value. And then calculate the East-West error value by
subtracting average value of West and Down LDRs from the average values of East
and Top LDRs. After that, this error value is set to the absolute value. If the absolute
value of East-West error is greater than 10, check again East-West error value is
greater than 0 which means the sun in the west position and if this error value is less
than 0, the sun the in the East position. So if this error values is less than 0, write IN1
HIGH to turn the motor to East direction. If not, write IN2 HIGH to turn the motor to
West.

tberror = (((topldr+westldr)/2) - ((botldr+eastldr)/2));


tbposerror = abs(tberror);

error = (((eastldr+topldr)/2) - ((westldr+botldr)/2));


poserror = abs(error);
if (poserror > 10){
if (error > 0) {
digitalWrite(IN2, HIGH);

// Serial.print("IN2 HIGH");
}
else if (error < 0) {
digitalWrite(IN1, HIGH);
29

//Serial.print("IN1 HIGH");
}}
else if (poserror <= 10 ) {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
}

Serial.println(eastldr);
Serial.println(westldr);
After that, Top-Down error value is set to the absolute value. If the absolute value of
Top-Down error is greater than 10, check again Top-Down error value is greater than
0 which means the sun on the top of the panel and then write IN4 HIGH to turn motor
to the top. if this error value is less than 0, the sun the in the Down position. So if this
error values is less than 0, write IN3 HIGH to turn the motor Down.

if (tbposerror > 10)


{ if (tberror > 0) {
digitalWrite(IN4, HIGH);

} else if (tberror < 0) {


digitalWrite(IN3, HIGH);

}
}
else if (poserror <= 10 ) {
digitalWrite(IN4, LOW);
digitalWrite(IN3, LOW);
}
Then read the switch values again and wait for the moment to start the program again.

onoffswitch = digitalRead(switch1Pin);
singledualswitch = digitalRead(switch2Pin);}
onoffswitch = digitalRead(switch1Pin);
30

singledualswitch = digitalRead(switch2Pin);
delay(200);
}

3.5 Conclusion
In this chapter, the flowchart, schematic diagram and block diagram of the
system are included. The block diagram is showing the rough idea of this system. The
flowchart will show how this system works inside and Schematic diagram is the
circuit diagram with real components so that it is easy to realize the shape of the
components.
And the last is about the Arduino Program with explanation about how received
signal are calculated and send responds to the motors to make the system right all the
time.

You might also like