Accepted Manuscript Thermostat with Peltier element and microcontroller as a driver Predrag S. Iskrenovića, Goran B. Sretenović, Ivan B. Krstić, Bratislav M. Obradović, Milorad M. Kuraica PII: DOI: Reference:
S0263-2241(19)30103-4 https://doi.org/10.1016/j.measurement.2019.01.094 MEASUR 6338
To appear in:
Measurement
Received Date: Revised Date: Accepted Date:
12 October 2018 28 December 2018 29 January 2019
Please cite this article as: P.S. Iskrenovića, G.B. Sretenović, I.B. Krstić, B.M. Obradović, M.M. Kuraica, Thermostat with Peltier element and microcontroller as a driver, Measurement (2019), doi: https://doi.org/10.1016/ j.measurement.2019.01.094
This is a PDF file of an unedited manuscript that has been accepted for publication. As a service to our customers we are providing this early version of the manuscript. The manuscript will undergo copyediting, typesetting, and review of the resulting proof before it is published in its final form. Please note that during the production process errors may be discovered which could affect the content, and all legal disclaimers that apply to the journal pertain.
Thermostat with Peltier element and microcontroller as a driver Predrag S. Iskrenović1), Goran B. Sretenović1), Ivan B. Krstić1), Bratislav M. Obradović1) and Milorad M. Kuraica1) 1)
University of Belgrade, Faculty of Physics, PO Box 44, 11001 Belgrade, Serbia
E-mail:
[email protected]
Abstract The aim of this work was to construct a fast and precise thermostat that will operate without quasi-oscillatory processes during the temperature adjustment. The analysis of the temperature control process has shown that one of the possible solutions is pulsed driving in accordance with spontaneous temperature changes, which is an exponential function of time. The microcontroller, as a control unit, and digital technique is used for the temperature control in the presented work. During the testing, the constructed thermostat fully confirmed the theoretical predictions it was based on. The constructed thermostat has satisfied all expectations in terms of the range of temperatures and the stability of the set temperature. The obtained temperature range was -15C120C, with an absolute error of less than ±0.05C and with a standard deviation of the temperature around 0.02C.
Introduction In the process of heating, the heat Qin is delivering to the object. One part of this heat, QL causes the increase of the internal energy and the temperature of the object. The other part QD is lost by the exchange with the environment, as shown in Figure 1.
Figure 1. Scheme of the process of the object heating. The maintenance of the constant temperature of the object is realized by continuously adding (compensating) the heat energy QD that the object exchanges with the environment [1]. If it is necessary to change the temperature of the object and keep it at a new temperature, the procedure is somewhat different. It is necessary to change the internal energy of the object by the discrete heat input to the amount that corresponds to the desired temperature change. In parallel with this discrete process, it is necessary to continually compensate for heat exchange with the environment at the new temperature. The change of the the internal energy QL after the temperature change is: ,
(1)
1
where ΔT represents the temperature change, m mass of the object and cv specific heat capacity of the object. On the other hand the change of the internal energy can be written as: ,
(2)
where P(t) is the power as a function of time and ∆t pulse duration. The fastest way for the change of the object temperature would be a delivery of the power pulse with the shape of Dirac δ function, which cannot be realized in real conditions. Instead of a δ function, a rectangular pulse of a limited power and a limited duration can be used. Higher amplitude of the power pulse causes the decrease of the pulse duration and the approach to the ideal shape i.e. the Dirac δ function.
Figure 2. Power in function of time for: a) Dirac δ function, b) rectangular impulse with limited power value and duration, c) desired form of function Figure 2 gives graphical representations of the hypothetic processes of the temperature change. Figure 2a) shows the theoretical model with Dirac δ function of the infinite amplitude and the infinitesimal duration. The shaded surfaces in Figure 2b) and 2c) represent the additions of the energy to the internal energy that is necessary for the increase of the temperature of the object from T1 to the temperature T2. The pulse amplitude and its duration could be freely changed, but the area of the shaded surface should remain the same. In this way, it is possible to influence and control the total heating time that is required for the temperature increase to the value T2. The executive components of the thermostat described in this work are Peltier elements. Fast rectangular impulses of the high amplitude presented in Figure 2b) are not suitable for the driving of the Peltier element because they cause the high current density flow through the P-N junction, which can damage or even destroy the Peltier element. Even if the amplitude of the pulse is limited to the maximum allowed current for the given Peltier element, high amplitude pulses are not suitable for this application because the performance of the Peltier elements drops rapidly at higher values of the current, as it is documented by its user manual that is 2
given by its manufacturer [2]. Therefore, a slightly different approach was applied. The driving pulse with slower temporal changes was used. It was shown that the use of such signal does not affect significantly the response time of the temperature control system. Due to the Newton's law of cooling, during the heating or cooling of an object that is in thermal contact with the environment its temperature changes as the first order exponential function of time [3]. This was the motive to define the power/current driving signal of the Peltier elements that consists of the growing exponential function of the first order and the decreasing as exponential function of the first order. Thus, the rectangular signal shown in Figure 2b) is replaced by the signal presented in Figure 2c).
Theory The driving function of the temperature control system is the current IT(t) which is flows through the Peltier element. The output function i.e. the response of the thermostat, is a temperature as a function of time T(t). If a system, in this case our thermostat, is driven by a current that has a shape of the Heaviside step function, ,
(3)
where U(t) has form of Heaviside step function, and I0 is the value of the maximal current, the temperature response of the thermostat system can be represented with a function (4) with a correlation coefficient greater than R>0.999 .
(4)
where τs is characteristic constant time of the system, thermostat. Based on the response of the system, the transmission function of the system G(s) can be determined [4,5]. The function G(s) represents the Laplace transform of the response function in the time domain, where s is a complex number and independent variable in s-domain. In the s-domain, this relation is given by (5) (6)
.
The driving function of the thermostat and the system response in the time domain are presented in Figure 3.
3
Figure 3. The graphs of the driving of the thermostat by the Heaviside step function and the temperature response of the system as the functions of time.
Based on the system response function in the time domain (4), the response function in the s-domain can be represented as (7) The transition function of the thermostat can be obtained by the inserting of the relation (7) in the equation (6) .
(8)
It was described earlier that the requested driving function has exponential rise and fall of pulse edges i.e. the requested current shape IT(t) should be
.
(9)
Io and A are constants that determine the amplitude of the pulse and the heat that compensate the change of the internal energy for the demanded change of the temperature. τ1 and τ2 are time constants of the rising and falling edges of the pulse, respectively. In the s domain, the Equation (9) becomes (10) The function of the response of the system could be obtained from the relations (6), (8) and (10): (11) The arranging of the Equation (11) and the transition to the time domain give the response curve:
4
(12)
The choice of time constants τ1 and τ2 is absolutely free and their mutual relationship and the relationship with the time constant of the system τs determine the shape of the system response to the driving signal given by the Equation (9). The suitable selection of these time constants enables relatively fast response of the system without overshooting, as shown in Figure 4. 1.4
b) T(t)
60
1.2 1.0
I (A)
40
T [oC]
a) I(t)
0.8 0.6 0.4
20
0.2 0.0 0 0
100
200
300
400
t [s]
Figure 4. Figure 4. The shape of the driving current signal and the corresponding change of the temperature.
Experiment Based on the described idea and the presented theory, a microcontroller driving thermostat with Peltier elements is considered. The software for the microcontroller is also developed. The Peltier elements are driven by the current pulses of a shape shown in Figure 4 in accordance with the Expression (9). When the desired temperature is achieved, the temperature is constantly controlled and maintained by the reduction to zero of the difference between the set and the achieved temperature, which is also achieved by the use of the software.
5
Figure 5. Schematics of the thermostat system. The block diagram of the constructed thermostat represents the usual closed control loop [8,9], see Figure 5. What distinguishes it from most analogue PID (proportional integral derivative) thermostats is the use of an AD (Analog to Digital) converter which digitizes the achieved temperature and a DA (Digital to Analog) converter that controls the current through the Peltier elements. A K-type thermocouple sensor is used for the temperature measurement. It has been connected to the cold junction compensation circuit AD597AR that enables sensitivity of 10mV/oC and the additional amplifier OP07 that shifts the obtained signal towards positive voltages and thus permits the use of A/D converter ADS1115 in the entire range of the working temperatures. Microcontroller Arduino DUE with the clock speed of 80 MHz has been used. Some functions incorporated to the software were performed by the maximal speed, while the main loop that controls the temperature was carried out every 500 ms. For the control of the current flow through the Peltier elements, the laboratory made 16 bit D/A converter based on shift register and resistance network is used, as presented in Figure 5. The solution that uses shift register is used because it enables serial communication and requires the use of only three pins of the microcontroller. The galvanic isolation of these three pins is performed by means of optocouplers The controlling software contains a series of functions that perform different operations such as: input/output menu, input data filter, communication with display, keyboard and other peripheries, averaging of the measured temperature etc. The control software itself is rather simple and it contains only several lines that belong to two groups of commands. The first group of commands fills the numerical array with the 30 last measured temperature values in the 500 ms time steps and calculates of the gradient of the temperature. The second group of commands set the new current through the Peltier elements. The part of the main loop of the software is given below: void loop() { . . . // filling a array of temperatures // -------------------------------------for (i=0; i<30; i++) { ATmer [i+1] = ATmer [i]; 6
ATime [i+1] = ATime [i]; } ATmer [0] = TeSrednje(); ATime [0] = millis(); GradijentT = 1000*(ATmer [0] - ATmer [29])/(ATime [0] - ATime [29]); // Celsius degree per second Tizmer = TeSrednje(); ExtrapolTemp = Tizmer + GradijentT*35; // Expected temperature for 35 sec if(I_dac - 65*(TeZadato-ExtrapolTemp) > 0 && (I_dac - 65*(TeZadato-ExtrapolTemp)) < 65536) { I_dac = I_dac - 65*(TeZadato-ExtrapolTemp); } . . . ShiftOut(ZastitaDAC(I_dac)); delay(500); } The software sets the driving pulses that are given by the Eq. (9) as a consequence of its interaction with the thermostat body and Peltier elements. The amplification of the set and achieved temperature is a characteristic of all thermostats. This amplification is responsible for the occurrence of the oscillatory processes during the approach to the requested temperature. In order to obtain stable temperature close to the set value, the amplification should be high. On the other hand high amplification causes steep changes of the current for during temperature change which results with the overshooting and the temperature oscillations. The presented software solution uses periodically measured temperature values for the calculation of the temperature gradient. Based on the current gradient of the temperature, the extrapolated temperature is calculating which directs the decrease of the current flow through the Peltier elements. The time dependence of the current and the temperature gradient is shown in Figure 6.
7
Figure 6. Current flow through the Peltier elements and the gradient of the temperature in function of time when temperature changes from the room temperature to 32oC and back to the room temperature.
The shape of the driving pulses is determined by the amplification factor. The amplification factor was set to 65 and the time of the temperature extrapolation was set to 35 s. Both parameters are set in accordance to the configuration of the mechanical part of the thermostat. They can be changed during the operation if it is needed. Upper and lower limits of the temperature are realized by software: TempZad = atof(TempChr); if (TempZad > 120 || TempZad <-15) { lcd.setCursor(0, 0); lcd.print(" E R R O R! "); delay(2000); lcd.setCursor(0, 0); lcd.print("Tzad= "); TempZad = Tizmer; }
The scheme of the mechanical part of the thermostat is shown in Figure 7.
8
Figure 7. Scheme of the thermostat body.
The microcontroller is the control unit of the apparatus. The demanded temperature setting is usually enabled by the use of potentiometer. The use of the potentiometer is relatively coarse and unsuitable solution for fine temperature adjustment, especially if it is necessary to repeat the setting of the exactly the same temperature in subsequent experiments. For the sake of precise setting of the desired temperature the keypad is installed, so it's always possible to enter the desired temperature accurately, fast and easy. For the easier control, a display is also embedded so that it is possible to set the temperature and to observe the current value. Thus, the device itself becomes standalone unit and independent of the computer, although it can be controlled by the computer because it uses the microcontroller. Figure 8 is shows the change of the temperature of standard PID [6] thermostat for a demanded temperature increase of 20C. The curves are presented for the optimal values of the P and D parameters, but for the different values of the parameter I. The Optimal values of the P and D parameters are set according to the instructions of the PID manufacturer.
Imax I 3/4 I 1/2 I 1/4 Imin
55
50 55 45
40
o T [ C]
T [oC]
54
53
35 52
30
51
120
140
160
180
200
time [s]
25 20
40
60
80
100
120
140
160
180
200
220
time [s]
Figure 8. Temperature in function of time for standard PID thermostat for different values of parameter I. P=const, D=const. Digital control of the thermostat operation and the pulse that is double exponential function allow faster achievement of the desired temperature without oscillations or the exceed of the specified value, which occur with the standard PID devices [6,7], as presented in Figure 8. 9
The designed thermostat is able to control the temperature in the range from -15C to + 120C with an absolute error that is less than ± 0.05C and with a standard deviation of temperature which is about 0.02C.
Figure 9 represents a temporal dependence of the current flowing through the Peltier elements for several successive temperature changes.
Figure 9. Time dependence of the current flowing through the Peltier element for different values of successive temperature changes. controler PID
100
80
T [ oC ]
60
40
20
0
-20 0
10
20
30
40
50
60
70
time [ min ]
Figure 10. The comparison of the efficacies of the commercial thermostat with PID regulator (blue line) and the thermostat with microcontroller developed in this study (red line). The graphs represent temporal development of the measured temperature for several successive temperature changes. Driving current of the thermostat with microcontroller correspond to the signal presented in Figure 9.
10
The comparison of the efficiency of the commercial thermostat with PID regulator and the thermostat with microcontroller developed in this work is given in Figure 10. The red colored line illustrates the time diagram for several successive temperature changes of the thermostat with microcontroller, from 90C to -5C, corresponding to the driving current shown in Figure 9. It is obvious that the temperature change is realized very fast and without oscillation around the new value, regardless the temperature value. The blue line in Figure 10 represents a time diagram of a commercial PID thermostat. The time diagram of the PID thermostat was recorded with the use of the manufacturer's recommended values of P, I and D parameters. Beyond the temperature range that is presented shown, the commercial PID regulator needed much more time to stabilize the temperature. That is why the results of the commercial thermostat are presented in narrower range. Figure 11. shows sequences of the graph presented in Figure 10 for the thermostat with microcontroller at four different stabilized temperatures. The presented graphs depict the stability of the standard deviation which does not depend on the value of the set temperature. Also, its value does not exceed 0.02oC. The graphs presented in Figures 8 and 10 clearly demonstrate the restricted ability of the standard thermostats with PID controllers for the operation without exceed or surpass in a narrow range of temperatures, for the optimal values of the P, I and D parameters. Beyond this narrow range, the dumped oscillations around the set temperature occur quite often. On the other hand, the Figures 9 and 10 confirm the validity of the idea of the temperature regulation by exponential current pulses. The proposed method gave excellent results in the wide range of temperatures. It is also shown that the obtained results do not depend on the initial and final values of the temperature.
Figure 11. Temperature stability in time for four different final temperatures.
The software which is designed for the thermostat control responds to the commanded changes of the temperature and on the external disturbances in a same way. Figure 12 represents reactions of the thermostat on the drastic changes in the surrounding. First, the outer insulation of the thermostat was removed (t=0s), then the thermostat body is touched by two fingers at t≈400s, after, the thermostat is released at t≈600s, and finally thermal insulation is restored at t≈850s.
11
Figure 12. The response of the thermostat to the external thermal disturbances.
Conclusion The goal of the presented work was the construction of the precise thermostat that will be able to change temperature without quasioscillatory processes. The analysis of the thermostat processes has shown that one of the possible solutions is temperature change as an exponential function of time. Also, this process should be in line with the possibilities of the applied Peltier thermoelectric elements. The control unit of the thermostat is constructed by the use of the microcontroller. The microcontroller measures the achieved temperature and manages the Peltier thermoelectric elements through a 16-bit AD and DA converters. For these purposes, a software application that performs two functions has been developed. It calculates the pulse parameters during a temperature change and maintains the temperature at a requested value. During the test, the constructed thermostat fully confirmed the theoretical analysis that it was based on. The achievement of the desired temperature is relatively fast, on a minute scale, and precise, with the absolute error less than ± 0.05C. The digital setting of the desired temperature, via the keyboard, enables simple and accurate temperature setting that is of interest. Additionally, the software permits the implementation of the additional digital input or output lines for the communication with the other devices if it is required. Finally, the described construction represents a very flexible and precise part of laboratory equipment with wide application possibilities.
Reference:
1) Jay Dratler Jr.; Review of Scientific Instruments 45, 1435 (1974); doi: 10.1063/1.1686523 2) M.B.S. Hafis, M.J.M. Ridzuan, A.Z.A. Firdaus, S.M. Shahril, R.N. Farahana, and C.K. Chong, Appl. Mech. Mater. 554, 241 (2014).
12
3) M.I. Davidzon, Int. J. Heat Mass Transf. 55, 5397 (2012). 4) K. Kazihara, A. Yoshihiro, T. Sonoda, and R. Ueda, Review of Scientific Instruments 68, 1743 (1997); 5) B. Komiyama, Review of Scientific Instruments 56, 1226 (1985); doi: 10.1063/1.1137981 6) P. K. Madhavan Unni, M. K. Gunasekaran, and A. Kumar, Review of Scientific Instruments 74, 231 (2003); 7) A. V. Anisimov and N. R. Dautova, Review of Scientific Instruments 81, 075101 (2010); 8) Y. H. Sheu and M. S. Young, Review of Scientific Instruments 66, 5609 (1995); 9) Xiaosong Zhu, Eike Krochmann, and Jiashu Chen, Review of Scientific Instruments 63, 1999 (1992);
13
Highlights: 1. The described thermostat is compact, precise, and fast and allows an easy set of the desired temperature. 2. It is an original solution for the pulse driving of the thermostat and maintenance of the desired temperature. 3. The application software is very simple, efficient and easy to set up and customize. 4. Temperature changes are realized very quickly and without semi-oscillatory processes.
14