0% found this document useful (0 votes)
59 views5 pages

A Fast Realization Method of Fuzzy PID Control For DC Motor

This document summarizes a study that proposes a fast realization method of fuzzy PID control for DC motor speed regulation. The method combines conventional PID control with fuzzy control to adaptively tune the PID parameters. It designs fuzzy control logic in MATLAB and deploys the control algorithm on a Raspberry Pi hardware platform. Experimental results from hardware-in-the-loop testing validate that the fuzzy PID controller achieves better control performance than a conventional PID controller alone.

Uploaded by

boudiba
Copyright
© © All Rights Reserved
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)
59 views5 pages

A Fast Realization Method of Fuzzy PID Control For DC Motor

This document summarizes a study that proposes a fast realization method of fuzzy PID control for DC motor speed regulation. The method combines conventional PID control with fuzzy control to adaptively tune the PID parameters. It designs fuzzy control logic in MATLAB and deploys the control algorithm on a Raspberry Pi hardware platform. Experimental results from hardware-in-the-loop testing validate that the fuzzy PID controller achieves better control performance than a conventional PID controller alone.

Uploaded by

boudiba
Copyright
© © All Rights Reserved
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/ 5

Proceedings of the 37th Chinese Control Conference

July 25-27, 2018, Wuhan, China

A Fast Realization Method of Fuzzy PID Control for DC Motor


Wei-Jie Tang1, Shao-Yong Cao 1

1. School of Industrial Automation, Beijing Institute of Technology, Zhuhai, Guangdong 519088, China
E-mail: [email protected]

Abstract: DC motor is widely used in various fields for its good starting and speed regulating characteristics. In many cases, it is
necessary to control the speed of the motor accurately. Although the conventional PID control algorithm can solve most of the control
problems, the conventional PID control algorithm also has many defects, for example, parameters cannot adapt to the change of the
model. The fuzzy control does not rely on the mathematical model of the control system, and simulates the control experience of
human control, which has high robustness. In this paper, the fuzzy control is combined with the conventional PID control to control
the speed of the DC motor. PID parameters are adaptively obtained by fuzzy control rules. The control system model is set up in
Simulink, and the control algorithm is deployed on the hardware platform through the automatic code generation. Through the
hardware-in-the-loop (HIL) experiment, the algorithm is quickly verified.

Key Words: DC motor, Fuzzy PID, HIL Experiment, Automatic Code Generation

multivalued logic. However, in a wider sense fuzzy logic is


1 Introduction almost synonymous with the theory of fuzzy sets, a theory
DC motors are widely used, because they have these good which relates to classes of objects with unsharp boundaries
performances, such as good starting and speed regulation, in which membership is a matter of degree. Another basic
wide speed range, smooth load, strong overload capability, concept in fuzzy logic, which plays a central role in most of
little electromagnetic interference and low maintenance, so its applications, is that of a fuzzy if-then rule or, simply,
it is necessary to study the speed control of the DC motor. fuzzy rule. [1,2,3]
Conventional PID controllers have been well developed Fuzzy logic has the following characteristics
and applied for many years, and are extensively used for 1) Fuzzy logic is conceptually easy to understand.
industrial automation and process control today. The main 2) Fuzzy logic is tolerant of imprecise data.
reason is due to their simplicity of operation, ease of design, 3) Fuzzy logic can model nonlinear functions of
inexpensive maintenance, low cost, and effectiveness. In arbitrary complexity.
particular, it is applicable to a deterministic system that can 4) Fuzzy logic can be built on top of the experience of
be used to establish an accurate mathematical model. experts.
However, the actual control systems are nonlinear, time- 5) Fuzzy logic is based on natural language.
varying uncertainty, it is difficult to establish accurate 6) Fuzzy logic can be blended with conventional control
mathematical model, the application of conventional PID techniques.
controller cannot achieve the desired effect, but also by the Fuzzy control don't necessarily replace conventional
parameter tuning method of complicated problems, the control methods. Combining the fuzzy control with the
parameters of the conventional PID controller often have conventional PID control, the system can get better
poor setting, poor performance and poor adaptability to the performance. The fuzzy PID controller can be used in the
operating conditions. DC motor speed control system to get better control effect
Zadeh established the fuzzy system theory in 1965, and than the conventional PID controller. [4,5,6,7]
then the fuzzy system theory has been successfully applied. In this paper, a fast realization method of fuzzy PID
Compared with the traditional control theory, fuzzy control control algorithm is proposed. Using the fuzzy logic
has two incomparable advantages. First, fuzzy control can designer of MATLAB to design fuzzy control logic. The
effectively and conveniently realize human control strategy parameters of PID controller consist of two parts, one is the
and experience in many applications. Second, fuzzy control initial value which is Obtained by parameter self-tuning, and
can achieve better control without the mathematical model the other is dynamic value which is generated by fuzzy
of the controlled object, because the dynamic characteristics controller. Finally, the control algorithm is deployed on the
of the controlled object have been implicated in fuzzy hardware platform, and tested by HIL experiment. This
controller input and output fuzzy sets and fuzzy rules. method can save a lot of time and shorten the development
Fuzzy logic has two different meanings. In a narrow sense, cycle of the control system.
fuzzy logic is a logical system, which is an extension of

