Temperature Control Project

case studie

The aim of this case is to show how a complete temperature control system can be designed from the first principles. The design of a microcontroller based control system is described from modelling to the control of the process.


An electrical water heater is considered as the example process. The block diagram of the process is shown in next Fig. An electric heater is used to heat-up the temperature of water in a tank and the aim is to keep the temperature at the desired value. As shown in the figure, the water temperature is sensed using an analog Microcontroller D/A converter A/D converter Driver Sensor Heater Analog sensor Set point hardcoded inside the program Insulation integrated circuit sensor (LM35DZ). The sensor output is converted into digital form and compared with a stored desired temperature to form an error signal. A PI and a PID type controller algorithms will be implemented by the microcontroller in order to achieve the desired output. The output of the microcontroller is converted into analog form and this signal is used as an input to a driver circuit which provides power to the heater element. A PIC16F877 type microcontroller is used in this project. The reason for using this microcontroller is because of its A/D converter input and also Pulse Width Modulated (PWM) output, which is used to drive the heater element. PIC16F877 also has a large memory which is needed to implement floating-point arithmetic and the PI or the PID algorithm.

The mathematical model

The design of the controller will be based on the Ziegler–Nichols open-loop tuning method and thus an accurate mathematical model of the system is not normally required. It is however important to see what type of system we have as this may effect the decisions we make about the system.

Mathematical model of the tank

We can write the following heat-balance equation for the tank:

heat input to the system = heat increase in the system + heat losses


m1 = mass of the water inside the tank

m2 = mass of the tank

c1 = specific heat capacity of the water

c2 = specific heat capacity of the tank

Ignoring the heat loss through the walls of the tank and the heat capacities of the heater element and the mixer, we can write the following equations:

Heat increase in the tank = (m1c1 + m2c2)dT/t

Heat loss from the tank = hA(T − Ta)

Where, Ta the ambient temperature, A is the tank top area and h is a constant which depends on the surface and the ambient temperature.


E = (m1c1 + m2c2)dT/t+ hA(T − Ta)

If we assume that the ambient temperature is constant, and let

Tq = T − Ta

we can write equation above as:

E = (m1c1 + m2c2)dTq/t+ hATq

or, letting k1 = m1c1 + m2c2 and k2 = hA, and taking the Laplacetransforms,

Tq(s)/E(s)= 1/(sk1 + k2)

This equation describes a first-order system with time constant k1/k2. Temperature control systems always exhibit a transportation delay since it takes a finite time for the temperature of the medium to rise. The transportation delay time and the system parameters k1 and k2 will be determined from the step response tests described in next Section.

Mathematical model of the heater

Electrical heaters are usually difficult to control as they require large power.There are basically two methods to control heaters. These are:

a. Phase angle control

b. Pulse width modulation control

a. Phase angle control

This is one of the common methods of power control where the start of each half-cycle is delayed by an angle. Thyristors (or triacs) are usually used in such circuits and the triggering angle is varied in order to change the power delivered to the heater element. Above figure shows a typical thyristor based phase angle control circuit. Assuming that the heater has a pure resistance R, and the supply voltage has a peak value Vmax, it can be shown that the power delivered to the heater element is:

P = V2rms/R= V2max(π − α + 0.5sin2α)/2πR

b. Pulse width modulation control

In this method, the heater current is turned on an off as in a pulse width modulated waveform, where the period of the waveform is fixed but the ratio of the on-time.

Tags: ,,,,,