Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
66 views4 pages

Learning Control at Undergraduate Level Using PIC 16F877 Microcontroller-Based Temperature Controller

1. The document describes a PIC 16F877 microcontroller-based temperature control system built for undergraduate students to learn control systems. 2. The system includes a thermal plant made of a plastic box with a lamp and fan for heating and cooling air, and a temperature sensor. 3. The microcontroller acts as the controller and implements proportional control to adjust the lamp and fan based on the temperature error between the setpoint and sensor readings.

Uploaded by

Uma Mageshwari
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views4 pages

Learning Control at Undergraduate Level Using PIC 16F877 Microcontroller-Based Temperature Controller

1. The document describes a PIC 16F877 microcontroller-based temperature control system built for undergraduate students to learn control systems. 2. The system includes a thermal plant made of a plastic box with a lamp and fan for heating and cooling air, and a temperature sensor. 3. The microcontroller acts as the controller and implements proportional control to adjust the lamp and fan based on the temperature error between the setpoint and sensor readings.

Uploaded by

Uma Mageshwari
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Proceedings of the 3rd WSEAS/IASME International Conference on Educational Technologies, Arcachon, France, October 13-15, 2007

422

Learning Control at Undergraduate Level Using PIC 16F877 Microcontroller-Based Temperature Controller
KHAIRURRIJAL*), MIKRAJUDDIN ABDULLAH, NUR ASIAH APRIANTI, AND SURYADI Physics of Electronic Materials Research Division Faculty of Mathematics and Natural Sciences Institut Teknologi Bandung Jalan Ganesa 10, Bandung 40132 INDONESIA *) E-mail address: [email protected]
Abstract: - A PIC 16F877 microcontroller-based temperature control system, which is composed of a thermal plant and a controller, has been built for assisting undergraduate students in learning control system. The plant was made from a plastic box covering a dc lamp and a dc fan as well as a temperature sensor. The controller was designed to do a proportional control action with the proportional constant or gain KP. If air temperature in the plant is lower than the set point, the lamp heats the air. On the other hand, the heat is exhausted to the ambient by the fan to lower the air temperature. Experiments conducted by employing the control system showed that small KP results in high steady state error. Moreover, the steady state error was reduced by increasing KP. It was also found that the positive steady state error correlates with the increase of heat by the lamp while the negative one implies that the fan drains the heat to the ambient. Key-Words: - Control system, Microcontroller, Proportional, Thermal plant

1 Introduction
The FI4172 Special Topics in Instrumentation Physics, which is an elective, 3-credit unit course offered in the fourth year, can be taken by undergraduate students of Physics Study Program, Faculty of Mathematics and Natural Sciences at Institut Teknologi Bandung. One of topics delivered in this course is on the theory and application of automatic control. In order to strengthen concepts delivered in the lectures, laboratory works by using a real control system are required. However, commercial control systems for education provided by Festo [1] and Leybold [2] are costly. We decided to build the real control system based on a microcontroller. The thermal system was chosen to be controlled due to its simplicity and the PIC 16F877 was selected among microcontrollers because it is easily found in the domestic market and popular among the Physics undergraduate students. Here, we present a home-made PIC 16F877 microcontroller-based temperature controller, which is used by the students to learn the automatic control in the laboratory. The hardware and software of the temperature control system as well experiments using the control system are discussed in detail.

2 Hardware and Software of Temperature Controller


Figure 1 describes a closed-loop control system consisting of a controller and a plant. The plant output is a process variable y(t), which is the variable to be controlled. The process variable is compared to a set point r(t), which is the value to be reached by the process variable. An error e(t) due to the difference between the set point and the process variable is given to the controller to cause a control action with a control signal u(t). Finally, the control signal is fed to the plant to obtain the output y(t) [3].
r(t)
Set Point

e(t) CONTROLLER

u(t)

PLANT/ PROCESS

y(t)
Process Variable