This work is supported by Zhuhai city mechanical engineering advantage


subject Fund Project under Grant No. 3200030/070/002/001.
This work is supported by school scientific research Fund Project of Beijing
Institute of Technology, Zhuhai under Grant No. XK-2018-29.

5131
2 System Structure 1) Not included in the fuzzy set A if ߤ஺ ሺ‫ݔ‬ሻ ൌ Ͳ (no
member).
The control system consists of a DC motor with an 2) Fully included if ߤ஺ ሺ‫ݔ‬ሻ ൌ ͳ (full member).
encoder and a Raspberry Pi 3 controller as well as a DC 3) Partially included if Ͳ ൏ ߤ஺ ሺ‫ݔ‬ሻ ൏ ͳ (fuzzy member).
motor drive and the power supply, as shown in Fig. 1.
3.2 Control System Model
Raspberry Pi is a popular, low-cost, credit card sized single-
board computer that supports embedded Linux operating In the process of control signals and the evaluation index is
systems. The combination of MATLAB and Raspberry Pi not easy to quantify, the effective way to solve this problem
can easily and quickly verify and deploy control algorithms. is fuzzy theory, using the basic theory and method of fuzzy
mathematics, the conditions of the rules and the operation of
the representation of fuzzy sets, and the fuzzy control rules
and evaluation index, initial PID parameters as the
Power supply knowledge stored in the knowledge base and according to
Battery the actual response of the control system, the optimal
Fuzzy PID
DC motor driver
adjustment of PID parameters automatically.
Power
supply The fuzzy PID control combines the conventional PID
WiFi wireless
communication
External mode control signal control with the fuzzy control. The overall concept of the
control scheme can be explained in the block diagram as
shown in Fig. 2.
The error e and the error change ec are used as the input of
Encoder signal the fuzzy PID controller. In operation, e and ec are
Raspberry PI 3
DC motor with encoder continuously checked. According to fuzzy control theory,
Fig. 1: System Structure three parameters are modified online to meet different
requirements of control parameters for different e and ec, so
A fuzzy PID control system model is designed in that the controlled object has good dynamic and static
Simulink. The model uses the I/O port of Raspberry Pi to performance.
collect the encoder signal of the DC motor and calculates the
ec
actual speed of the motor, and then compares it with the FUZZY
e
speed command to get the error signal and the rate of error CONTROLLER

change. The fuzzy PID control system model generates d/dt dKp dKi dKd
PWM control signal, and outputs it to the DC motor driver
through the I/O of Raspberry Pi, so that the motor speed can Ref Speed PID
DC MOTOR
Actual Speed
CONTROLLER
be controlled by controlling the voltage of the motor. The
data transmission between PC and Raspberry Pi by WiFi
wireless communication. Through the hardware-in-the-loop
experiment, the real speed of the motor can be viewed in real
Fig. 2: Control System Model
time.
Considering the stability, rapidity, overshoot and steady
3 Design of Fuzzy PID Controller state accuracy of the control system, the functions of Kp, Ki,
and Kd are as follows.
3.1 Concept of Fuzzy Set The role of Kp is to speed up the response of the system
and improve the precision of the system. The greater the Kp
The concept of fuzzy sets corresponds to the concept of the
value, the faster the response speed of the system, the higher
classical set. For a classical set A, the arbitrary element x on
the precision of the system, but it is easy to overshoot and
the domain E belongs to it or does not belong to it, as Eq. (1).
ͳǡ ‫ܣ א ݔ‬ even lead to the instability of the system. The smaller the Kp
ܺ஺ ሺ‫ݔ‬ሻ ൌ ቄ (1) value, the adjustment accuracy will be reduced, the response
Ͳǡ ‫ܣ ב ݔ‬
E is the domain,  ‫ ك‬, š ‫ ك‬, ܺ஺ ሺ‫ݔ‬ሻ is the characteristic speed of the system is slow, the adjustment time becomes
function of A. longer, and the dynamic and static characteristics of the
In classical sets, there are only two possible relationships system deteriorate.
between the element x and the set A, belonging to or not. The effect of Ki is to eliminate the steady-state error of the
There is no other case, but the fuzzy set extends the classical system. The larger the Ki is, the faster the static error is
set. eliminated. But if Ki is too large, the integral saturation
Fuzzy set is used to describe a set that does not clearly phenomenon will occur in the early stage of the response
define the boundary, that is, the element it contains can be process, which will lead to a larger overshoot. If the Ki is too
partially subordinate to this set. small, the static error of the system cannot be eliminated, and
The characteristics function of the classical set can only be the adjustment precision of the system is reduced.
{0, 1}, Zadeh expanded the scope, characteristics function The effect of Kd is to improve the dynamic characteristics
can be any number of [0, 1]. This type of characteristics of the system, mainly to predict the variation trend of the
function is called membership function, marked by ߤ஺ ሺ‫ݔ‬ሻ deviation in advance. If the Kd is too large, the response
ߤ஺ ሺ‫ݔ‬ሻ ‫ א‬ሾͲǡͳሿ process will be braking in advance, thus prolonging the
The set A determined by ߤ஺ ሺ‫ݔ‬ሻ is called a fuzzy set on E. adjustment time and reducing the anti-interference ability of
the system.
Let ‫ܣ א ݔ‬. Then x is called

