You are on page 1of 6

Journal of Scientific & Industrial Research

Vol. 65, February 2006, pp. 142-147

Implementation of fuzzy temperature control using microprocessor

M D Hanamane, R R Mudholkar, B T Jadhav and S R Sawant*


Department of Electronics, Shivaji University, Kolhapur 416 004

Received 27 March 2005; revised 21 October 2005; accepted 11 November 2005

Fuzzy Logic has been employed to control temperature by varying ON-time of heater through PPI 8255. Thermister is
used as a temperature sensor forming the resistive component of RC-Timer of IC 555 operated in novel Astable mode. The
actual temperature is read as a function of frequency and compared with corresponding count of set-point temperature. The
error-count is used to trigger the Fuzzy Inference process. This develops an overall duty for heater control that maintains the
temperature of furnace to the set value. The hardware implementation followed by flow chart depicting the software
approach has been given. The results are satisfactory when the duty cycle is around 50%.

Keywords: Duty cycle, Fuzzy logic, Microprocessor, Temperature control


IPC Code: G06N7/02; G05D23/00

Introduction kit with built-in port (IC 8255) and Counter/Timer (IC
Many chemical reactions, industrial processes and 8253) and Dimmerstat of Automatic Electric Ltd,
experiments require temperature to be maintained at Bombay, 0-230V AC, 15 A output (Fig. 2). Furnace
predetermined value1-3. There are many modes to (resistance, 10 Ω; operating voltage, 50 Volts; power,
regulate the temperature like ON/OFF, Proportional 250 W) is made up of aluminium chassis with ceramic
Derivative (PI), and Proportional Integral Derivative inside (Fig. 3). IC-555 used in a novel astable mode
(PID). Of late, Fuzzy Logic Control (FLC) has with thermister in the timing network forms the
become very popular over the Conventional Control sensor part. The output (pin-3) of IC-555 goes to the
Logic (CCL), mainly because the process of FLC is interrupt RST 7.5 used to count the pulses as function
simply to put the realization of human control of temperature.
strategy, where CCL heavily relies on the mathe-
matical formulations. In this study, FLC was used for (a) Micro Processor based Control Circuit
temperature control using microprocessor for a small Present experiment used 8085-based circuit to
furnace. implement the fuzzy controller. The I/O 8255 has
been used for the heater control operation while the
Fuzzy Control System and its Design temperature in the form of count was measured using
FLC incorporates temperature control4 as fuzzy the interrupt RST 7.5.
relation between the present temperature to be con-
trolled and the set-point (Fig. 1). The essence of (b) Zero Crossing Detector
Fuzzy Control Algorithm is the conditional statement In order to fire Triac exactly at zero point of the
between fuzzy input variable (present furnace tem- AC cycle, zero crossing detector has been employed
perature) and fuzzy output variable (heater current). (Fig. 4).

Hardware Details (c) Heater Control Circuit


Microprocessor based system comprises5-7 Port C of 8255 senses the output of detector and
Anshuman Classic, Pune make 8085 Microprocessor initiates firing on level change. Heater circuit used for
delivering power to the furnace is shown in Fig. 5.
_______________
Specifications of transistor were as follows: Type, BC
*Author for correspondence
Tel: 091-0231-2690571; Fax: 091-0231-2691533 147; Case, TO92; VCE, 45 V; VCB, 50 V; IC, 100 ma;
E-mail: srs600112@yahoo.com hfe, 110-800; and PD, 500 mW. Specifications for
HANAMANE et al.: FUZZY TEMPERATURE CONTROL USING MICROPROCESSOR 143

Fig. 4Zero crossing detector circuit

Fig. 1Schematic fuzzy controller

Fig. 5Heater control circuit using Opto-coupler and Triac

Triac were: Type, BT139; Case, TO220; VDRM, 500V;


IT (rms), 16 A; IGT, 50 ma; VGT, 1.5 V; and PG
(AV), 0.5 W.

Implementation of Fuzzy Logic Temperature


Controller
Step-1: Defining Inputs and outputs Variables
Universe of discourse for input and output8-12 is
Fig. 2Furnace details from room temperature to 100°C and PWM uses ON-

Fig. 3Hardware set up of temperature controller


144 J SCI IND RES VOL 65, FEBRUARY 2006

Table 1Universe of discourse for input and output variables


