2. Fig. 1. PID block diagram.
Here, u(t) define as control signal and KP , KI, KD are
proportional gain, integral gain, and derivative gain respec-
tively. Error signal define as a comparison between set point
or reference input and sensor reading which calculated by:
e(t) = r(t) − y(t) (2)
In equation (2), r(t) represent the reference signal or input
signal given to the system and y(t) represent the respone signal
or output signal of the system. In our sun tracker the inputs
are three LDR sensors and the outputs are two servos which
track the sun position.
The PID gains are tuning with Ziegler-Nichols method. The
transfer function of the PID controller with parallel structure
like the block diagram above is given by:
GP ID = KP +
KI
s
+ KD(s) (3)
These parameters can be used simultaneously or individu-
ally as needed to plant. The three PID parameters have their
respective functions:
• P reduce steady-state errors and improve transient re-
sponse.
• I use to eliminate steady-state errors.
• D provide a damping effect on the system and improve
the transient response.
These parameters can be tuned to provide a response result
according to the system because the PID controller relies on
measurable process variables.
B. Fuzzy Logic
Fuzzy is a logic that implies a value between 0 to 1. The
fundamental difference between digital logic and fuzzy logic
is that digital logic only gives a value of 0 or 1, whereas Fuzzy
logic can give a value between 0 and 1. Determine Fuzzy logic
value is as follows.
1) Fuzzy Set: The Fuzzy set is a range of values, of which
the value has a membership level of 0 to 1. The set
of Fuzzy à in the U universe is expressed by the
membership function
2) Membership Function: The membership function is a
curve that shows the mapping of data input points
into membership values (membership degrees) that have
intervals between 0 and 1. There are several functions
that can be used:
• Linear Representation Up
• Linear Representation Down
• Representation of the Triangle Curve
• Representation of the Trapezoidal Curve
3) Mamdani Method: The Mamdani method applies ac-
cording to linguistic rules. Fuzzy Inference System
The Mamdani method is also known as the Max-Min
method. To get the output, necessary steps as follows:
• Formation of the fuzzy set: Specifies all the related
variables in the process to be determined. For each
input variable, specify an appropriate fuzzification
function.
• Application function implications: Arrange the rule
base, the rules of Fuzzy implication which states
the relationship between input variables and output
variables.
• Rule composition: If the system consists of several
rules, then the inference is derived from the col-
lection and correlation between rules. The methods
used in conducting Fuzzy system inference are Max
Method (Maximum) and Additive Method (Sum).
• Defuzzification: The input of the assertion process
(defuzzification) is a Fuzzy set obtained from the
composition of Fuzzy rules, while the resulting
output is a strict real number.
III. SIMULATION AND EXPERIMENT
A. Experiment Procedure
In this research, the subject is the control system algorithm
used for the movement of the sun tracker. While the object of
this research is the output variable (y) that is the direction
of solar module and input variable (x) is the intensity of
sunlight (x1) and the position of the driving force (x2). The
experimental setup illustrated in Figure 5. This research is run
with 3 stages: first phase sensor design, construction tracking,
the second phase of prototype and programming, and the third
phase is testing and implementation. This research requires
tools and materials used as a component of sun tracker. The
tools and materials used are as follow:
• Atmega 328 microcontroller
• Mechanical systems for dual-axis mechanism
• Servo mini
• Solar cell
• LDR sensor
• Mechanical based on tetrahedron geometry
• Data logger
B. Control System
We build two sun trackers with the same control system
setup but use two different control programming algorithms,
PID controller and fuzzy logic controller. This is done to
compare the values of the two methods in tracking sun
movement. The more accurate tracking will produce more
41
3. Fig. 2. Tetrahedron-based sensor for sun tracker (1-3: LDR sensor; 4 & 5:
servo axes; 6: control box) [8].
electric energy gained by solar panel. The steps to determine
the results of these two methods can be seen in Figure 3.
Figure 3 shows the steps for determining the PID and Fuzzy
logic methods on the sun tracker. The difference between
the PID method and the Fuzzy logic used is in the process
section. PID programming is done in Arduino application
using Arduino PID library, Fuzzy logic method Fuzzy value
determination process using Fuzzy Inference System (FIS) in
Matlab application. The Matlab extension file is then converted
into a c-type programming language that can be processed
using the Arduino software.
C. Controller Design
The sun tracker system using the PID algorithm method
is computed automatically by Arduino microprocessors by
following the following mathematical equations.
u(t) = KP e(t) + KI
Z t
0
e(t) + KD
d e(t)
dt
(4)
The equations are implemented into Arduino microproces-
sors using PID library. The appropriate duty cycle will be com-
puted automatically by the microprocessor to minimize errors.
The PID control applied to the sensor has a dynamic setpoint
because it refers to LDR1 which also changes alongwith the
sensor movement and change of light intensity.
For the fuzzy logic controller, determining the membership
values is done by entering those values into the FIS (Fuzzy
Inference System) function in Matlab. Modeling is done on
FIS Matlab aims to get the results of the fuzzification process
so that Fuzzy logic value can be converted into Arduino
programming language. The fuzzy controller design is shown
in 4 which is done in Matlab environment.
Fig. 3. Experimental procedures.
Fig. 4. FIS designer.
42
4. Figure 4 shows a Fuzzy design consisting of three inputs
LDR0, LDR1, LDR2 and two outputs ServoX and ServoY. The
fuzzy method used is Mamdani method and defuzzification
process using centroid method.
IV. RESULTS AND DISCUSSION
A. Sun Tracker Prototypes
The making of prototype of sun tracker is to support the
results of research. The prototype of sun tracker of dua-axis
based on tetrahedron geometry can be seen in figure 5.
Fig. 5. Experimental setup.
Figure 5 shows two prototypes made with the same con-
struction and component on the prototype also having the same
type. Differences between the two prototypes are found in
the programming control algorithm of PID and Fuzzy logic.
It aims to compare the results obtained from two different
programming algorithms by looking at the amount of energy
produce by solar cell that attached to the sun tracker.
The PID controller implemented in the prototype using PID
library where KP = 0.01, KI = 4.456, KD = 0.001. For
fuzzy controller, we use three LDRs as input to the system.
The membership function of the input use NonRef function
range from -10 to 390 and Ref function range from 360-570.
The output of the system is the movement of servos. The
output membership function range from 00
to 3600
and have
two states that are move and stop.
B. Data Comparison
The results of the comparison programming algorithms
between PID and Fuzzy logic to the load generated by solar
cell are shown in figure 6. The red color graph is energy
produce by fuzzy logic controller while the blue color graph
is energy produce by PID controller.
Figure 6 shows the comparison between the PID control
algorithm and Fuzzy logic against the energy generated by
solar cell mounted on the sun tracker. It can be seen in Figure
6 that the Fuzzy logic method is relatively more stable and
produces a larger energy on the solar cell than the PID method.
Fig. 6. Load comparison in solar cell, red line ( ) with fuzzy logic controller
and blue line ( ) with PID controller.
The result of the comparison is sampled every one minute from
12.00 pm until 4.00 pm.
Also from figure 6 we see that PID controller oscilates more
than the fuzzy controller. This oscilation can decrease the solar
energy amount received by solar cell. That is why in general
fuzzy controller perform better than PID controller. The energy
received by solar cell when used fuzzy controller in average
570 Watt while PID controller received 550 Watt in 4 hours
of experimetal data acquisition.
TABLE I
SERVO RESPONSE AND SOLAR CELL LOAD
Time PID Load Fuzzy Load
X0 Y 0 X0 Y 0
12.00 53 63 578 55 75 567
12.20 55 73 532 57 79 555
12.40 53 76 534 57 82 552
13.00 54 76 486 56 86 567
13.20 55 78 528 57 89 573
13.40 55 82 554 57 91 584
14.00 54 84 511 55 92 584
14.20 55 85 505 57 93 579
14.40 54 90 522 58 95 575
15.00 55 95 547 58 95 591
15.20 56 103 524 57 98 588
15.40 56 101 487 58 97 579
16.00 54 93 496 58 95 577
Table I shows the response received by the servo based on
the change in input value. The X-axis servo response in both
PID and Fuzzy logic methods did not show any significant
change. While the servo axis-Y response there is a difference
between the PID method and Fuzzy logic. Servo Y axis Fuzzy
logic method underwent a smaller degree change compared to
the angular changes that occur on servo axis Y PID method.
This change also affects the stability of solar cell movement
and load. The servo change response in table I is sampled
every 20 minutes from 12:00 pm to 4:00 pm.
The value of each LDR mounted on these two prototypes
can be seen in Figure 7. Figure 7 shows that the three LDR
values which are placed on each side of tetrahedron sensor
in the Fuzzy logic prototype method have very little value
difference when compared to the value difference in the PID
43
5. Fig. 7. Sensor values of each LDR: PID control ; fuzzy controller
prototype method. This may be due to the movement of the
Sun tracker prototype of the frequently changing PID method
adjusting to the intensity of light received. The LDR sensor
values in fuzzy logic control method relatively have the same
values, this mean that the it is working well in tracking the
sunlight compare to PID control method. The value of all
LDRs attached to two sun tracker prototypes has achieved a
reference value of the intensity of sunlight. The LDR values
are sampled every 30 minutes from 12.00 pm until 4.00 pm.
V. CONCLUSION
The results of the comparison between two prototypes
obtained show that the fuzzy logic control algorithm is more
effective than PID in terms of maximizing the load on solar
panels. The solar energy received by solar cell in average 3.5%
or 20 Watt when using fuzzy controller.
The input of the three LDRs in each prototype can affect
the servo to determine the sun’s movement, and overall all
LDRs mounted on two sun tracker prototypes have achieved
a reference value of the intensity of sunlight.
ACKNOWLEDGMENT
The authors acknowledge the financial support of Syiah
Kuala University through professorship research grant for the
year of 2017. We would like to extend our gratitude to research
assistants at PUSMATIK (Research Center for Automation and
Robotics): Muhammad Ikhsan, M. Ilham, Ikhramuddin, dan
Darmawan.
REFERENCES
[1] T. Soe and N. Afifi, “Design of an online data logging syst em for hybrid
renewable energy system,” in The 2nd Joint International Conference on
“Sustainable Energy and Environment, 2006.
[2] M. Fuentes, M. Vivar, J. Burgos, J. Aguilera, and J. Vacas, “Design of
an accurate, low-cost autonomous data logger for pv system monitoring
using arduino™ that complies with iec standards,” Solar Energy Materials
and Solar Cells, vol. 130, pp. 529 – 543, 2014.
[3] A. Purwadi, Y. Haroen, F. Y. Ali, N. Heryana, D. Nurafiat, and A. Assegaf,
“Prototype development of a low cost data logger for pv based led street
lighting system,” in Proceedings of the 2011 International Conference on
Electrical Engineering and Informatics, pp. 1–5, July 2011.
[4] E. Kiyak and G. Gol, “A comparison of fuzzy logic and pid controller
for a single-axis solar tracking system,” Renewables: Wind, Water, and
Solar, vol. 3, p. 7, Feb 2016.
[5] S. Dasgupta, F. W. Suwandi, S. K. Sahoo, and S. K. Panda, “Dual
axis sun tracking system with pv cell as the sensor, utilizing hybrid
electrical characteristics of the cell to determine insolation,” in 2010 IEEE
International Conference on Sustainable Energy Technologies (ICSET),
pp. 1–5, Dec 2010.
[6] J.-M. Wang and C.-L. Lu, “Design and implementation of a sun tracker
with a dual-axis single motor for an optical sensor-based photovoltaic
system,” Sensors, vol. 13, no. 3, pp. 3157–3168, 2013.
[7] R. Antonio-Mendez, J. Alejo, and O. Peñaloza-Mejı́a, “Fuzzy logic
control on fpga for solar tracking system,” vol. 25, pp. 11–21, 08 2015.
[8] Y. Away and M. Ikhsan, “Dual-axis sun tracker sensor based on tetra-
hedron geometry,” Automation in Construction, vol. 73, pp. 175 – 183,
2017.
44