5132
The output of the fuzzy controller is dKp, dKi, and dKd.
These three parameters change dynamically with the e and
ec according to the above rules.
The three parameters of the PID controller consist of the
initial value and the dynamic value, as follow
‫ܭ‬௣ ൌ ‫ܭ‬௣ᇱ ൅ ݀‫ܭ‬௣
‫ܭ‬௜ ൌ ‫ܭ‬௜ᇱ ൅ ݀‫ܭ‬௜
‫ܭ‬ௗ ൌ ‫ܭ‬ௗᇱ ൅ ݀‫ܭ‬ௗ
ᇱ ᇱ ᇱ
‫ܭ‬௣ ,‫ܭ‬௜ and‫ܭ‬ௗ are the initial value of the PID controller.
They can be automatically tuned by the method used in
paper [8]. In this paper, ‫ܭ‬௣ᇱ ൌ0.489, ‫ܭ‬௜ᇱ ൌ ͳʹǤͲͳ, ‫ܭ‬ௗᇱ ൌ Ͳ.
Fig. 6: Membership Function for dKp
3.3 Fuzzy Controller
The fuzzy controller is designed by fuzzy logic designer
in MATLAB, as shown in Fig. 3. When the design is
completed, a file named *.fis is generated, which contains
the designed fuzzy control rules. [9,10]

Fig. 7: Membership Function for dKi

Fig. 3: Design Fuzzy Controller

Fig. 4~Fig. 8 shows the membership function of e, ec, dKp,


dKi, and dKd. It is necessary to fuzzification of all the
variables. The linguistic variables for the input and output
set are Negative Large (NB), Negative Medium (NM),
Negative Small (NS), ZERO (ZO), Positive Small (PS),
Positive Medium (NM), and Positive Large (PB).
Fig. 8: Membership Function for dKd

The fundamental principles of regulating the parameters


of fuzzy PID controller are described as Table1, Table 2
and Table 3.

Table 1: The Fuzzy Rule Table of dKp


ec
dKp NB NM NS ZO PS PM PB
e
NB NB NB NM NM NS NS ZO
NM NB NM NM NB NS ZO ZO
Fig. 4: Membership Function for e
NS NM NM NS NS ZO PS PS
ZO NM NM NS ZO PS PS PM
PS NM NS ZO PS PM PM PM
PM ZO ZO PS PM PM PB PB
PB ZO PS PS PM PM PB PB

Table 2: The Fuzzy Rule Table of dKi


ec
dKi NB NM NS ZO PS PM PB
e
NB NB NB NM NM NM ZO ZO
Fig. 5: Membership Function for ec

5133
NM NB NB NM NM NS ZO ZO Create WiFi hotspot, connect Raspberry Pi and PC, keep
the data communication well. What needs to be noted is to
NS NM NM NS NS ZO PS PS
remember the IP address of the Raspberry Pi. In this paper,
ZO NM NS NS ZO PS PS PM the IP address of the Raspberry Pi is 192.168.8.100. Modify
PS NS NS ZO PS PS PM PM the run mode for external mode. When the control algorithm
PM ZO ZO PS PM PM PB PB
is deployed offline to the hardware, the run mode is normal
mode. By button Deployed to Hardware, the control model
PB ZO ZO PS PM PB PB PB automatically generates embedded code.

Table 3: The Fuzzy Rule Table of dKd