Characteristics Input/ Minimum Maximum
Output value value
Temperature sense, °C Input Room temp. 100
Duty cycle for PWM, % Output 20 80

Table 2Fuzzy variable for temperature Fig. 6Fuzzy membership function for temperature
S No Crisp input rangen Fuzzy variable name
°C
1 30 - 40 VVL
2 30 - 50 VL
3 40 - 60 L
4 50 - 70 LL
5 60 - 80 ML
6 70 - 90 N
7 80 - 100 H
Fig. 7Fuzzy membership function for count as temperature
sense
Table 3Fuzzy Variable for temperature sense
S No Crisp input range for count Fuzzy variable name Since temperature is sensed in terms of count, the
% crisp inputs to fuzzy controller are counts received by
1 104 - 123 VVLC controller. The following fuzzy sets for count have
2 104 - 138 VLC been used: VVLC, very very low count; VLC, very
3 123 - 152 LC low count; LC, low count; LLC, little low count; MC,
4 138 - 164 LLC medium count; NC, normal count; and HC, high
5 152 - 171 MC count (Table 3, Fig. 7).
6 164 - 180 NC
7 171 - 180 HC Step-3: Fuzzy Membership Functions for Outputs
Present study considered typically one output
time (20-80%) to control the heater circuit (Table 1). variable, which is percent duty cycle. It is necessary
Input temperature is sensed by thermister, which is to assign fuzzy memberships to output variable,
connected in novel astable multivibrator whose fre- similar to input variable. The following fuzzy sets
quency varies as a function of temperature. The count have been used for percent duty cycle: VVLD = very
corresponding to a particular temperature is measured very large duty cycle, VLD = very large duty cycle,
with the help of a microprocessor-based circuit and LD = large duty cycle, LLD = little large duty cycle,
the same is stored in a memory location. Micro- MD = medium duty cycle, ND = normal duty cycle,
processor acts as a FLC. Thus, count acts as an input SD = small duty cycle (Table 4, Fig. 8).
variable to FLC. By using rule base, FLC decides
output variable, which is percentage duty cycle. Step-4: Knowledge Representation
The temperature control policy is structurally
Step-2: Fuzzification of Input Variable formulated in terms of fuzzy-rules. The relevant
Input to FLC is temperature sensed. Triangular information of rules is stored in the database. Thus
membership functions have been used to fuzzify the knowledge base consists of Rule Base and Database.
input. For fuzzifier program, it is necessary to The Database contains the following information: (1)
determine range of fuzzy variables related to the crisp Labels of linguistic variables; and (2) Operating range
inputs. Temperature sensed as input variable is of variable.
restricted to positive values. The following fuzzy sets
have been used: VVL =very very low, VL=very low, Rule Base
L= low, LL=little low, ML= medium low, N= normal, The control policy of heater is structurally
H= high (Table 2, Fig. 6). formulated in terms of fuzzy rules as follows:
HANAMANE et al.: FUZZY TEMPERATURE CONTROL USING MICROPROCESSOR 145

Fig. 8Fuzzy membership function for the output % duty cycle

Fig. 9Fuzzy inference and height defuzzification

Table 4Fuzzy variable ranges for output % Duty cycle determined by fuzzification. Activation of each fuzzy
input variable will cause different fuzzy output rule to
S No Crisp input Fuzzy variable Fuzzy
range range for variable fire.
of temp. output name
°C % Step-5: Defuzzification of the Outputs
1 30 - 40 75 - 70 VVLD In order to control the duty cycle, a crisp tempera-
2 30 - 50 75 - 65 VLD ture reading is required. To arrive at single crisp
3 40 - 60 70 - 69 LD output, there are several methods of defuzzification.
4 50 - 70 65 - 55 LLD To obtain crisp value of duty cycle from clipped fuzzy
5 60 - 80 60 - 50 MD set, a height defuzzification has been employed
6 70 - 90 55 - 40 ND (Fig. 9). The crisp-duty cycle is given by:
7 80 - 90 50 - 40 SD q

∑P
r =1
(r )
m h(r )
If the temperature is Then Duty cycle is D* = q

H SD ∑h
r =1
(r )