Fig. 1. Block diagram of closed-loop control system. In order to realize the closed loop control system, home-made PIC 16F877 microcontroller-based temperature controller and a plant were developed as depicted in Fig. 2. The plant is a plastic box enclosing a dc lamp and a dc fan. The lamp acts as a heater, which heats air in the plastic box. The heat is drained to the ambient by the action of the fan and

Proceedings of the 3rd WSEAS/IASME International Conference on Educational Technologies, Arcachon, France, October 13-15, 2007

423

the air temperature becomes lower. The temperature sensor is located in the plastic box.

Plant

RS232

temperature sensor, in which the measured temperature is converted to voltage [6]. Since maximum output voltage of the LM35 sensor is 1 V and the ADC of the microcontroller uses the reference voltage of 5 V, a signal conditioning circuit is required between the sensor and the ADC. The PWM1 and PWM2 of the microcontroller are used to drive circuits which switch the lamp and fan on and off, respectively. The RS232 serial communication is utilized to send data to be processed further in the personal computer (PC). The proportional (P) control action was selected for the temperature controller because it is not more complicated than the proportional-integraldifferential (PID) one to be implemented in the PIC 16F877 microcontroller. The control signal u(t) of the P controller is written as [3]
Umax ; e( t ) > emax u( t ) = U0 + K Pe( t ); emin < e( t ) < emax U ; e( t ) < e , min min

Controller
(a)

(1)

LCD

PC

1 potentiometer & 2 push buttons

RS232

where U0 is the control signal when e(t)= 0 and KP is the proportional constant or gain. As shown in Fig. 3, the characteristic of P control action is defined by a proportional band (PB), which is written as
PB = 100 100% . KP

PIC16F877 Signal conditioner PWM2 ADC RISC CPU PWM1

(2)

Sensor Fan

Lamp Driver Lamp Fan Driver

Plant

(b) Figure 2. (a) Photograph of PIC 16F877 microcontroller-based temperature control system and (b) its block diagram. The main part of the temperature controller is the PIC 16F877 microcontroller of Microchip Technology, Inc., which consists of a high performance central processing unit (CPU), two pulse-width modulators (PWMs) and a 10-bit analog to digital converter (ADC) [4]. It allows inputs from a potentiometer and 2 buttons that give a set-point temperature and other parameters for a control action and support system operation menu. It presents the set-point and measured plant temperatures as well as process parameters by using a 2x16-character LCD [5]. The air temperature in the plant is sensed by employing the LM35

Figure 3. Characteristic of P controller. Program implemented on the PIC 16F877 microcontroller to perform a temperature control with a proportional control action is explained by the flowchart given in Fig. 4. In the initialization step, the controller configurations and functions are defined. Since the process variable PV is the air temperature in the plant, the set point SP is the desired air temperature. The set point SP, the proportional constant KP, and the permissible error A are entered by pressing the two buttons and rotating the potentiometer. Next, the microcontroller reads PV, calculates the error e(t), and obtains the control signal u(t) to update the duty cycles of the

Proceedings of the 3rd WSEAS/IASME International Conference on Educational Technologies, Arcachon, France, October 13-15, 2007

424

PWMs in order to change the air temperature in the plant. The error value is checked; if e(t) is still higher than A, then the proportional control action is repeated. Otherwise, the control action stops.

The heat transfer rate due to the change in temperature of a material is written as [7]

dQ dT = mmc m m , dt dt

(3)

where mm and cm are the mass and the specific heat capacity of the material, respectively. A heat transfer occurs from the air to the plastic box with the rate dQ (4) = A1h1(Ta Tb ) , dt where A1 is the contact area between the air and plastic box and h1 is the heat transfer coefficient from the air to the box. From Eqs. (1) and (2) we find that
ma c a dTa = A1h1(Ta Tb ) , dt

(5)