ec
dKd NB NM NS ZO PS PM PB
e
NB PS PS ZO ZO ZO PB PB
NM NS NS NS NS ZO PS PM
NS NB NB NM NS ZO PS PM Fig. 10: Fuzzy PID Simulink Model
ZO NB NM NM NS ZO PS PM After the design was completed, the experiment began.
PS NB NM NS NS ZO PS PS The first case is that the speed instruction is suddenly
increased from 50r/min to 150r/min, as shown in Fig. 11,
PM NM NS NS NS ZO PS PS
and the second is that the speed instruction is suddenly
PB PS ZO ZO ZO ZO PB PB reduced from 150r/min to 50r/min, as shown in Fig. 12.
Record the waveform of speed instruction, actual speed, Kp,
49 fuzzy control rules can be constructed from the above Ki, and Kd. From the experimental results, we can see that
three tables. For example: the Kp, Ki, and Kd values follow the dynamic change of the
If (e is NB) and (ec is NB) then (kp is NB)(ki is NB)(kd system, and the output of the system can follow the input
is PS) very well. The accuracy is high, there is no big overshoot,
4 HIL Experiment the dynamic performance is excellent, the adjustment time
is about 0.1s.
After the fuzzy controller is designed, the speed control
model of the DC motor is set up in the Simulink. The
hardware controller is Raspberry Pi 3, which has a CPU of
1.2GHz, 1GB RAM, rich interface, and supports WIFI and
Bluetooth communication. More importantly, the Raspberry
Pi can develop a variety of applications with MATLAB. Our
control system model as shown in Fig. 9.

Fig. 9: Fuzzy PID Control System Based on Raspberry Pi 3

The encoder signal of the DC motor is collected through


the GPIO17 pin of the Raspberry Pi, and then the actual
speed of the motor is calculated. The drive signal of the
motor is output from the GPIO4 pin of the Raspberry Pi. It
is important to note that the Raspberry Pi does not have
special hardware PWM output pins, but it can be
implemented by soft PWM. A PWM signal generator is
designed in this paper. The input signal of the model is the
duty ratio (0~1), and the output is the corresponding PWM
waveform. The speed instruction is given by a constant
module and can be modified online when the model is
running. Fuzzy PID simulink model as shown in Fig. 10. The Fig. 11: Result of the HIL experiment (Ref Speed from 50r/min
*.fis file, which is designed by the previous fuzzy controller, to 150r/min)
is loaded into the Fuzzy Logic Controller module.

5134
PID algorithm." Transactions of the Institute of Measurement
& Control 37.2(2015):164-176.
[5] Ma, Yongbin, Y. Liu, and C. Wang. "Design of Parameters
Self-tuning Fuzzy PID Control for DC Motor." International
Conference on Industrial Mechatronics and Automation IEEE,
2010:345-348.
[6] Abhinav, Rishabh, and S. Sheel. "An adaptive, robust control
of DC motor using fuzzy-PID controller." IEEE International
Conference on Power Electronics, Drives and Energy
Systems IEEE, 2013:1-5.
[7] Meza-Sanchez, I. M., et al. "Performance of a Simple Tuned
Fuzzy Controller and a PID Controller on a DC Motor
Application." Nonlinear Studies 14(2007):531 - 537.
[8] Wei-Jie Tang, Zhen-Tao Liu, Qian Wang. DC Motor Speed
Control Based on System Identification and PID Auto Tuning.
The 36th Chinese Control Conference, 2017: 6420-6423.
[9] MathWorks, MATLAB user’s guide, [Online], Available:
http://www.mathworks.com, The MathWorks, 2017.
[10] MathWorks,ĀFuzzy Logic Toolbox,āUser’s Guide, Version
2.3, 2017.

Fig. 12: Result of the HIL experiment (Ref Speed from 150r/min
to 50r/min)

5 Conclusion
Although the conventional PID control is a very efficient
control method, it still has some defects. Fuzzy control is not
dependent on the mathematical model of the control system,
which can be used to simulate human experience.
Combining the conventional PID controller and the fuzzy
controller, the fuzzy PID controller is obtained, which has
the advantages of both.
This article presents a fast realization method of fuzzy
PID control for DC motor. The definition and principle of
fuzzy control are described, and a DC motor speed control
system based on fuzzy PID is designed in
MATLAB/Simulink. And using Raspberry Pi 3 as the
controller, a hardware control system is set up. Through the
hardware-in-the-loop experiment, the designed control
algorithm is verifying very quickly. The experimental results
show that the fuzzy PID controller has good performance.
The mode of development of this control system is very
efficient and can greatly promote the research work.
In future research, it is necessary to analyze the fuzzy PID
controller deeply, and use different control systems to test it,
and study its robustness.
References
[1] Zadeh, L. A. "Fuzzy sets." Fuzzy Sets, Fuzzy Logic, & Fuzzy
Systems World Scientific Publishing Co. Inc. 1996:394-432.
[2] Zadeh, Lotfi A. "Fuzzy Logic." Computer 21.4(1988):83-93.
[3] Geering, Hans P. "Introduction to Fuzzy Control." Springer
Berlin 7(1998).
[4] Akbari-Hasanjani, Reza, S. Javadi, and R. Sabbaghi-
Nadooshan. "DC motor speed control by self-tuning fuzzy

5135

You might also like