Inter national J our nal of Electrical and Computer Engineering (IJECE) V ol. 9, No. 3, June 2019, pp. 1683 1693 ISSN: 2088-8708, DOI: 10.11591/ijece.v9i3.pp1683-1693 r 1683 PID-based temperatur e contr ol de vice f or electric k ettle Mohd Badril Nor Shah, Norfahaniza Zailan, Amar F aiz Zainal Abidin, Mohd Firdaus Halim, Khalil Azha Annuar , Arman Hadi Azahar , Muhamad Haniff Harun, Muhammad F aizal Y aakub Centre for Robotics & Industrial Automation, F akulti T eknologi K ejuruteraan, Uni v ersiti T eknikal Malaysia Melaka, Malaysia Article Inf o Article history: Recei v ed Aug 13, 2018 Re vised No v 23, 2018 Accepted Dec 15, 2018 K eyw ords: PID controller Gain scheduling On-of f controller W ater temperature control ABSTRA CT A normal electric k ettle usually is intended to boil w ater until boiling point and cannot be controlled. Most of the k ettle does not pro vide the temperature display for user to track the current temperature reading. Thus, thi s project is inspired from the short- coming of most k ettles that are sold at the mark et. By using Arduino microcontroller , a de vice is de v eloped to control w ater temperature inside electric k ettle. T o pro vide automated temperature control, PID controller is chosen since it can pro vide s precise w ater temperature control with less fluctuation. The de vice is also equipped with the display of the current w ater temperature and desired temperature. The de vice is tested to an electric k ettle and the performance of PID controller in controlling w ater temper - ature is compared to on-of f controller . An analysis is performed based on the amount of fluctuation with respect to desired tempera ture to v erify the ef ficac y of the designed circuit and controller . It is found that the de v eloped de vice and PID controller are ca- pable to control the w ater temperature inside k ettle based on the desired temperature set by user with less amount of fluctuation. Copyright c 2019 Institute of Advanced Engineering and Science . All rights r eserved. Corresponding A uthor: Mohd Badril Nor Shah, F akulti T eknologi K ejuruteraan, Uni v ersiti T eknikal Malaysia Melaka (UT eM), Malaysia. Phone: +606-234 6591 Email: badril@utem.edu.my 1. INTR ODUCTION A common electric k ettle consists of tw o electrical parts, that are heat element and on-of f switch as depicted in Figure 1. When electric po wer supplied to the heat element, it will heats up the w ater inside k ettle at full po wer to bring the w ater at 100 C. The generated steam pressure subsequently will induce the on-of f switch to stop t he heating process. Based on this simple process, an electric k ettle is o nl y serv e one purpose: to boil w ater . Figure 1. Common parts of electric k ettle J ournal homepage: http://iaescor e .com/journals/inde x.php/IJECE Evaluation Warning : The document was created with Spire.PDF for Python.
1684 r ISSN: 2088-8708 T o enable the capability of electric k ettle of controlling w ater tem perature, it should be equipped with a de vice that can measure w ater temperature inside the k ettle, thus pro viding data for the controll er of the de vice to perform correct control action to the heat element. W ith a correct selection and proper design of the controller , a precise temperature control can be achie v ed with minimal fluctuation. One of the most prominent controller that can be used in this application is PID controller . PID controller widely used in industry since it ha v e simple structure and does not require mathemat ical deri v ation. It contain three terms: proportional, deri v ati v e and inte gration of the error reading which those will be summed together thus producing analog signal to t he actuator to pro vide treatment for both transient and steady state response. It has been pro v en to w ork in controlling linear and nonlinear , f ast and slo w response systems. W ith proper tuning method to obtain the suitable PID g ains, the precise and stable w ater temperature at desired setpoint can be prepared. There are man y applications can be adopted if an electric k ettle is able to produce w arm w ater at desired le v el temperature. F or e xample, at 37 C w ater temperature, a guardian can prepare w arm formula milk for their babies or toddlers [1]. Po wder milk is best prepared at 60 C to obtain perfect solubility [2]. A cof fee enthusiast al w ays require heat ed w ater of 93 C for bre wing a delicious cof fee drink [3]. T ea is best to be prepared at 82 C for maximum fla v our e xtraction from tea lea v es [3]. By ha ving an e xternal de vice that can control temperature of electric k ettle, user does not ha v e to b uy an e xpensi v e w ater w armer or similar de vice to obtain their preferred temperature of w arm w ater . By using a cheap electric k ettle and the proposed de vice that is de v eloped in this project, user is able to obtain the w arm w ater at the des ired temperature. There are a fe w almost similar w ork has been done which can be used as a reference for this w ork. In [4], the project of controlling air temperature inside closed case is de v eloped based on PIC16F877 microcotroller . LM35 temperature sensor is used for temperature measurement and proportional controller is used as control algorithm to dri v e DC-po wered lamp and DC-po wered f an to control air temperature inside the case. T emperature control inside drying chamner is done by [5]. Arduino Me g a 2560 microcontroll er is used as a main part and MLX90614 infrared sensor is used for temperature measurement. The microcontoller perform on-of f algori thm to control magnetron to control air temperature inside chamber . The magnetron is A C-po wered equipment which is dri v en by TRIA C-based circuit which is acti v ated by PWM signal gi v en by microcontroller . T emperature control of beer bre wing process is done in [6] by utilizing Arduino UNO microcontroller and DS180B20 temperature sensor . On-of f, proportional and PID controller are tested to compare the control performance in controlling beer temperature. 2. CIRCUIT DESIGN The proposed de vice consists of six main parts: microcontroller , heater dri v er circuit, t emperature sensor , temperature display , reference temperature input and control algorithm. Microcontroller acts as main brain for the de vice. It pro vides automated control of temperature reading, temperature display and heater control. Arduino microcontroller is chosen this project since it pro vides lar ge library and wide hardw are support [7]. T o enable to capability of temperature control inside k ettle, temperature sensor should be utilized. DS180B20 temperature sensor is used since it is w ater -proof and compatible to be interf aced to an y microcon- troller using a single digital pin, and e v en possible to connect multiple same sensors to the same pin. The sensor has a unique 64-bit ID b urned-in at the f actory to dif ferentiate them which enable the multiple connection at the same pin of microcontroller . Po wer supply for the sensor is 3.0-5V and capable to measure temperature range from -55 C to 125 C. F or heater dri v er circuit, solid state relay SSR is used since it is easy to be interf aced between micro- controller and A C po wer supply . It is constructed based on TRIA C-based circuit. It should be noted that to dri v e SSR to control A C v oltage, lo w frequenc y PWM (e.g: 0.1 times than the A C v oltage frequenc y) should be used to obtain uniform c ycle of A C v oltage as illustrated in Figure 2. High frequenc y PWM (e.g. PWM frequenc y less frequenc y of A V v oltage) of dri ving SSR will induce non-uniform phase angle of A C v oltages thus making linear relationship between heater po wer and PWM duty c ycle is not possible. Figure 2 and Figure 3 sho w the ef fect of A C v oltage output when it is dri v en by lo w and high PWM frequenc y that supplied to SSR. In this w ork, lo w frequenc y PWM can be used for w ater temperature control since w ater temperature has slo w step response. IJECE, V ol. 9, No. 3, June 2019 : 1683 1693 Evaluation Warning : The document was created with Spire.PDF for Python.
IJECE ISSN: 2088-8708 r 1685 [] [] Figure 2. Lo w frequenc y PWM in dri ving an SSR will produce uniform c ycle of A C v oltage output. (a) 40% duty c ycle (b) 80% duty c ycle Figure 3. High freqenc y PWM to dri v e an SSR will cause nonuniform phase angle trigger of A C v oltage output A v ariable resistor is used to allo w user to set their desired w ater temperature, and se v en se gment display is used to sho w the desired temperature and the current w ater temperature inside k ettle. F or control algorithm, PID controller is used in pro viding automated temperature control, where the PID is coded inside microcontroller . The details of the PID controller and its design is e xplained in the ne xt section. Figure 4 sho ws the field diagram reflecting a microcontroller connected with input and output components. Figure 4. The circuit arrangement of this project 3. PID CONTR OLLER PID is a proportional-inte gral-deri v ati v e controller , which control loop feedback mechanism. It is commonly used in industrial control system. The first PID controller w as de v elop by Elmer Sperry in 1911 and it is used to automate a ship steering mechanism. On 1922, the first theoretical paper on PID control w as de v elop by Nicolas Minorsk y , which then w as applied to automatic steering of ships [8]. Figure 5 is the block diagram of a system controlled by PID controller where y ( t ) is controlled output, r ( t ) is reference signal, e ( t ) is error signal and u ( t ) is control signal. PID-based temper atur e contr ol de vice ... (Mohd Badril Nor Shah) Evaluation Warning : The document was created with Spire.PDF for Python.
1686 r ISSN: 2088-8708 Figure 5. PID controller block diagram PID control signal is the sum of three terms which are based on the error measurement, that are u ( t ) = K p + K i Z 1 0 e ( t ) dt + K d d dt e ( t ) (1) where e ( t ) = r ( t ) y ( t ) , K p is proportional constant, K i is inte gral constant and K d is deri v ati v e constant. The v alue of K p , K i and K d are the k e y in pro viding stable and desired transient response which can be obtained by using heuristic methods, analytical methods, frequenc y response method, optimization method and adopti v e turning methods [9]. No w adays, PID control algorithm is al w ays implemented in microcontroller to enable compact design of a product. Ho we v er , the inte gral and deri v ati v e operation in PID equation of (1) cannot be performed directly by microcontroller . Hence, the inte gral and deri v ati v e term of (1) need to be con v erted to discrete form. Starting with the deri v ati v e term, we can use the follo wing dif ference equation as an approximation, such that; d dt e ( t ) e ( k ) e ( k 1) T s (2) where e ( k ) is error signal in discrete domain, e ( k 1) is pre vious error signal and T s is sampling time. Equation (2) is the approximate slope of the tangent line at e ( t ) . The approximation of inte gral term can be written such that Z 1 0 e ( t ) dt T s 1 X 0 e ( k ) (3) W ith these approximations, we can re write PID control algorithm in discrete form u ( k ) = K p e ( k ) + K i   T s 1 X 0 e ( k ) ! + K d e ( k ) e ( k 1) T s (4) The details deri v ation and more precise approximation of PID controller in discrete form can be found in [9, 10]. The k ernel code of implementing discrete PID of (4) in Arduino IDE en vironment softw are is sho wn in Figure 6. Arduino IDE is a softw are designed for Arduino which allo ws user to write code in C language, compile, send/recei v e to/from microcontroll er . K p , K i and K d of PID are the parameters that need to be tuned. In this project, the heuristic approach is be used to determine the appropriate v alues of PID g ains. The procedure of determining the PID g ains is e xplained as follo ws: (a) Set all g ains to zero. (b) Increase the K p g ain until the response steadily oscillate. (c) Increase the K d g ain until the oscillations significantly reduced. (d) Repeat steps (ii) and (iii) until the response is stable with minimal oscillation. (e) Increase the K i g ain to bring the response to the set point. IJECE, V ol. 9, No. 3, June 2019 : 1683 1693 Evaluation Warning : The document was created with Spire.PDF for Python.
IJECE ISSN: 2088-8708 r 1687 Note that the abo v e procedure is v alid for open loop stable plant [11]. F or unstable system, adv ance tuning method is required. unsigned long Now; unsigned long LastTime; double SamplingTime=0; double Error; double SumError = 0; double RateError; double LastError = 0; void PID(float setpoint, float output, float kp, float ki, float kd) f Now = millis(); SamplingTime = (double)(Now - LastTime) * pow(10,-3); Error = setpoint - output; SumError = SumError + (Error * SamplingTime); RateError = (Error - LastError)/SamplingTime; LastError = Error; LastTime = Now; Output = kp * Error + ki * SumError + kd * RateError; return Output; g Figure 6. Code of PID control algorithm 4. RESUL TS AND DISCUSSION The block diagram for o v erall system of this de vice that i s connected to electric k ettle is illustrated in Figure 7, where T ( t ) is w ater temperature inside k ettle and T d is desired temperature. e ( t ) is error signal, as in .F or real- time results, the hardw are prototype of this project is connected to an 1500 W att electric k ettle and a PC (for data logging purpose) to v erify the performance of the project as sho wn in Figure 8. F or performance analysis of PID controller , the response of w ater temperature in the k ettle is compared to on-of f controller . The results are presented in se v eral cases as tab ulated in T able 1. The interf ace of the de v eloped de vice is depicted in Figure 9 where the se v en se gment displays are to display current w ater temperature inside k ettle, desired temperature from user and PID control ler g ains. DS180B20 sensor probe is immersed inside the k ettle and the plugtop of electric k ettle is connected to the de vice through switch sock et outlet. The de vice also equipped with a knob to enable user to set their desired temperature. The toggle switch is to select the controller (either PID or on-of f controller) for temperature control operation. Figure 7. PID controller block diagram PID-based temper atur e contr ol de vice ... (Mohd Badril Nor Shah) Evaluation Warning : The document was created with Spire.PDF for Python.
1688 r ISSN: 2088-8708 Figure 8. T emperature control de vice connected to electric k ettle and PC Figure 9. The interf ace of temperature control de vice T able 1. Experiment Cases Experiment Case Desired T emperature Controller T ype CASE 1 45 C PID CASE 2 65 C PID CASE 3 80 C PID CASE 4 45 C On-of f CASE 5 65 C On-of f CASE 6 80 C On-of f As e x pl ained in pre vious section, PID controller has g ain that need to be tuned which are K p , K i and K d . By u s ing heuristic approach, the g ain of PID controller can be determined. Based on the tuning procedure e xplained in Section III, after se v eral tuning attempts for 45 C, 65 C and 80 C temperature set point, the IJECE, V ol. 9, No. 3, June 2019 : 1683 1693 Evaluation Warning : The document was created with Spire.PDF for Python.
IJECE ISSN: 2088-8708 r 1689 appropriate g ains are successfully obtained and sho wn in T able 2. The PWM period of control signal u(t) is set to 1 s. Note that the tuning is done when w ater v olume at 500 ml and intial w ater temperature is 29 C. The approach to assign dif ferent v alues of PID g ain for dif ferent set point is kno wn as ‘g ain scheduling’ method. It is also found the e x ecution time for the microcontroller to implement the whole PID control algorithm is 1.13 s which including data logging to PC through USB communication. F or performance analysis, the maximum fluctuation of w ater temperature along the desired temperature is recorded as depicted in Figure 10. T able 2. The PID Gains for Dif ferent Desired T emperature Desired T emperature K p K i K d Belo w 55 C 8 5 16 55 C - 75 C 8 5 18 76 C - 95 C 8 5 25 Figure 10. The definition of maximum fluctuation in this project. Figure 11(a) to Figure 11(c) sho w the response of w ater temperature inside k ettle when the de vice is using PID controller . F or the CASE 1 e xperiment, the desired temperature is set at 45 C and it is found the PID controller is able to generate appropriate PWM signal to the heater thus result in less amount fluctuation of w ater temperature. The highest fluctuation recorded at this case is 1.5 C. Same performance of PID controller can be seen when the desired temperature is set at 65 C and 80 C where the w ater temperature is almost same with the desired temperature with a v ery small fluctuation. The maximum fluctuation recorded for CASE 2 and CASE 3 are 1.3 C and 1.8 C. F or comparison purpose, the de vice also performs on-of f controller to control the w ater temperature. The control signal u ( t ) for on-of f controller is e xpressed by: u ( t ) = sign [ e ( t )] = 8 > < > : u ( t ) = 1 if e ( t ) > 0 u ( t ) = 0 if e ( t ) = 0 u ( t ) = 1 if e ( t ) < 0 (5) Ho we v er , for case u ( t ) = 1 if e ( t ) < 0 has no meaning in this project, thus the term is omitted from the equation. Equation (5) reflect the on-of f operation of heater: when T ( t ) < T d ( t ) , the heater is acti v ated, else T ( t ) T d ( t ) ), the heater is deacti v ated. The time tak en for the controller to perform the whole instruction including on-of f control algorithm is 1.10 s. The results when the de vice perform the on-of f controller are sho wn in Figure 12(a) to Figure 12(c). From the figure, a lar ge amount o f o v ershoot can be seen at w ater temperature response. On-of f controller gi v es instant on and of f signal to heater and this type of signal unable to re gulate the w ater temperature with less fluctuation within desired temperature. The amount of fluctuation for CASE 7, CASE 8 and CASE 9 are 5.1 C, 6.6 C and 7.5 C. The maximum fluctuation magnitude of all e xperiment cases is summarized in T able 3. PID-based temper atur e contr ol de vice ... (Mohd Badril Nor Shah) Evaluation Warning : The document was created with Spire.PDF for Python.
1690 r ISSN: 2088-8708 (a) (b) (c) Figure 11. The response of w ater temperature inside electric k ettle when using PID controller at 45 C, 65 C and 80 C (Le gend - Blue: desired temperature, red: w ater temperature inside k ettle, yello w: control signal) (a) (b) (c) Figure 12. The response of w ater temperature inside electric k ettle when using on-of f controller at 45 C, 65 C and 80 C (Le gend Blue: desired temperature, red: w ater temperature inside k ettle, yello w: control signal) Based on the result s, it can be concluded that PID controller is able to pro vide less amount of w ater temperature fluctuation as compare to on-of f controller thus making it suitable for precise temperature control. Ho we v er , in t h i s w ork, the e xperiments are done by using 500 ml of w ater . F or more w ater v ol ume, the PID require dif ferent set of g ains for precise temperature control at dif ferent desired temperature. Therefore, for future impro v ement, dif ferent structure of PID or adv ance controller shall be used which can co v er v arious amount of w ater v olume without performing tedious w ork to determine controller g ain in v arious conditions. IJECE, V ol. 9, No. 3, June 2019 : 1683 1693 Evaluation Warning : The document was created with Spire.PDF for Python.
IJECE ISSN: 2088-8708 r 1691 T able 3. The Maximum Fluctuation of W ater T emperature Inside K ettle for Each Experiment Case Experiment Case Desired T emperature Maximum Fluctuation CASE 1 45 C 1.5 C CASE 2 65 C 1.3 C CASE 3 80 C 1.8 C CASE 4 45 C 5.1 C CASE 5 65 C 6.6 C CASE 6 80 C 7.5 C A CKNO WLEDGEMENT The authors w ould lik e to thank UT eM for sponsoring this w ork under short-term grant no. PJP/2017/FTK- CERIA/S01556. REFERENCES [1] J. Marshall and S. Stuart, Child De velopment . Heinemann Educational, 2001. [2] S. Anup, J. A. H., and C. R. Shrikant, “Functionality of Milk Po wders and Milk-Based Po wders for End Use Applications - A Re vie w , Compr ehensive Re vie ws in F ood Science and F ood Safety , v ol. 11, no. 5, pp. 518–528, 2012. [3] K. Hansen and T . Arndorfer , The Complete Idiot’ s Guide to Cof fee and T ea . DK Publishing, 2006. [4] Khairurrijal, A. Mikrajuddin, and B. Maman, “Home-made PIC 16F877 Microcontroller -Based T empera- ture Control Cystem for Learning Automatic Control, Computer Applications in Engineering Education , v ol. 19, no. 1, pp. 10–17, 2011. [5] S. K. K orkua, S. Chandhak et, K. Thinsurat, and K. Pornbandit, “Design of Automatic Phase-Controlled Con v erter Based onT emperature for Micr o w a v e Drying System, in 2016 2nd IEEE International Sympo- sium on Robotics and Manufacturing A utomation (R OMA) , Sept 2016, pp. 1–6. [6] M. W eeks, Arduino Controlled Bre wing, in SoutheastCon 2015 , April 2015, pp. 1–5. [7] M. Banzi, Getting Started with Ar duino . Mak er Media Inc., 2015. [8] S. Bennett, “Nicholas Minorsk y and the Automatic Steering of Ships, IEEE Contr ol Systems Ma gazine , v ol. 4, no. 4, pp. 10–15, No v ember 1984. [9] K. ˚ Astr ¨ om and T . H ¨ agglund, PID Contr oller s: Theory , Design and Tuning . Instrument Society of America, 1995. [10] J. Charais and R. Lourens, “Softw are PID Control of an In v erted Pendulum Using the PIC16F684, Ap- plication Note AN964, Micr oc hip T ec hnolo gy Inc. , 2004. [11] K. H. Ang, G. Chong, and Y . Li, “PID Control System Analysis,Design and T echnology , IEEE T r ansac- tions on Contr ol Systems T ec hnolo gy , v ol. 13, no. 4, pp. 559–576, July 2005. BIOGRAPHIES OF A UTHORS Mohd Badril Nor Shah recei v ed the M. Eng. de gree in Mechatronic and Automatic Control, and the Ph.D. de gree in Electrical Engineering (Control) from Uni v ersiti T eknologi Malaysia, Johor Bahru, Malaysia, in 2011 and 2015, respecti v ely . He also has se v eral years of e xperience as an Engineer in b uilding and f acility maintenance engineering. His research interests include netw ork ed control system, real-time control system, rob ust control, and controller area netw ork (CAN). PID-based temper atur e contr ol de vice ... (Mohd Badril Nor Shah) Evaluation Warning : The document was created with Spire.PDF for Python.
1692 r ISSN: 2088-8708 Nurfahaniza Zailan is a student of Bachelor of Electronic Engineering T echnology (Industrial Automation and Robotics) from Uni v ersiti T eknikal Malaysia Melaka. Amar F aiz Zainal Abidin recei v ed his first de gree M. Eng. (Hons) in Electrical and Elec- tronics Engineering from The Uni v ersity of Nottingham, Malaysia and M.Eng. from Uni v er - siti T eknologi Malaysi a. He is currently attached as an academic staf f with Uni v ersiti T eknikal Malaysia Melaka. His research interests are including multi-objecti v e optimization and nature- inspired optimization algorithm. Mohd Firdaus Abdul Halim recei v ed his first de gree M. Eng. (Hons) in Electrical Po wer System from Uni v ersiti T enag a Nasional and M. Eng. from Uni v ersity of Applied Sciences, Rosenheim. He is an academic staf f with Uni v ersiti T eknikal Malaysia Melaka. Currently , his research is focused in are of rene w able ener gy , po wer system and po wer generation. Khalil Azha Anuar recei v ed the B . Eng (Hons) in Electronic Engineering and M. Eng. in Mecha- tronics and Automatic Control in 2006 and 2014 from Uni v ersiti T eknologi Malaysia. Currenly he is a l ecturer at the Uni v ersiti T eknikal Malaysia Melaka. His primary interests related to opti- mization, control and automation system engineering. Arman Hadi Azahar recei v ed the B. Eng (2010) and MSc (2013) in Mechatronic Engineering from Uni v ersiti T eknikal Malaysia Melaka. Currenly he is a lecturer at the Uni v ersiti T eknikal Malaysia Melaka. His primary interests related to control system and mechatronic engineering. Mohd Haniff Harun recei v ed the B.Eng (2010) and MSc (2013) from Uni v ersiti T eknikal Malaysia Melaka. Currenl y he is a lecturer at the Uni v ersiti T eknikal Malaysia Melaka. His primary interests related to vision system and mechatronic engineering. IJECE, V ol. 9, No. 3, June 2019 : 1683 1693 Evaluation Warning : The document was created with Spire.PDF for Python.