PID Based Air Heater Controller Implemented With Matlab Simulink and Arduino Uno
PID Based Air Heater Controller Implemented With Matlab Simulink and Arduino Uno
Abstract— The lack of demonstration tools for supporting utilized as main controller to perform PID based controller
laboratory course in the computer based control system algorithms implemented in C language programming using a
laboratory Politeknik Negeri Semarang made students more free Arduino Editor. In this research, Arduino Uno is used as
difficult in understanding the basic concept of the control a simple data acquisition system board which is fully
system. To alleviate this difficulty, a demonstration tool of commanded by Matlab/Simulink program.
Proportional Integral Derivative (PID) based air heater
controller was built using Matlab/Simulink as its controller Air heater can be considered as a simple first order plant
software and Arduino UNO as its data acquisition syatem. The in which students can have a good start in doing their
selection of initial PID parameters is based on the combination practically preliminary controller experiments. The use of air
of Relay Feedback method and Ziegler-Nichols formula. The heater can be often seen in everyday life’s appliances, such as
performance criteria of the P, PD and PID controllers are hair dryer, room air heater, elctric oven, microwave and hand
based on: Rise Time, Settling Time, Overshoot and Steady dryer. In industrial applications, air heater can be found in
State Error, within the temperature of 50ºC, 60ºC and 70ºC. Heating Ventilation and Air conditioning (HVAC) [4], [5],
The best controller method is then selected based on its best [6], while in laboratory demonstartion tools, hair dryer are
performance criteria. The results showed that all controllers often used as air heater plant [7], [8]. To perform more
have adequate performance criteria, but the PID controller complex controller application using air heater element, a
becomes the best controller with its maximum steady state microntroller system is mostly required.
errors of about 0.2ºC, responsive and no overshoot. The
availability of this demonstration tool hopefully can help Arduino Uno is a cheaply popular microcontroller board
students in understanding the concept of PID based controllers with good controller performance, especially for less
easily, especially when implemented using Matlab/Simulink complicated applications. The core of Arduino Uno is based
and Arduino Uno for real air heater controller applications. on ATMega328, as shown in Fig. 1. Arduino Uno provides
configurable 14 digital input/output pins, in which 6 pins
Keywords—air heater, PID, Relay Feedback, Ziegler Nichols, configurable for pulse width modulation (PWM) outputs and
Matlab/Simulink, Arduino Uno other 6 pins configurable for analog inputs. Computer loaded
with Matlab/Simulink program is connected serially to
I. INTRODUCTION Arduino Uno via USB port for program upload and data
Research findings on educational demontration tools have transfer [9]. Some applications involving Arduino
shown that the use of demontration tools or other interactive temperature controllers either for demonstration or simulation
methods either in class room or laboratory becomes more tools can be found in [10]-[13] for long distance educational
effective way of helping students in increasing their abilities experiments in the field of control system, heat control
of understanding the subject course delivered by lecturers system using thermostat, automatic room cooler and heater
compared to that of without the use of the tools [1]. The use simulator and heat controller for laboratory scale boiler tank,
of demonstration tools, especially in control system respectively.
laboratory, can be used to introduce the system modelling
concept, controller applications in real world and to PID controller is a conventional controller which is now
demonstrate or to validate the analitycal concepts involving still popular and applied in most industrial applications,
instrumentation tools and measurements [2]. despite the development of modern control system which
rigorously used of algorithms either theoretical or technology
Due to the important role of using the demonstration tools in control systems. Honeywell survey on 11.600 controller
in increasing the student’s practical skill in the computer applications used in 18 industries, found that more than 97%
based control system laboratory Politeknik Negeri Semarang, of practical control applications employed PID control
a demonstration tool of PID based air heater controller has algorithms [14]. PID controller has a simple structure, robust
been designed and developed using Arduino Uno performance and becomes a fundamental controller for today
microcontroller as its data acquisition system board and modern control algorithms [15]. It also has simple control
Matlab/Simulink as a software for implementing the rules and less parameter adjustments [16] and robust in
controller tasks based on PID method. This air heater obtaining its suitable PID parameters [17]. Basic structure of
demonstartion tool differs with the air heater controller found PID controller can be seen in Fig. 2.
in [3] in terms of the use of Arduino Uno itself which is fully
3. Arduino Uno
Fig. 2. PID structure Arduino Uno is a microcontroller used as a data
acquisition system to read the actual air temperature
from the LM35 temperature sensor and to send the
Time domain PID controller is represented in (1), where:
respective data to Matlab/Simulink based controller
r(t) reference / set point, u(t) manipulated variable, e(t) error,
y(t) output, Kp proportional gain, Ki integral gain and Kd program in Computer. In addition, Arduino Uno
derivative gain. Some PID applications using Arduino based receives the controller command from the
temperature controls can be found in baby incubator [18], Matlab/Simulink program, converts this command into
laboratory experiment for automatic control and robotics its respective PWM analog signal and finally sends this
[19], heater control system [20], automatic bird egg incubator signal to Analog PWM Pin (pin3). This PWM signal
[21] and temperature control simulator [22]. from Pin3 is filetered using a low pass RC filter to
produce a smooth dc voltage which is fed to the analog
𝑑𝑒 input of the voltage to phase angle converter unit.
𝑢 𝑡 = 𝐾𝑝 . 𝑒 𝑡 + 𝐾𝑖 𝑒 𝑡 . 𝑑𝑡 + 𝐾𝑑 (1)
𝑑𝑡
In this research, the air heater controller has temperature 4. Voltage to Phase Angle Converter.
range of 50ºC to 70ºC and the selected controllers are focused This Voltage to Phase Angle Trigger Converter is used
on P, PD and PID. The selection of initial PID parameters to convert the input voltage in the range of 0V to 5V
are derived from combination of Relay Feedback Method and from the filtered PWM output to phase trigger angle of
Ziegler-Nichols formula [23]. Performance criteria of the ( 0 – 180º). This converter output is then set the trigger
selected controllers are compared and analyzed based on Rise at its respective phase angle to activate the heater
Time, Settling Time, Overshoot and Steady State Error. driver for regulating the heat level of the heater.
PID is a classical control method that becomes a
fundamental control method massively used in most 5. Heater Driver
industrial applications; therefore it is very important to The heater driver is used to activate the electric heater
deliver this PID topic in undergraduate control system according to its respective phase angle trigger. The
course. The availability of this demonstration tool hopefully heater will fully on if the trigger is set at the phase
can encourage students in gaining their understanding about angle of 0º, and inversely fully off if the trigger is set at
the concept of PID based controllers, especially when the phase angle of 180º. To obtain the desired air
applied in real application of air heater controller temperature, the phase angle trigger is regulated
implemented using Matlab/Simulink and Arduino Uno. between 0 º and 180 º.
6. Air Heater
II. RESEARCH MATERIALS AND METHOD The air heater system is based on a hair-dryer which
consists of a heater element and a blower fan. During
A. Research Materials operation, the fan blows the heater element at a
Research materials for this research consists of constant speed. When the heater is turned on, the fan
temperature sensor, signal conditioning system, Arduino blows the heater to produce hot air, but when the heater
Uno, voltage to phase angle converter, heater driver and is turned off, the fan blows to cool the heater, hence
computer. The bock diagram of this air heater controller can reducing the air temperature.
be seen in Fig. 3. Each part of the research materials can be
described as follows: 7. Computer
1. Temperature Sensor Computer is used as a main controller which is
The temperature sensor utilizes an IC LM35 having programmed using Matlab/Simulink to perform PID
linear output specification of 10mV/ ºC for the base controllers. Set point change is also performed
within Matlab/Simulink program. The controller
29
Authorized licensed use limited to: Indian Institute of Technology (Ropar). Downloaded on April 16,2025 at 05:14:13 UTC from IEEE Xplore. Restrictions apply.
program requires the present value of the the heated air (x) Comparing the performance criteria for each
temperature. It can be done using the help of Arduino controller. Based on these comparisons, the best
Uno which communicates intensively with the controller was selected.
controller program in computer via USB serial port.
The present temperature of the heated air is sensed by In this research, initial PID parameters are obtained from
temperature sensor. Output voltage from this sensor is combination of Relay Feedback method and Ziegler-Nichols
then amplified 5 times using the signal conditioning formula [23]. The critical gain parameter (Kc) of the PID
system. Output of this signal conditioning system is controller can be calculated using (2), while the proportional
then read by Arduino Analog input (Pin A0). This gain (Kp), integral gain (Ki) and derivative gain (Kd) can be
voltage information which represents the current determined using the values of critical period (Tc), critical
temperature is then sent to the controller program in gain, (3) and (4) as well as Zieglers-Nichols formula given in
computer by Arduino Uno. In the Matlab/Simulink Table I.
controller program, the temperature set point is then Kc = 4h/πa (2)
compared with the current temperature. The error
between these two values is then processed by the Ki= Kp/Ti (3)
PID based controller part. The output of this controller
is sent to the analog output Pin3 of Arduino Uno in the Kd = Kp Td (4)
form of PWM signal. The PWM signal output is low
Where a is oscilation output, h relay output amplitude, Ti
pass filtered to give the smooth dc voltage output to
integral time and Td derivative time.
control the triggering part which regulates the
temperature of the air heater. In addition, this computer TABLE I. ZIEGLER N ICHOLS FORMULA FOR LOW O VERSHOOT
receives the experimental data from Arduino Uno
which then can be displayed as graphs for their related Controller Kp Ti Td
PID 0.33Kc 0.5Tc 0.33Tc
measured and processed parameters
Setpoint
a
Fig. 3. Block diagram of air heater controller
Output
B. Research Method
The overall research method will cover:
(i) Literature Reviews on air heater controller, PID (a)
based controllers using Matlab/Simulink and Arduino
or other microcontrollers.
(ii) Design of mechanical parts, electronic circuits,
Arduino program and Matlab/Simulink program.
h
(iii) Development of hardware and programming for
heater controller prototype.
(iv) Testing for electronic circuits involving temperature
sensor, signal conditioning system, voltage to phase Tc
angle converter and heater driver.
(b)
(v) Testing the program for Arduino Uno and Matlab
/Simulink for PID based controllers. Fig. 4. Relay Feedback Experiment (a) output oscilation (b) relay output
(vi) Testing the overall system to perform PID based
From Fig. 4 it can be obtained the values of a = 3.245, h
controllers.
=255 and Tc = 21.21. The relay feedback parameters can be
(vii) Data collections for PID based controllers. seen in Table II. By applying Ziegler-Nichols formula for
(viii) Determination of performance criteria based on: Rise low overshoot, the initial PID parameters can be calculated
Time, Settling Time, Overshoot and Steady State and presented in Table III. Next, these PID parameters are
Error. used for P, PD and PID controllers.
(ix) Analyzing the performance criteria for each
controller.
30
Authorized licensed use limited to: Indian Institute of Technology (Ropar). Downloaded on April 16,2025 at 05:14:13 UTC from IEEE Xplore. Restrictions apply.
TABLE II. RELAY FEEDBACK PARAMETERS controller for setpoint of 50ºC which produces about 0.5 ºC
SP [ᵒC] a h Tc higher that its stable final value of about 47.8ºC. These very
70 3.245 255 21.21 low overshoot results are in accordance with the selection of
low overshoot Ziegler Nichols’ formula for initial PID
TABLE III. INITIAL PID PARAMETERS parameters selection.
SP [ᵒC] Kp Kd Ki
70 33 231 3 TABLE IV. CONTROLLER PERFORMANCE FOR SP 50ºC
SP Rise Time Settling Time Steady State Error
50ºC (s) (s) (ºC)
B. PID based Controller P 22.5 57 -2.2
The PID based control system responses with the PD 29 63.7 -1.81
set points of 50ºC, 60ºC and 70ºC can be seen in Fig. 5,
PID 24.4 39 0.2
6 and 7, respectively. It is important to note that the
original value of integral gain (Ki = 3) is too big for this
TABLE V. CONTROLLER PERFORMANCE FOR SP 60ºC
application causing the system becomes unstable, so
SP Rise Time Settling Time Steady State Error
this value has been retuned experimentally to 0.15. 60ºC (s) (s) (ºC)
Therefore, the final PID parameters used in this P 36.2 43.1 -2.7
experiments are Kp = 33, Kd =231 and Ki =0.15,
repectively. PD 39.2 84 -2.51
PID 36 47.4 0.16
Fig. 5. Control responses for set point of 50ºC Based on the results given in Table IV, Table V and
Table VI, it can be seen that in terms of both rise time and
settling time performances, the P controllers seem to be the
fastest, regardless of their insufficiently overshoot and
steady state error performances, while the PD controllers are
the worst due to the D controller effect. In terms of steady
state error performance, the PID controllers can successfully
reach the set points and have the smallest steady state error
values ranging from 0.09 to 0.34, while both P and PD
controllers cannot reach the set points (represented with
negative numbers) and they have almost the same steady
state error values, ranging from -1.81 to -2.7, in which the
PD controllers have a bit smaller than that of the P
Fig. 6. Control responses for set point of 60ºC controllers. In addition, actually the PID controllers have
almost the same speed responses as that of the P controllers,
since they have a very small differences in their both rise
time and settling time performances, in which the PID
controllers has a little bit bigger values than that of the P
controllers.
For the set point of 50ºC, the output response of the P
controller has overshoot of about 0.5ºC with respect to its
steady state position, produces ripples of about +0.25 to -
0.25ºC with the average stable temperature of 47.8ºC and
stays below set point with its average steady state error of
about 2.2ºC. For the set point of 60ºC, the actual output of
Fig. 7. Control responses for set point of 70ºC the P controller fluctuates about +0.83 to -0.83ºC at average
stable temperature of 57.3ºC, with steady state error average
From the experimental results, the values of Rise Time, of about 2.7ºC below set point. For the set point of 70ºC, the
Settling Time and Steady State Error of PID controllers for actual output of the P controller fluctuates around +0.93 to -
setpoints of 50ºC, 60ºC and 70ºC can be seen in Table IV, 0.93ºC at average stable temperature of 67.4ºC, with steady
Table V and Table VI, respectively. In these experiments, state error average of about 2.6ºC below set point.
there are mostly no overshoots produced, except for P
31
Authorized licensed use limited to: Indian Institute of Technology (Ropar). Downloaded on April 16,2025 at 05:14:13 UTC from IEEE Xplore. Restrictions apply.
The PD controllers have better output reponses than the [10] J.M. Neto, C.S. Silva , A.D. Spacek, and O.H.A. Junior, ―Remote
Educational Experiment Applied To the Discipline of Control
P controllers in terms of less overshoots and ripples which
Systems,‖ ICBL2013 – International Conference on Interactive
are almost zero. But, the PD controllers still have non zero Computer aided Blended Learning, pp. 369-374, 2013.
steady state errors namely about 1.81ºC, 2.51ºC and 2.45ºC [11] P. Aradi, ―Offline and online thermostat experiment with LabVIEW
below their setpoints for the set point of 50ºC, 60ºC and and Arduino,‖ International Symposium on Small-scale Intelligent
Manufacturing Systems (SIMS), pp. 1-6. Narvik, Norway, 2016.
70ºC, respectively. The PID controllers have the best output
[12] S.S. Malipatil, ―Simulation of automatic air conditioning and heating
responses in terms of very small steady state errors of about control with RF Arduino-melody by using LM35 temperature sensor
0.2ºC, 0.16ºC and 0.09ºC above their set points for the set in Proteus software,‖ International Journal of Emerging Research in
points of 50ºC, 60ºC and 70ºC, respectively. Management and Technology, vol.5, no.5,pp.1-6, 2016.
[13] P.A. Shirke, U. Thorkar, K.B. Kshirsagar, S.G. Pusdekar, and R.J.
Welukar, ―Monitoring and controlling of different process
parameters by using LabVIEW and Arduino,‖ International Journal
IV. CONCLUSION of Advance Research, Ideas and Innovation in Technology, vol.3,
PID based air heater controller has been successfully no.3, pp.1617-1622, 2017.
[14] L. Desborough, R. Miller, and P. Nordh, Regulatory Control Survey.
designed and built using Matlab/Simulink and Arduino Uno
Unpublished Manuscript, Honeywell, 2000.
as well as tested. Experimental results showed that during [15] X. Jianghua and S. Huihe, ―A novel method of PID tuning for
transient stage, the ouputs of all controllers did not go over integrating processes,‖ Proceedings 42nd IEEE Conference on
the set point, hence they have no overshoots. In terms of Decision and Control, p. 139-142, 2003.
[16] G. M. V. D. Zalm, ―Tuning of PID-type controllers: Literature
steady state error performance criteria, the PID controllers overview‖ DCT-report, 2004.
give the best output responses and the P controllers are the [17] Valério, D. and Costa, J.S.D. ―Ziegler-Nichols type tuning rules for
worst, since the output responses of the P controllers fractional PID controllers,‖ Proceedings of ASME 2005 Design
produced the biggest steady state errors. The selection of the Engineering Technical Conferences and Computers and Information
in Engineering Conference, pp. 1-6, Long Beach, USA, 2005.
initial PID parameters based on combination of Relay [18] A.K.Theopaga, A. Rizal, and E. Susanto, ―Design and
Feedback method and Ziegler-Nichols formula are very Implementation of PID Control Based Baby Incubator,‖ Journal of
acceptable for this laboratory scaled air heater controller Theoretical & Applied Information Technology, vol. 70, no.1, pp.19-
applications especially for proportional and derivative gains. 24, 2014.
[19] F. A. Candelas, G. J. García, S. Puente, J.Pomares, C. A. Jara, J.
The integral gain is too big and needs to be reduced and Pérez, and F. Torres, ―Experiences on using Arduino for laboratory
retuned experimentally first. Overall, it has been prooven experiments of Automatic Control and Robotics,‖ IFAC-Papers On
that the student’s demonstration tool of the PID based air Line, vol. 48, no.29, pp.105-110, 2015.
heater controller can be a practicable tool used to suppert [20] A.Bayram, S. A. Moammed, and F. Kara, ―Design of Heating
System Controlled by Arduino,‖ Proceeding of the 4th International
experimental works conducted in the undergraduate control Symposium on Innovative Technologies in Engineering and Science
system laboratory course. (ISITES2016), pp. 1583-1591, Alanya/Antalya ,Turkey, 2016.
[21] G.E. Tchimmoue, J. Kamdem, M.E. Sone, and C.T. Tchapga,
―Development of a cost-effective ARDUINO based automatic BIRD-
REFERENCES EGG incubator. Sciences, Technologies et Développement, Edition
spéciale, vol.17, no.1, pp.54-58, 2016.
[1] R. Edwards,‖An in-class demonstration used as an introduction to the [22] H. M Asraf, K.A. N. Dalila , A.W. M. Hakim, and R.H.M. Faizzuan,
first law of thermodynamics for an open system,‖ ASEE ―Development of Experimental Simulator via Arduino-based PID
Illinois/Indiana Section Conference. Angola, Indiana, USA, 2013. Temperature Control System using LabVIEW,‖ Journal of
[2] R. Heradio, L. de la Torre, D. Galan, F.J. Cabrerizo, E.H., Viedma, Telecommunication, Electronic and Computer Engineering, vol. 9,
and S. Dormido, ―Virtual and remote labs in education,‖. Journal no.1, pp.53-57, 2017.
Computers and Educations, vol.98, no.1, pp.14-38, 2016. [23] K.J. Åström and T. Hägglund, ‖Automatic Tuning of Simple
[3] B. Supriyo, S.B. Kuntardjo, and Sihono,‖A demonstration tool of Regulators with Specifications on Phase and Amplitude Margins‖,
Arduino based air heater control to support control laboratory Automata, vol.20, no.5,pp.645-651, 1984.
Politeknik Negeri Semarang,‖ Jurnal Sains dan Teknologi vol.1,
no.1,pp.1-14. 2017
[4] P.Y. Guo, Z.H. Guang, and Z. Bien, ―A simple fuzzy adaptive
control method and application in HVAC,‖ The 1998 IEEE
International Conference on Fuzzy Systems Proceedings, 1998. IEEE
World Congress on Computational Intelligence, pp. 1-7. Anchorage,
Alaska,USA, 1998
[5] J. Wang, C. Zhang, and Y. Jing, ―Application of an intelligent PID
control in heating ventilating and airconditioning system. The 7th
World Congress on Intelligent Control and Automation, 2008
(WCICA 2008), pp. 1-5. Chongqing China, 2008.
[6] Z. Jun, ―A Particle Swarm Optimization Approach for Optimal
Design of PID Controller for Temperature Control in HVAC,‖ 2011
Third International Conference on Measuring Technology and
Mechatronics Automation, pp.230-233, Shanghai, China, 2011.
[7] R.C. Edwards, ―A simple hairdryer experiment to demonstrate the
first law of thermodynamics,‖Proceedings of the 2005 American
Society for Engineering Education Annual Conference & Exposition,
Session #1348, pp. 1 - 9, Portland, Oregon, USA, 2005.
[8] G. Recktenwald, R. Edwards, D. Howe, J. Faulkner, and C. Hsieh,
―The Engineering of Everyday Things: Simple experiments for the
thermal and fluid sciences,‖ Paper AC 2009-704, ASEE Annual
Conference and Exposition, pp. 1-8,Austin, Texas, USA, 2009.
[9] S. Manoiu-Olaru and M. Nitulescu, ―Hexapod Robot. Virtual Models
for Preliminary Studies,‖ 15th International Conference on System
Theory, Control and Computing (ICSTCC), pp.1-6, 2011.
32
Authorized licensed use limited to: Indian Institute of Technology (Ropar). Downloaded on April 16,2025 at 05:14:13 UTC from IEEE Xplore. Restrictions apply.