A Comparison of Fuzzy Logic and PID Controller For A Single-Axis Solar Tracking System
A Comparison of Fuzzy Logic and PID Controller For A Single-Axis Solar Tracking System
A Comparison of Fuzzy Logic and PID Controller For A Single-Axis Solar Tracking System
DOI 10.1186/s40807-016-0023-7
Abstract
Proportional integral derivative controllers are widely used in industrial processes because of their simplicity and
effectiveness for linear and nonlinear systems. The fuzzy controller is the most suitable for the human decision-mak-
ing mechanism, providing the operation of an electronic system with decisions of experts. In addition, using the fuzzy
controller for a nonlinear system allows for a reduction of uncertain effects in the system control. In this study, a pro-
portional integral derivative controller and a fuzzy logic controller are designed and compared for a single-axis solar
tracking system using an Atmel microcontroller. According to the angle of solar energy, a solar panel is oriented to
the side where light intensity is greatest by being designed for the related supervisory controllers. Thus, the aim is to
increase the energy obtained from solar panels by providing the specular reflection of the sun’s rays to a solar panel.
At the same time, a maximum efficient processing system has been determined by taking account of two controllers
for the designed system.
Keywords: Solar tracking system, Fuzzy controller, PID controller, Energy efficiency
© 2016 Kıyak and Gol. This article is distributed under the terms of the Creative Commons Attribution 4.0 International License
(http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium,
provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license,
and indicate if changes were made.
Kiyak and Gol Renewables (2016)3:7 Page 2 of 14
to panels using a variety of control techniques (Shugar So far Fuzzy logic control-based solar trackers of dif-
et al. 1996; Roth et al. 2004; Colak et al. 2005). According ferent configurations have been implemented on FPGA
to the study, applications on solar energy have increased and PIC microcontrollers, but the control logic for this
rapidly in recent years, and new materials and methods research was implemented on a simple microcontroller
are being developed for this energy source. board Arduino Uno (Hamed and Mohammed 2012;
In another study, a SCADA system is developed in Khaehintung et al. 2007).
order to allow for optimal sun tracking and real-time In the solution there is a dual-axis solar tracking sys-
control using a programmable logic controller (PLC) and tem, based on solar maps, which can predict the exact
step motor in a two degrees of freedom (DOF) tracking apparent position of the sun, by latitude location, thereby
system. In this study, power generation increases, com- avoiding the need to use sensors or guidance systems
pared to other PV systems, and non-tracking systems (Abdallah and Nijmeh 2004).
because real-time control and monitoring is provided In another study, a solar tracking algorithm is designed
(Figueiredo and Costa 2008). and implemented on a solar tracking experimental plat-
It can be seen that the tracking system is made very sta- form, using a tri-positional control strategy. It makes use
ble by the development of a microprocessor-based solar of measured values for radiation from appropriate sen-
tracking system. A microprocessor-based solar track- sors and assures command of the platform’s two posi-
ing controller was designed and manufactured in 1990, tioning motors. The implementation technique reduces
in New Delhi, India. The controller has several features the cost of the tracking method and makes it cost-effec-
which makes it versatile for tracking and system control/ tive technology (Arghira and Iliescu 2013).
monitoring applications (Saxena and Dutta 1990). A solar cooling system is important for improving of
Environmental conditions effect power production in energy efficiency. This study’s aim is to improve energy
solar energy, but our devices work on a constant volt- efficiency of a solar cooling system by an innovative com-
age. If light intensity and temperature do not change, a bination of optimized solar cooling, storage techniques,
maximum power point (MPP) will occur at a constant and an absorption chiller, with highly developed tech-
voltage. However, if the environmental conditions change niques for control using known tool; TRNSYS and MAT-
over time, the voltage in the MPP will also change. In LAB with Simulink (Visek et al. 2014).
this case, for better performance, a more complicated A single-axis sun tracking system with two sensors was
controller is required with parameter changes accord- designed. The data acquisition, control, and monitoring
ing to atmospheric conditional changes (Nopporn et al. of the mechanical movement of the photovoltaic module
2005). The output power of a solar panel depends on the were implemented based on a programmable logic-con-
amount of light on the panel (Li et al. 2005). The designed trolling unit (Al-Mohamad 2004).
Fuzzy logic controller technique can find peak power by In this study, the design and application for a single-
doing wide range of illumination and temperature varia- axis solar tracking system is developed based on both
tions (Ghassami et al. 2013). fuzzy logic and PID controller in a real system. The nec-
A fuzzy logic-based two-axis solar tracking system essary control circuits are designed. The control circuit
increases efficiency by 33.416 % compared to a non- is built on an Atmega 328 microcontroller and necessary
tracking system. In this study, a stepper motor is used software is installed into the control unit according to
for the direction control and an Arduino Uno is used for MATLAB simulations. In this study, it has been shown
the microcontroller. In addition, the proposed fuzzy logic that fuzzy controllers are more efficient than PID con-
controller has been implemented and tested using MAT- trollers in single-axis solar tracking system. This result is
LAB for this study (Bawa and Patil 2013). reached using real-time measurement data obtained in
Fuzzy logic is used in many engineering applications, the scope of the study.
because it is considered by designers to be the simplest
solution available for a specific problem, for instance, Solar tracking system
in household electrical appliances, auto electronics The purpose of the solar tracking system is to allow sun
applications, and industrial automation systems (Peri rays to reverberate to a solar panel with full angle in the
and Simon 2005). With complicated processes where solar system which has low efficiency and to generate
control is hard, it becomes necessary to use a fuzzy energy at full efficiency. Therefore, sun rays placed at dif-
logic controller (Takagi and Sugeno 1985). Fuzzy logic ferent points on the system are controlled using an inten-
controller is adaptive and nonlinear nature, which pro- sity sensor, and the solar panel is thereby moved toward
vides it robust enactment under load, supply voltage the point gathering most sun rays by a DC motor. The
disturbances, and parameter variation (Punithaa et al. materials used for the solar tracking application are as
2013). follows:
Kiyak and Gol Renewables (2016)3:7 Page 3 of 14
•• Atmega 328 microcontroller negative terminals of the battery are applied to a motor
•• DC motor intake interchange. Due the fact that motor direction
•• DC motor drive circuit cannot be changed during use, it is necessary to cre-
•• Solar panel ate driver circuits. There are numerous direct current
•• Mechanical systems for single-axis control motor driver circuits. However, in this study, direction
•• Feed circuit and speed control of the motor is performed using the
•• Sensors popular H-bridge method. The operating principles of
the H-bridge, as illustrated in Fig. 2, are based on the
Atmega 328 microcontroller change of logic signal which is applied to the base of the
An Atmega 328 on an Arduino UNO is a microcontroller, transistors used. As shown in the circuit, if the base ter-
with 14 digital input/output, and 6 analog inputs. Six of minals of 1 and 4 transistors are given logic 1, and the
the digital pins can be used for pulse width modulation base terminals of 2 and 3 transistors are given logic 0, the
(PWM). Input/output pins can provide up to a maximum motor rotates to the left. Therefore, a related truth table
40 mA of current. There are 32 GB flash memories for is drawn according to this principle.
storing written code, a 2 kB static random access mem- The H-bridge is made using BC237 transistors. How-
ory (SRAM) used for creating a work area, and a 1 kB ever, when this circuit is designed, it can be seen that the
erasable programmable read only memory (EEPROM) transistors overheat and that the motor cannot be con-
for users on the microcontroller. trolled properly. This circuit, designed in order to under-
Certain additional elements, such as an external crys- stand how driver circuits work, is not used for motor
tal and capacitors are necessary in order that the Atmega control in this study. In this study, as shown in Fig. 3,
328 microcontroller can be used as a control unit in the motor speed and the direction control circuit are
a circuit. A 16 MHz crystal, and a two 22 pF capacitor mounted on a pcb board.
for operation of the microcontroller are also required As can be seen from the circuit, there are two inputs to
(Fig. 1). enter the control signal coming from the microcontroller
to the driver circuit. According to Table 1, the motor
DC motor direction control can be performed by sending a logic
An electrical device which can direct current electric signal sent from this input.
energy and convert it to mechanical energy is called a DC motor speed control is performed using the PWM
DC motor. In this study, a low speed, high torque direct method. In this method, the voltage applied to the motor
current motor is used for moving the solar panels. The signal cable is a fixed frequency and square wave. That is,
motor used (titan motor) operates at a low speed of 5 rev- the speed of the motor is set by changing the pulse width
olutions per minute (rpm) and can produce 32 kg torque of logic 0 and 1 sent to the driver. Due to the fact that
per cm. It uses a low amount of current with 400 mA at the motor used in this study runs at a 600 Hz frequency,
maximum load capacity and 24 mA at idle. the period is 1666 µs. The speed of the motor is adjusted
depending on pulse width modulation. If the motor is
DC motor drive circuit desired to be rotated at full speed, a 255 value is sent to
DC motors are motors which start to rotate when pro- the motor with the help of the microcontroller using an
vided with energy from a battery directly. The motor analog Write (255) command. The 255 value is due to the
rotation direction changes when the positive and the 8-bit output ADC of the microcontroller. In Fig. 4, pulse
width modulation is seen according to a duty cycle.
Solar panel
A solar panel is an energy source containing many solar
cells enabling the absorption of solar energy. Solar cell/
photovoltaic cells convert solar energy into electri-
cal energy using the photovoltaic effect characteristic
of semiconductor devices. In this study, 1 solar panel of
15 V 20 W capacity is used.
Feed circuit
Two different voltage levels were required for this
study. 5 V is required for the control circuit and 12 V is
Fig. 1 Atmega 328 circuit connection diagram required for the motor drive circuit. Voltage from the
Kiyak and Gol Renewables (2016)3:7 Page 4 of 14
Table 1 Driver circuit truth table solar panel is not applied to the circuits directly, and the
Input 1 Input 2 Motor direction
battery is charged by the battery charging circuit. The
charging circuit arranged for a 12 V battery is shown in
ON OFF Right Fig. 5.
OFF ON Left The 5 V required for the control unit was made by
OFF OFF Stop designing a buck converter circuit. A buck converter is
ON ON Un-solicited status a voltage step-down and current step-up converter. The
converter circuit was made using an integrated lm517 as
shown in Fig. 6.
Sensors
Sensors are used to interconnect the electronic circuits
in a physical environment and are referred to as sense
organs of the control systems. There are many sensors
used for measuring different values, such as pressure,
temperature, humidity, and sun intensity. The values
are generally measured in terms of voltage by changing
the resistance on the sensor. Therefore, measurements
are made by taking into consideration the relationship
between resistance and voltage.
In this study, two photo resistances placed in an east–
west direction on the solar tracking systems measuring
sun intensity are used. A photo resistance sensor or light-
dependent sensor (LDR) is a sensor which changes resist-
ance depending on light and is inversely proportional.
The voltage values measured from the sensor output
located on the east and west parts of the solar panel are
compared. Accordingly, the panel is moved in an east–
west direction. Thus, the panel is moved into a position
receiving the sun rays perpendicularly providing that the
Fig. 4 DC motor speed control values measured from the sensors are within the toler-
ance value range.
are adjusted accordingly. Critical gain KC and oscillation evolution with reasoned logic in an atmosphere of uncer-
period P0 are used to set the gains as shown: tainty. This control system, which is suitable for many
dynamic systems that cannot be modeled in the world,
2KP KP P0
KP = 0.6KC , KI = , KD = (2) provides an opportunity to view all the states of a system
P0 8 by dealing with, not only 0 and 1, but also all intermedi-
These steps which written software code embedded ate values contrary to the classical logic of Aristotle.
into microcontroller. One-axis solar tracking system generally uses two sen-
The transfer function of PID control is given by: sors. LDR sensors measuring light density are placed on
solar tracking system by indicating in east and west. The
KI
GPID (s) = KP + + KD (s) (3) main idea is to read the value from LDR1 and compare it
s with the value of light density from LDR2. Then, depend-
The term ‘fuzzy logic’ was introduced with the 1965 ing on the difference between the two values, the control-
proposal of fuzzy set theory by Lotfi A. Zadeh. It is lers will decide and send commands to the motor and
expressed as a mathematical order which is established change its angle in order to make the difference equal the
for the expression of uncertainties and for working with tolerance value (LDR1 − LDR2 = tolerance). The toler-
uncertainties (Calvo and Cartwright 1998). The word ance value is determined according to the sensitivity of
‘fuzzy’ is defined as indefinite, complicated, and imper- sensor. Thanks to this it provides that solar rays reflect
ceptible. As is evident from its name, in this control sys- to solar panels perpendicularly. Control algorithm of the
tem, it is intended to obtain approximate values through solar tracking system is shown in Fig. 8.
In this study, the maximum revolution of motor used difference between systems remaining at a constant angle
is 4 rpm. Response of the controllers is shown in Fig. 9 and systems with changing angle constantly is shown in
according to 4 rpm input signal. Fig. 11.
A simplified block diagram representation of the solar The flowchart in Fig. 12 explains the algorithm used for
tracking system is shown in Fig. 10. fuzzy-based control of the solar tracking system. Block
Here, u(t) is the control signal, y(t) is the output signal, diagram of the fuzzy controller is shown in Fig. 13.
r(t) is the reference signal, and e(t) is the error signal in In this study, the solar tracking system is controlled
block diagram. According to block diagram, PID output using fuzzy logic. Data obtained from two different photo
u(t) is calculated as Eqs. 4 and 5. resistance sensors on the system are applied to the con-
trol system as input. Applied inputs are fuzzificated by
de(t)
u(t) = KP e(t) + KI ∫ e(t)dt + KD (4) entering in a fuzzification unit that is the first unit of
dt the fuzzy control. In other words, a membership value is
assigned to each item of data, and is transformed into a
e(t) = r(t) − y(t) (5) linguistic structure and then sent to the rule processing
Results and discussion unit. Data obtained from the rule processing unit are gov-
Voltage and current data of the solar tracking system erned by rules which can be modeled in accordance with
using a PID controller, are monitored in real time. The rule processing information, like ‘if……and……then….
Input membership set values are obtained by con- direction of the DC motor. Values represent the PWM
verting solar intensity data between 0–962 from the duty cycle rate.
photo-resistor sensors to the 0–240 value linearly. The Data received from the first and second photo resist-
photo-resistor sensors are tested in daylight, and set ance sensor are applied to the input. The duty cycle
bound values are obtained from the results of these tests. and direction control of the PWM signal of the DC
For example, NB set limits are chosen between 0 and motor which controls speed and direction as output are
80 (0–341) because the photo-resistor sensor receives adjusted. Values beginning with N allow the motor to
maximum sunlight between these values. The maximum rotate counter clockwise, while values beginning with
240 (LDR analog value = 962) is the value read from the P allow the motor to rotate clockwise. The duty cycle is
photo-resistor sensor at sunset. adjusted by selecting appropriate membership values in
Output membership set values are determined as order that the motor rotates fast and slowly. There is a
positive and negative in order to adjust the rotational rule table of the system in Table 2.
Kiyak and Gol Renewables (2016)3:7 Page 10 of 14
NB Z PK PB PB PB
NK NK Z PK PB PB
Z NB NK Z PB PB
PK NB NB NK Z PK
PB NB NB NB NK Z
Table 4 Voltage, current, and power values of the fuzzy logic-based and PID-based solar tracking system
Time Fuzzy logic controller PID controller
V (V) I (A) P (W) V (V) I (A) P (W)
It is planned to apply the solar tracking system in two Ahmad, A. M., Ayman, A. A., & Farhan, A. S. (2013). Mechatronics design of
a mobile robot system. International Journal of Intelligent Systems and
axes. An interface will be designed considering real-time Applications, 5(3), 23–36.
data transmission and the system will be continuously Akkaya, A. V., Akkaya, E., & Dağdaş, A. (2002). Yenilenebilir Enerji Kaynaklarının
monitored. Additional sensors are added to the available Çevresel Açıdan Değerlendirilmesi. IV. Ulusal Temiz Enerji Sempozyumu,
Cilt 1, Su Vakfı Yayınları, İstanbul.
sensor, as an input to the fuzzy logic control system, with Al-Mohamad, A. (2004). Efficiency improvements of photo-voltaic panels using
sensitivity being optimized. a sun-tracking system. Applied Energy, 79, 345–354.
Arghira, N, & Iliescu, S. S. (2013). Design and implementation of a solar-tracking
Authors’ contributions algorithm. In Proceedings of the 24th DAAAM international symposium on
EK participated in the design of the study and performed the PID controller intelligent manufacturing and automation.
and fuzzy controller for a single-axis solar tracking system. GG conceived of Bawa, D., & Patil, C. Y. (2013). Fuzzy control based solar tracker using Arduino
the study, and participated in its design and coordination and helped to draft Uno. International Journal of Engineering and Innovative Technology, 2(12),
the manuscript. All authors read and approved the final manuscript. 179–187.
Calvo, O., & Cartwright, J. (1998). Fuzzy control of chaos. International Journal of
Bifurcation and Chaos, 8(8), 1743–1747.
Competing interests Colak, İ., Bayındır, R., Sefa, İ., Demirbaş, Ş., & Demirtaş, M. (2005). Güneş Takip
The author declare that they have no competing interests. Sistemi Tasarım ve Uygulaması. 1. Enerji Verimliliği ve Kalite Sempozyumu,
TMMOB Elektrik Mühendisleri Odası Kocaeli Şubesi (pp. 301–305).
Received: 16 October 2015 Accepted: 19 January 2016 Figueiredo, J. M. G., & Costa, J. M. G. S., (2008). Intelligent sun-tracking system
for efficiency maximization of photovoltaic energy production. In
ICREPQ’08—international conference on renewable energies and power
quality symposium, Santander.
Ghassami, A. A., Sadeghzadeh, S. M., & Soleimani, A. (2013). A high perfor-
mance maximum power point tracker for PV. Journal of Electrical Engineer-
References ing, Electrical Power and Energy Systems, 53, 237–243.
Abdallah, S., & Nijmeh, S. (2004). Two axes sun tracking system with PLC con- Green, M. A., Emery, K., King, D. L., & Igari, S. (2000). Solar cell efficiency tables.
trol. Energy Conversion and Management, 45, 1931–1939. Progress in Photovoltaics: Research and Applications, 8, 187–196.
Kiyak and Gol Renewables (2016)3:7 Page 14 of 14
Hamed, B., & Mohammed, S. E., (2012). Fuzzy controller design using FPGA for Punithaa, K., Devaraj, D., & Sakthivel, S. (2013). Development and analysis
photovoltaic maximum power point tracking. International Journal of of adaptive fuzzy controllers for photovoltaic system under varying
Advanced Research in Artificial Intelligence, 1(3), 14–21. atmospheric and partial shading condition. Applied Soft Computing, 13,
Irina, T., & Cătălin, A. (2010). A study on the tracking mechanisms of the pho- 4320–4332.
tovoltaic modules. Fascicle of Management and Technological Engineering, Roth, P., Georgiev, A., & Boudinov, H. (2004). Design and construction of a
IX, 59–66. system for sun-tracking. Renewable Energy, 29, 393–402.
Khaehintung, N., Pramotung, K., Tuvirat, B., & Sirisuk, P. (2007). Application of Saxena, A. K., & Dutta, V. (1990). A versatile microprocessor based controller for
maximum power point tracker with self-organizing fuzzy logic controller solar tracking. In 21 IEEE photovoltaic specialists conference, Kissimmee.
for solar-powered traffic lights. In Power electronics and drive systems, Shugar, D. S., Hickman, T., & Lepley, T. (1996). Commercialization of a value-
PEDS’07 Conference (pp. 642–646). engineered photovoltaic tracking system. In 25th IEEE PVSC proceedings
Li, D. H. W., Cheung, G. H. W., & Lam, J. C. (2005). Analysis of the operational per- (pp. 1537–1540).
formance and efficiency characteristic for photovoltaic system in Hong Takagi, T., & Sugeno, M. (1985). Fuzzy identification of systems and its applica-
Kong. Energy Conversion and Management, 46, 1107–1118. tions to modelling and control. IEEE Transactions on Systems, Man and
Nopporn, P., Premrudeepreechacharn, S., & Sriuthaisiriwong, Y. (2005). Maxi- Cybernetics, 15(1), 116–332.
mum power point tracking using adaptive fuzzy logic control for grid- Visek, E., Mazzrella, L., & Motta, M. (2014). Performance analysis of a solar cool-
connected photovoltaic system. Renewable Energy, 30(11), 1771–1788. ing system using self-tuning fuzz-PID control with TRNSYS. In 2013 ISES
Ozerdem, O. C., & Zhahin, A. (2014). A PV solar tracking system controlled by solar world congress energy procedia (Vol. 57, pp. 2609–2618).
Arduino/Matlab/Sımulink. International Journal on Technical and Physical
Problems of Engineering, 6(4), 23–36.
Peri, V. M., & Simon, D. (2005). Fuzzy logic control for an autonomous robot. In
Fuzzy Information Processing Society, 2005. NAFIPS 2005. Annual Meeting of
the North American, IEEE, 26-28 June 2005.