N ND
ML MD where, q = number of fuzzy rules fired, Pm(r) = Peak
LL LLD value of rth clipped fuzzy set, and h(r) = height of rth
L LD clipped fuzzy set.
VL VLD
VVL VVLD Results and Discussion
The temperatures in case study are as follows: set
Here output and input to fuzzy rule base are fuzzy temperature, 80°C; and current temperature, 42.5°C.
variables. For any crisp input value, there may be For Rule Base, if temperature is L, duty cycle is LD;
fuzzy membership in several fuzzy input variables and for temperature VL, duty cycle is VLD.
146 J SCI IND RES VOL 65, FEBRUARY 2006

Table 5Performance of system at 80°C


Set Duty cycle Steady state temperature
% °C
I 60 98
II 55 87
III 50 81
IV 45 78
V 40 76

Table 6Performance of system at 50°C


Set Duty cycle Steady state temperature
% °C
I 70 80
II 65 78
III 60 65
IV 55 60
V 50 50

Rule Fired
Temperature VL with degree of satisfaction (DOS) = 0.72
Duty cycle VLD with DOS = 0.72
Temperature L with DOS = 0.28
Duty cycle LD with DOS = 0.28

Defuzzified duty cycle,


70 × 0.72 + 0.28 × 65
D* = = 68.6%
0.72 + 0.28
Similarly, data for different values of temperature
and corresponding defuzzified duty cycle is calculated
for Sets I-IV (Tables 5 & 6).
This program after initialization of 8255 as output
device calls the heater-on program and loads an initial
count corresponding to the room temperature
(Fig. 10). The comparison with the defuzzified count
corresponding to the set-point fires the rule and
accordingly ON and OFF times (counts) get modu-
lated till the set-point temperature is attained. At this
stage, defuzzified counts corresponding to the ON and
OFF times are evaluated and the heater power is
controlled to maintain the temperature constant. The
temperature is displayed and the process of tempe- Fig. 10System flowchart
rature control continues.
Conclusions was 5. It has been concluded that the temperatures are
To test the performance of system, two tempera- exactly near the set-point when duty cycle is 50%.
tures of 80°C (Table 5) and 50°C (Table 6) were Results are satisfactory if the set-point is higher
selected and tuning process was employed to select (80°C). The use of microprocessor though has certain
suitable duty cycle to get the temperature near the set- limitations in developing membership function and
point value. The scaling factor for the purpose of inference scheme, in the present study, a novel fuzzy
turning 1.072 and the width of temperature domain encoding is used in terms of counts.
HANAMANE et al.: FUZZY TEMPERATURE CONTROL USING MICROPROCESSOR 147

References 7 Motorola Opto Electronic Device Data (Motorola


1 Modi R K & Pal N R, Self tuning PD controller, IETE J Res, Semiconductor Product Inc.) 1981, 35-52.
44 (1998) 177-189. 8 Mudholkar R R & Sawant S R, Fuzzy logic build estimation
2 Williams B W, Power Electronics, Devices, Drivers, (FLTBE), Trans Indust Electron, IEEE, 49 (2002).
Applications and Passive Components (ELBS with Mc 9 Mudholkar R R, Sawant S R, Tengshe G G & Bagwan A B,
Millan) 1992, 123-200. Fuzzy Logic Transformer Design Algorithm (FLTDA), Active
3 Hantek E R, Applications of Linear Integrated Circuits (John and Passive Elec. Comp., vol 22 (Overseas Publishers
Wiley and Sons, N Y) 1975, 438-445. Association, N Y) 1999, 17-29.
4 Driankow D, Hellendoorn H & Reinfrank M, An 10 Klir G J & Yuan B, Logic Fuzzy Sets and Fuzzy (Prentice-
Introduction to Fuzzy Control (Narosa Publishing House, Hall of India, New Delhi) 1997, 11-338.
New Dehli) 1996,1-144. 11 Tanaka K, An Introduction to Fuzzy Logic for
5 Gaonkar R S, Microprocessor Architecture, Programming Practical Applications (Springer-Verlag, New York) 1997,
and Applications with 8085/8085A (Wiley Eastern Ltd, New 86-136.
Delhi) 1993. 12 Cox E, The Fuzzy Systems Handbook-A Practitioners Guide
6 Microprocessor Data Handbook (BPB Publications, New to Building, Using and Maintaining Fuzzy Systems (AP-
Delhi) 1989. Professional, Boston) 1998, 45-46.

You might also like