Documente Academic
Documente Profesional
Documente Cultură
1. ABSTRACT. Fuzzy techniques have been fuzzy logic solutions are usually not aimed at
successfully used in control in several fields, and achieving the computational precision of traditional
engineers and researchers are today considering techniques, but aim at finding acceptable solutions
fuzzy logic algorithms in order to implement in shorter time.
intelligent functions in embedded systems. We Fuzzy logic enables users to implement intelligent
have started to develop a set of teaching tools to functions in embedded systems. Typical fuzzy
support our courses on intelligent control. Low cost logic applications are being used to enhance
implementations of didactic systems are existing products with intelligent functions that
particularly important in developing countries. In allow for better adaptation to user requirements.
this paper we present the implementation of a For instance, we can find fuzzy control algorithms
minimal PD fuzzy four-rule algorithm in a low-cost in washing machine control, automatic focusing
8-bit microcontroller, using a fuzzy logic software control, servo motor force control, and many other
development system. On this ground we devices [2]. A primary advantage of an embedded
constructed a stand-alone fuzzy controller for a fuzzy logic control system is that even complicated
didactic liquid level system. We describe the functions can be implemented using the limited
methodology we followed, and present simulation resources of a low-cost general use
and real time results of this controller. microcontroller, instead of an ASIC device or a
dedicated fuzzy microcontroller.
2. INTRODUCTION. Low cost implementations are particularly
Fuzzy logic is a natural, continuous logic patterned attractive in the case of didactic systems for
after the approximate reasoning of human beings. universities of developing countries, where
It is a computational paradigm originally resources can be rather scarce. We are building up
developed in the early 1960s [1]. Fuzzy logic a set of teaching tools to be developed and
allows for partial truths and multivalued truths. It is employed in our courses on intelligent control in
therefore especially advantageous for problems that both our bachelors and masters' programs on
cannot be easily represented by mathematical Electronics Engineering . The fuzzy
modelling because data is either unavailable, microcontroller reported in this paper is our first
incomplete, or the process is too complex. The step in this direction.
real-world language used in fuzzy control enables To the purpose of implementing fuzzy logic control
engineers to incorporate ambiguous, approximate systems in low-cost microcontrollers, we consider
human logic into computers. Using linguistic the smallest possible fuzzy controller, consisting of
modeling, as opposed to mathematical modelling, two inputs, error and change of error ( rate for
greatly simplifies system design and modification. short ), one output, and four fuzzy control rules.
It generally leads to quicker development cycles, The relation between PD controllers and this
easy programming, and fairly accurate control. minimal four rules fuzzy controller has been
However it is important to underline the fact that established in [3]. The four rules fuzzy algorithm
153
Instituto Tecnolgico de Chihuahua ELECTRO 2001
has been successfully used in real time MIMO fuzzy PD controller, originally presented in
applications. In [4], for instance, it was applied to [9].
swing-up an underactuated two-link mechanism. The structure of this MIMO fuzzy PD controller,
There is a wide range of fuzzy logic which is a continuous - time controller, is based on
implementation alternatives [5]. We decided to the two inputs, one output controller shown in
achieve a software implementation on a low-cost Figure 1, from which it can be seen that
general use microcontroller. To this purpose we u (t ) = K u u * (t )
chose the PIC16C711 microcontroller [6] . In this
endeavor we used the fuzzyTECH-MP Explorer [7], (2.1)
which is a fuzzy logic software development where K u is a fuzzy control gain determined by
system for PIC16/17 microcontroller devices. the designer and u * (t ) is the output of the fuzzy
fuzzyTECH-MP Explorer is a limited version of the
fuzzyTECH-MP Edition that allows for the controller.
definition of fuzzy logic rules with a maximum of
Set
two input variables and one output variable. It is point Fuzzify . u y
Ke u*
necessary to develop several assembly code Control
routines to provide for system gains, analog to de/dt
Kr Rules . Plant
rate Defuzzify .
digital conversion, and some other functions
required by the fuzzy control algorithm. We used
the MPLAB [8], which is an integrated
Fig. 1. Fuzzy PD Controller.
development environment for the Microchip
PIC16/17 microcontrollers, to construct, integrate
this code with the fuzzyTECH supplied kernel, and The two inputs are: the error signal e(t ) and its
simulate it. MPLAB was also used to implant the
code into the chip. rate of change e(t ) ; the only one output, u(t), is
We applied the procedure described here (above or fed to the controlled process. Membership
below) to develop a stand-alone fuzzy controller functions are shown in Figures 2 and 3
around the PIC16/17 microcontroller for an respectively, where the same membership function
experimental liquid system. This is a relatively
simple system which requires a two input - one is applied for both e(t ) and e(t ) for simplicity. To
input controller. The stand-alone fuzzy controller employ the same membership function on two
works with a minimal PD fuzzy four rules inputs, two scaling factors, k p and k d , are used to
algorithm embedded in a PIC16C711
microcontroller. We present simulation as well as magnify e(t ) and e(t ) . L and H are two positive
real time results of the system. The fuzzy constants to be determined.
microcontroller showed a satisfactory performance.
The paper is organized as follows : In Section 2 Ke* negative Ke* positive error
error Kr*negative rate
we briefly discuss the minimal fuzzy four rules
10
controller. In Section 3 we describe the assembly
code construction process for the PIC16C711 using
fuzzyTECH-MP Explorer and MPLAB [8]. The
didactic liquid level system is described in Section
Ke*erro
4. Section 5 describes the main points of the r
process for assembler code integration and Kr*rate
Fig. 2 Input membership functions.
construction of a stand-alone fuzzy controller for
this plant. We show real-time results in Section 6.
Conclusions and future work are presented in Negative Zero output Positive
Section 7. 10
154
Instituto Tecnolgico de Chihuahua ELECTRO 2001
Fig. 4. The minimal fuzzy algorithm in the fuzzyTECH project editor window.
155
Instituto Tecnolgico de Chihuahua ELECTRO 2001
156
Instituto Tecnolgico de Chihuahua ELECTRO 2001
voltage / current
current / pressure
5V
Control signal
-5V 0-10 volts
10V
-10V
GND
Reference signal
32.75 or 64.5
Personal Computer
157
Instituto Tecnolgico de Chihuahua ELECTRO 2001
Remarks :
fuzzyTECH and MPLAB are registered trademarks of
Inform Software Corporation.
PIC is a registered trademark of Microchip Technology
Inc. in the U.S.A.
MATLAB/SIMULINK is a simulation tool developed
and distributed by The Mathworks Inc., 24 Prime Park
Way, Natick, Mass. 01760; http://www.mathworks.com
IBM and PC are registered trademarks of International
Business Machines Corporation.
Fig. 11. Real time results 8. REFERENCES .
[1] L.A. Zadeh, Fuzzy sets, Information and Control,
vol. 8, pp. 338-353, 1965.
Fig. 12. Numeric real time results [2] J. Yen, R. Langari, and L.A. Zadeh, Industrial
Applications of Fuzzy Logic and Intelligent Systems,
IEEE press, USA,1995.
Reference Real time value [3] H. Ying, and W. Siler, "Fuzzy Control Theory: A
( set point ) Nonlinear Case", Automatica, Vol.26, No.3, pp. 513-
520, 1990.
64.5 cm 64.2 cm [4] E. Snchez, L.A. Nuo, Y.-C. Hsu, and G. Chen,
"Real Time Fuzzy Control for an Underactuated
32.75 cm 33.0 cm Robot", IV Joint Conference on Information Systems,
Research Triangle Park, N.C., U.S.A., 1998.
[5] A. Costa, A. De Gloria, P. Faraboschi, A. Pagni, G.
7. CONCLUSIONS . Rizzotto, "Hardware Solutions for Fuzzy Control",
Proc. IEEE, Vol. 83, No. 3, pp. 422-434, 1995.
We have started to build a set of didactic tools to
[6] fuzzyTECH-MP, User's Guide, Microchip
support our courses on intelligent control. As a
Technology Incorporated, USA, 1994.
first step we have
[7] PICmicro Mid-Range MCU Familiy Reference
undertaken the construction of a fuzzy
Manual , Microchip Technology Incorporated,
microcontroller. In this approach we have taken
USA, 1997.
into consideration low cost implementations [8] "MPLAB IDE, Simulator, Editor. USER'S
which are particularly attractive for educational GUIDE", Microchip Technology Incorporated,
purposes in developing countries. We USA, 1996.
implemented a minimal fuzzy four rules control [9] Y. Hsu, G. Chen, E.N. Sanchez, "A fuzzy PD
algorithm in a low-cost microcontroller, and built analysis for multi-link robot control: Stability
a stand-alone fuzzy controller for a didactic liquid analysis", Proc. 1997 IEEE Intl. Conference in
level system. We selected the PIC16C711 as the Robotics and Automation, pp 1412-1317,
target microcontroller. We used the fuzzyTECH- Albuquerque, New Mexico, USA, April 1997.
MP Explorer software development system to
implement the basic fuzzy control algorithm, and
MPLAB IDE for the design of auxiliary assembly
code routines and integration of the whole system.
The code for the liquid level system controller
required only 537 bytes of program memory.
Sample time must not be less than 15
microseconds. The real time performance of the
fuzzy autonomous controller is very satisfactory.
Based on this experience, the controller can be
easily reprogrammed and adapted to other control
tasks. As future work we consider to apply the
158