Temperature Control System Using Fuzzy Logic Techn
Temperature Control System Using Fuzzy Logic Techn
Abstract—Fuzzy logic technique is an innovative technology used “partially false”. This makes the logic not to be directly
in designing solutions for multi-parameter and non-linear control processed on computers but must be emulated by special codes.
models for the definition of a control strategy. As a result, it
delivers solutions faster than the conventional control design A fuzzy logic based design control system offers flexibility
techniques. This paper thus presents a fuzzy logic based- in system design and implementation, since its implementation
temperature control system, which consists of a microcontroller, uses “if then” logic instead of sophisticated differential
temperature sensor, and operational amplifier, Analogue to equations. Its technology provides room for graphical user
Digital Converter, display interface circuit and output interface interface, which makes it understandable by people who do not
circuit. It contains a design approach that uses fuzzy logic have process control backgrounds. Another key significance of
technique to achieve a controlled temperature output function. a fuzzy logic-based control design is the ability to
automatically and smoothly adjust the priorities of a number of
Keywords- Fuzzy logic; microcontroller; temperature sensor; controlled variables [2]. Finally, it helps to achieve a process
Analogue to Digital Converter (ADC). that is stable for a long period of time without a need for
intervention.
I. INTRODUCTION
Human brain has an imprecise way of reasoning and thus However, because of the rule-based operation of fuzzy
has a high adaptive control approach. It does not reason as systems, any reasonable number of inputs can be processed and
computers do. Computers reason in a clear statement that uses numerous outputs generated; although defining the rule-base
true or false (0 or 1) - an element is either a number of a given quickly becomes complex if too many inputs and outputs are
set or it is not. choosen for a single implementation, since rules defining their
interelations must also be defined.
There are many complex systems which do not fit into the
precise categories of conventional set theory. This is because of There are countless applications of fuzzy logic. In fact
the fact that there is no way to define a precise threshold to many researchers still claim that fuzzy logic is an
represent their complex boundary, and as such their control encompassing theory over all types of logic [3].
system is complex. Fuzzy logic was developed owing to this Fuzzy logic can control non-linear systems that would be
imprecise nature of solving control problems by computer. In a difficult or impossible to model mathematically. This opens
fuzzy logic-based system, a variable can take any truth value door for control system that would normally be deemed
from a close set [0, 1] of real numbers thus generalizing unfeasible for automation.
Boolean truth values [1]. But the fuzzy facts are true only to
some degrees between 0 and 1, and they are false to some There are many approaches to implement fuzzy logic
degrees. Human brains work with fuzzy patterns. But systems; they can be software only, hardware only or the
computers cannot do so because its logic is based on combination of software and hardware. In recent years, fuzzy
approximate reasoning in a more familiar Boolean forms of logic has been implemented using several technologies to solve
logic used in conventional set theory. Fuzzy logic allows the real world problems such as image processing, robotics/motion
use of labels like “slightly”, “moderately”, medium, and “very” control, pattern recognition, fuzzy database and industrial
so that statements may be made with varying degree of engineering applications. Fuzzy logic is also spreading
precision. This flexibility is useful in coping with the applications in the field of telecommunications, particularly in
imprecision of real-world situations such as designing precision broad band integrated networks, based on ATM Technology
environmental control systems. [4].
In a broad sense, fuzzy logic refers to fuzzy sets - a set with II. ANALYSIS
non-sharp boundaries. In this paper, microcontroller was used to implement a
Fuzzy logic is widely used in machine controls, as it allows fuzzy logic-based temperature control system.
for a generalization of conventional logic and provides for The system is aimed at controlling the temperature of an
terms between “true” and “false”, like “almost true” or environment by regulating a heater and the speed of a fan. The
27 | P a g e
www.ijarai.thesai.org
(IJARAI) International Journal of Advanced Research in Artificial Intelligence,
Vol. 1, No. 3, 2012
Microcontroller has to make decisions based on external processing stage then combines the results of the rules; and
temperature condition. The variable “temperature” which is finally the output stage converts the combined result back to a
inputted on the system can be divided into a range of states specific control output value.
such as “Cold”, “Cool”, “Moderate”, “Warm”, “Hot”, “Very
hot”. Defining the bounds of these states is a bit tricky. The processing stage is based on a collection of logic rules
in the form of If-Then statements, where the IF part is called
An arbitrary threshold might be used to separate “warm” the “antecedent” and the THEN part is called the “consequent”.
from “hot”, but this would result in a discontinuous change Typical fuzzy control systems have dozens of rules [6].
when the input value passes over that threshold. The way to
make the states “fuzzy” is to allow them change gradually from Consider a rule for a thermostat, IF (temperature is “cold”)
one state to the next. The input temperature states can be Then (heater is “high”).
defined using “membership functions” as in figure 1. This rule uses the truth value of the “temperature” input
which has truth value of “cold” to generate a result in a fuzzy
Cold Cool Nominal Warm Hot set for the “heater” output, which has truth value of “high”.
1 This result is used with the results of other rules to finally
generate the crisp composite output. Obviously, the greater the
truth value of “cold”, the higher the truth value of “high”,
0 though this does not necessarily mean that the output itself will
T1 T2 T3 T4 T5 T6 be set to “high” since this is only one rule among many.
T0
In some cases the membership functions can be modified
Fig. 1: Temperature input membership function by “hedges” using “about”, “near”, “close to”,
With this scheme, the input variable state no longer jumps “approximately”, “very”, “slightly”, “too”, “extremely” and
abruptly from one state to the next. Instead as the temperature “somewhat”. The operations of these may have precise
changes, it loses value in one membership function while definitions, though the definitions can vary considerably
gaining value in the next. between different implementations.
The input variables in a fuzzy control system are mapped IV. FUZZY LOGIC VERSES CONVENTIONAL CONTROL
by sets of membership functions, known as “fuzzy sets”. The METHODS
process of connecting a crisp input value to a fuzzy value is Fuzzy logic incorporates a simple rule-based IF X and Y
called fuzzification. A fuzzy-based control system can also Then Z approach to solve a control problem. The fuzzy logic
incorporate the analog inputs of 0, 1 into its fuzzy functions model is empirically-based, relying on operational experience
that are either one value or another [5]. rather than technical understanding of the system. For example,
Given “mappings” of inputs variable into membership rather than dealing with temperature control in terms such as
functions and truth values, the microcontroller then makes “Temp < 1000F” or 210C < Temp < 220C”; terms like “IF
decision of what action to take based on a set of “rules” for (process is too cool) AND (process is getting colder) THEN
each of the form. For instance, if the external temperature is (add heat to the process)” or “IF (process is too hot) AND
warm, then the fan speed is not very fast, but heater is low. In (process is heating rapidly) THEN (cool the process quickly)”
this example, the input variable temperature has values defined are used. These terms are imprecise and yet very descriptive of
by fuzzy set. The output variables which are the speed of fan what must actually happen.
and heater temperature are also defined by a fuzzy set that can
V. MICROCONTROLLER-BASED FUZZY LOGIC
take values like “static”, “slightly increased”, “slightly
decreased”, and so on. A microcontroller-based fuzzy logic control system has a
fuzzy inference kernel and a knowledge-base. The fuzzy
The considerations to make are that: inference kernel is executed periodically to determine system
1) All the rules that apply are invoked using membership output based on current system input. The knowledge-base
functions and truth values obtained from the input to contains membership functions and rules.
determine the result of the rule. A programmer who does not know how the application
2) This result in turn will be mapped into a membership system works can write a fuzzy inference kernel. One
function and truth value controlling the output variable. “execution pass” through a fuzzy inference kernel generates
3) These results are combined to give a specific (crisp) system output signals in response to current system input
answer ie. the actual room temperature through a procedure conditions [7].
known as defuzzification. Fuzzification: The current input values are compared
against stored input membership functions, usually in a
III. FUZZY-BASED PROCESS USING “IF – THEN” program loop structure to determine the degree to which each
STATEMENT/RULE linguistic variable of each system is true.
Fuzzy-based control process consists of an input stage, Rule Evaluation: Processes a list of rules from the
processing stage and an output stage. The input stage maps knowledge-based using current fuzzy input values to produce a
sensor or other inputs such as switches, thumbwheels and so list of fuzzy output linguistic variable.
on, to an appropriate rule and generates a result for each. The
28 | P a g e
www.ijarai.thesai.org
(IJARAI) International Journal of Advanced Research in Artificial Intelligence,
Vol. 1, No. 3, 2012
System Inputs
Fuzzy Inputs
Fuzzy Outputs
System Outputs
Fig. 2: Block Representation of a Knowledge-Base and Inference Engine
Fuzzy Output: Considers raw suggestions for what the fuzzy inference kernel is executed periodically to determine
system output should be in response to the current input system outputs based on current system inputs. The
conditions. knowledge-base contains membership functions and rules. The
inference kernel is the engine of the microcontroller where
Defuzzification: Dissolves multiple degree ambiguous by fuzzification, rule evaluation and deffuzzification are done The
putting raw fuzzy outputs into a composite numerical output. display fuzzy output is done by the display unit, while the
VI. STRUCTURED ANALYSIS AND DESIGN METHOD fuzzy output interface aids in the transmission of deffuzified
signals to the system output [8].
Problem statements were formulated after attempting to
provide answers to problems noticed in the existing VII. INPUT SOFTWARE DESIGN (FUZZIFICATION)
physical/logic system: This input software design is the design of the fuzzification
1) How can non-linear system that is difficult to model process. This has to do with creating my fuzzy sets for each
mathematically be implored or implemented on control system fuzzy state. These sets are shown in table 1.
like temperature control?
TABLE 1: GENERATION OF THE FUZZY INPUT SETS
2) What kind of control system would be relatively
inexpensive and imprecise thus keeping the overall system cost S Fuzzy Sets (Representing Temperature Fuzzy
and complexity low? /N ranges in oC.) State
3) Can a control system inputs be easily altered or 1 Fuzzy set 1:{0,1, 2,3,…,10oC} Very
modified to improve system performance? Cold
The problem statements can now be answered using fuzzy
logic-based computer control system, which should have the 2 Fuzzy set 2:{11,12,13,…,21oC} Cold
following features: 3 Fuzzy set 3: {22,23,24,…,32oC} Warm
o
a) Ability to maintain the temperature of a room 4 Fuzzy set 4:{33,34, 35,…,43 C} Hot
automatically with the aid of devices like sensor, ADC, o
5 Fuzzy set 5:{44,45,46,…,100 C} Very Hot
microcontroller, etc.
b) Ability to achieve the maintenance of a room The table above represents the generation of fuzzy input
temperature by applying imprecise logic (fuzzy logic), where sets. Each of these sets is converted to its digital equivalent and
users define rules governing the target control system. coded into the Microcontroller. The microcontroller, through
c) Flexibility in implementing multiple input variables the comparator and ADC then checks whatever that is coming
and achieving a smooth control function output. out from the temperature sensor, with the already defined
The proposed logical/physical system with the problem boundaries and thus carries out the required fuzzy operation.
statement and the features of the new system (a fuzzy logic- The temperature range of the monitored chamber determines
based temperature control system) seems to meet the what instruction the controller will give to the output interface
requirement of the new system. devices. Each fuzzy output is determined by the fuzzy set
within which the observed temperature falls into.
The system inputs are variable inputs introduced into the
system with the aid of sensors (temperature sensors). These VIII. OUTPUT SOFTWARE DESIGN (DEFUZZIFICATION)/
sensors deliver signals to the ADC. The ADC circuit converts DISPLAY OUTPUT DESIGN
analogue signals to digital signal which the microcontroller
The defuzzification process has to do with decoding of the
understands. The microcontroller is the heart of the system. It
output of the fuzzy decision done by the microcontroller based
contains the inference kernel and the knowledge-base. The
29 | P a g e
www.ijarai.thesai.org
(IJARAI) International Journal of Advanced Research in Artificial Intelligence,
Vol. 1, No. 3, 2012
ADC
Microcontroller
Output Device
Fig. 3: A Block Diagram of a temperature control system using fuzzy Logic
on the fuzzy input sets and the fuzzy control algorithm. Here, (Very Cold1)
for each of the fuzzy sets, there is a display of the Elseif temperature falls within FUZZY SET2 then
corresponding temperature and the fuzzy state, which will Display the fuzzy state (Cold) on the LCD
simultaneously carry out the expected fuzzy output action in Call the Control Algorithm for fuzzy control to the
the monitored chamber. The output of the microcontroller is monitored chamber
relayed to the final output devices through the output interface (Cold1)
devices. The final fuzzy output devices are the AC fan which Elseif temperature falls within FUZZY SET3 then
serves as the cooler and AC heater. For the final fuzzy output, Display the fuzzy state (Warm) on the LCD
to increase the temperature of the monitored chamber for Call the Control Algorithm for fuzzy control to the
instance, the controller will have to increase the voltage of the monitored chamber
heater and vice versa. The same applies to reducing the (Warm1)
temperature of the monitored chamber. Table 2 shows the Elseif temperature falls within FUZZY SET4 then
results of the fuzzy decision carried out by the microcontroller Display the fuzzy state (Hot) on the LCD
and what actually takes place at the final output devices for Call the Control Algorithm for fuzzy control to the
each of the specified fuzzy states. monitored chamber
(Hot1)
TABLE 2: FUZZY DECISION BY THE CONTROLLER AND ITS EFFECT ON THE Elseif temperature falls within FUZZY SET5 then
FINAL OUTPUT DEVICES.
Display the fuzzy state (Very Hot) on the LCD
S Heater Voltage Cooler Voltage Fuzzy Call the Control Algorithm for fuzzy control to the
/N in (V a.c) in (V a.c) State monitored chamber
(Very Hot1)
1 220V 90V Very Cold
Endif
2 180V 130V Cold
THE BLOCK DIAGRAM
3 150V 150V Warm
The system block diagram is made up of the following
4 130V 180V Hot block items: the power supply unit, the temperature sensor, the
Analog to digital converter (ADC), the control system
5 90V 220V Very Hot
(consisting a microcontroller), the display unit, the fuzzy
control output interface and fuzzy output (consisting of the fan
THE PSEUDOCODE serving as the cooler and the heater). These subsystems are
Start integrated together to generate the final system. Figure 4 shows
Initialize all memory locations to their starting values the block diagram.
Display (Fuzzy logic Design by Isizoh A. N.) IX. CONCLUSION
Fetch temperature from ADC and compare with FUZZY SETs
If temperature falls within FUZZY SET1 then The development of a fuzzy logic control system is a way
Display the fuzzy state (Very Cold) on the LCD forward to the improvement of industrial automation. This area
Call the Control Algorithm for fuzzy control to the of control will also improve and advance the study of control
engineering in modern systems.
monitored chamber
30 | P a g e
www.ijarai.thesai.org
(IJARAI) International Journal of Advanced Research in Artificial Intelligence,
Vol. 1, No. 3, 2012
I
Fuzzy Logic Control Output
Fuzzy logic final output
Interface
device
(Temperature
Monitored chamber)
31 | P a g e
www.ijarai.thesai.org