where ma and ca are the mass and specific heat capacity of the air, respectively. The heat transfer also takes place between the air and plastic box as well as between the plastic box and the ambient. The heat transfer rate is
dQ = A1h1(Ta Tb ) A 2h2 (Tb To ) , dt

(6)

Figure 4. Flowchart of proportional control action.

3 Obtaining Air Temperature in the Plant


The thermal plant modeled as a second-order lumped-element thermal system is depicted in Fig. 5. The state variables of the lumped-element thermal system are Ta and Tb, where the air and box temperatures, respectively. The inputs to the thermal system are heat Q(t) delivered by the heater and the ambient temperature To.

where A2 is the contact area between the plastic box and ambient and h2 is the heat transfer coefficient from the plastic box to the ambient. From Eqs. (3) and (6) we also find
mbc b dTb = A1h1(Ta Tb ) A 2h2 (Tb To ) , dt

(7)

plastic box heater Q(t) air Ta

Tb

ambient

To

Figure 5. Lumped-element thermal system.

where mb and cb are the mass and specific heat capacity of the plastic box, respectively. The output of interest is Ta(t). The students can obtain Ta(t) easily by either solving directly or taking Laplace transforms of Eqs. (5) and (7). By obtaining Ta(s), which is the Laplace transform of Ta(t), the students then can design a closed-loop control system without difficulty. Alternative approach that can be done by the students is to conduct experiments by employing the temperature control system. Figures 6 and 7 illustrate the closedloop response of the temperature control system with two different KPs and the set point of 80 oC. It is seen that there is high steady state error (around 11 oC) for KP= 2. When KP is increased to be 100, the steady state error becomes less than 3 oC. By

Proceedings of the 3rd WSEAS/IASME International Conference on Educational Technologies, Arcachon, France, October 13-15, 2007

425

correlating the closed loop response to the proportional band PB defined by Eq. (2), the students can find that the smaller the PB the better the closed-loop response.

4 Conclusion
We have made a temperature control system, which consists of a microcontroller-based controller and a thermal plant, for helping undergraduate students to learn control system. The plant is a plastic box enclosing a lamp, a fan as well as a temperature sensor. The lamp heats the air in the plastic box and the heat is drained to the ambient by the fan. The controller is based on the PIC 16F877 microcontroller with the proportional control action. It was shown that high steady state error occurs for small proportional constant or gain and the increase of the gain results in low steady state error. In addition, the positive steady state error indicates that the lamp is working to increase the heat in the plant while the negative one implies that the heat is being exhausted to the ambient by the fan.

Figure 6.Closed-loop response with KP=2 and set point of 80 oC.

Acknowledgement
Financial support for presenting this paper by the B Program (Promoting Excellence) of Institut Teknologi Bandung, which is sponsored by the Directorate General of Higher Education, the Ministry of National Education of the Republic of Indonesia is acknowledged. References: [1] See Festo Didactic Home Page at www.festodidactic. com/int-en/ [2] See Leybold Didactic Home Page at www.leybold-didactic.de/data_e/index.html [3] K. Ogata, Modern Control Engineering, Prentice-Hall, New Jersey, 1997. [4] Microchip Technology Inc., PIC16F87X 28/40Pin 8-Bit CMOS Flash Microcontrollers Datasheet, (2001). [5] China Optotech Co., Ltd., Specification for LCD Module ADT-1620V02. [6] National Semiconductor Corp., LM35 Precision Centigrade Temperature Sensors Datasheet, (2000). [7] Y. A. engel and M. A. Boles, Thermodynamics: An Engineering Approach, 4th ed., McGraw Hill, Boston, 2002.

Figure 7.Closed-loop response with KP =100 and set point of 80 oC. The students can also observe that the steady state error shown in Fig. 7 has negative or positive value. Since the temperature control system has two actuators, the positive steady state error means that the lamp is working to increase the heat in the plant while the negative one implies that the fan is doing to drain the heat to the ambient.

You might also like