Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
145 views

Design and Implementation of PID Controller For Motor Position Control

This document discusses the design and implementation of a PID controller for motor position control on an FPGA board. It describes using PID control to maintain the position of a DC motor at a desired angle, even when the input voltage varies. MATLAB simulations are used to tune the PID gains and estimate motor parameters. Then the PID controller is implemented on an FPGA board to control the motor position in hardware.

Uploaded by

Owais Ahmad Khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
145 views

Design and Implementation of PID Controller For Motor Position Control

This document discusses the design and implementation of a PID controller for motor position control on an FPGA board. It describes using PID control to maintain the position of a DC motor at a desired angle, even when the input voltage varies. MATLAB simulations are used to tune the PID gains and estimate motor parameters. Then the PID controller is implemented on an FPGA board to control the motor position in hardware.

Uploaded by

Owais Ahmad Khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

International Journal of Scientific & Engineering Research Volume 10, Issue 8, August-2019 429

ISSN 2229-5518

Design and Implementation of PID Controller for


Motor Position Control
Nu Nu Ye ,Khin Zaw Oo

Abstract— This research describes the design, simulation and implementation of PID controller for a DC motor position control on FPGA. Recently
“Field Programmable Gate Array” has become an alternative solution for the realization of Digital PID controllers. DC motor is controlled by the PID con-
troller. The main duty of PID controller is to obtain a desired response using the characteristics of Proportional (P), Integral (I) and Derivative (D) control.
Each control has its own specifications. So, the motor position could vary depending on a different control effects. Mostly, the motor position can be con-
trolled by changing rotation signal that contains Pulse Width Modulation (PWM). This paper presents the comparative study of P, PI and PID controllers
for the position control of the DC motor. PID controllers require exact system modeling if the system has parameter verification. In this paper, the chang-
es of output of DC motor will be described with MATLAB using PID controller. And then, according to the MATLAB result, the DC motor is implemented in
FPGA board with PID controller by hardware programming method.

Index Terms— PID controller, DC motor position control, FPGA board, Pulse Width Modulation (PWM), System modelling, Parameter
verification, MATLAB.

——————————  ——————————

1 INTRODUCTION

IJSER
T oday, there are many factories in the world in this era of tech-
nology and high technologies are developing to produce the best
quality products. Therefore, good performance machines are
2 OVERVIEW OF THE SYSTEM
also necessary. To get good performance, modern control systems The main object of this paper is to control the position of the DC
are needed. The idea of the position control system is to maintain the motor to get the desired angle. The angle of motor is variable when
position of the DC motor at the desired value under various condi- input voltage is applied. To get only the desired set-point angle of
tions. A number of control scheme such as proportional (P), propor- motor when input voltage is applied, the PID controller will really
tional integral (PI), proportional integral derivative (PID), adaptive need for that. PID attempts to correct the error between a measured
and fuzzy logic controller (FLCs) are used for control of position of process variable and a desired response. In this system, the PID algo-
DC motors. The proposed controller system uses the PID control for rithm that is added to the system becomes a closed loop system. A
position control of DC motor due to its simplicity, clear functionali- simulation using MATLAB software is implemented to tune PID
ty, applicability and PID controllers are used in more than 95% of algorithm by changing the value of Proportional gain (KP), Integral
the industrial process control applications. gain (KI) and Derivative gain (KD) to get desired response for DC
With technological advancement in the field of microelectronics, motor which is less overshoot and increase settling time.
new digital solutions such as FPGAs (Field Programmable Gate Ar-
ray) are available and can be used as targets for the implementation
of digital control algorithms. FPGA-based controllers offer ad-
vantages like high speed, complex functionality, low power con-
sumption and reducing the design cost of the system. Another
advantage of FPGA based platforms is their capability to execute
concurrent operations, allowing parallel architectural design of
digital controllers. Therefore, the FPGA based PID controller is
more flexible than general MCU such as PIC, ARDUINO etc.

————————————————

• Nu Nu Ye is currently serving in Faculty of Electronic Engineering in Fig. 1. Block Diagram of Overall System
University of Technology(Yadanarpon cyber City), Myanmar, E-mail: za-
woo.sp@gmail.com To verify the PID controller on FPGA, the value of PID gains
will also need. The motor parameters cannot get easily even from its
manufacturing factory. Therefore, the motor’s parameters have to
estimate to evaluate the PID gains from MATLAB Tuning. At the
end of the thesis, the position of the DC motor should be maintained
at the desire angle even the supply voltage is varied.
IJSER © 2019
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 10, Issue 8, August-2019 430
ISSN 2229-5518

In this proposed system, the degrees that the user selects will run
to the DC motor with the help of PID controller and the block dia-
gram for overall system can be seen in Fig. 1. This research provides
a detailed hardware design and procedure to build the system. DC
motor position is controlled by using FPGA Board with modern con-
trol system (PID). In this system, the quadrature encoder provides
the output signal of the DC motor.

3 SYSTEM DESIGN FOR MOTOR PARAMETER


ESTIMATION
The DC motor’s parameters are really needed to evaluate the
PID gains to implement the PID controller for that motor. And then
the motor parameters cannot get easily from online datasheet pdf.
Therefore, the DC motor’s parameters must be estimated using
MATLAB Identification Tool and Arduino Software.

3.1 Square Wave Production with Arduino Controller


The DC motor is made with coil so it has armature resistance
(R), armature inductance (L) and back Electromotive Voltage (Vb).
And then the DC motor has moment of inertia of the rotor (J) and
viscous friction (b) because DC motor is also movable device. These
Fig. 3. Flowchart for Square Wave Production in ARDUINO

IJSER
motor’s parameters cannot get easily from online and even manufac-
turing factory, Therefore, the Motor parameters will have to estimate
using MATLAB Simulink and ARDUINO Board since that parame- 3.2 Testing for Motor Parameter Estimation with
ters are needed when the PID gains are evaluated. In this design, Arduino and MATLAB
Pololu Gear Motor is mainly used.
Arduino UNO is used to drive the DC motor and to read the en-
coder outputs. Any microcontroller with 2 interrupt pins and 2 digital
outputs can be used instead.

Fig. 2. Circuit Diagram for Square Wave Production in ARDUINO


The Pololu Gear Motor has hall-effect sensor called quadrature
encoder and the typical voltage for encoder is 3.3V. The black and
red wires of motors are the power supply pins of motor. The blue pin Fig. 4. Results for Square Wave Production with Arduino Plotter
of motor is encoder supply pin and has power rating from 3.3 to 20V.
The green pin is encoder ground pin and the other two pins are quad- After the square wave has produced with ARDUINO, the data
rature encoder channel A and channel B. The channel A and channel such as motor’s speed, motor’s angle, estimationTimeCount, and
B of encoder is connected directly with interrupt pins (2 and 3) of current time are copied and paste Matlab Command Window and
ARDUINO Uno. The positive supply of the DC encoder is connected enter the following commands.
to 5V supply from ARDUINO Board. The motor driver L293 IC is p2 = tout(:,1);
used to control the motor. Therefore, the two inputs of driver are v2 = tout(:,2);
connected with pin7 and pin 8 of ARDUINO and the two outputs of u2 = tout(:,3);
driver are connected with motor power pins. t2 = tout(:,4);
Firstly, the square input are produced using ARDUINO UNO and Five variables J, b, R, L, K with initial guess are created for the
the results are shown in ARDUINO Serial Monitor. The flow chart parameters. Square input and square output signal are also created in
for square wave production with ARDUINO is shown in Fig. 3. Command Window which represents the experiments.
squareOutput = [t2, v2];
squareInput = [t2, u2];

IJSER © 2019
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 10, Issue 8, August-2019 431
ISSN 2229-5518

response can control to get more stability state.

4.1 Propotional Control Result


Running MATLAB m-file in the command window for closed
loop P-controller with motor transfer function is shown in Fig. 8 and
KP=4.3. It shows that the rise time becomes 0.0206 and the over-
shoot is 9.31% and the settling time is 0.0661 by small amount of
change. By using final value theorem, the steady state error is re-
duced to 1-0.986=0.014 since the final value of the output is 0.986.

Fig. 5. Creating Motor Parameters and Square Wave Data in Workspace

Fig. 8. P-Controller Step Response

IJSER
4.2 PI-Controller Control Result
Running MATLAB m-file in the command window for closed
Fig. 6. Simulink Model for Motor Parameter Estimation Process loop PI-controller with motor transfer function is shown in Fig. 9 and
KP=4.2 and KI=6.3. It shows that the rise time becomes 0.873 and
the overshoot is 3.57% and the settling time is 2.82 by small amount
of change. By using final value theorem, the steady state error is
reduced to 1-1=0 since the final value of the output is 1. So ess is
eliminated.1.

Fig. 7. Identification Results for Measured Data and Simulated Data


For measured data of DC motor, the motor parameters (J, K, b, L,
R) are assumed and tuned manually until the simulated data and
measured data are identical. When the simulated data and measured
data are equal, the actual value of DC motor’s parameters are ob-
tained. The estimated motor parameters are shown in Fig. 7.Finally, Fig. 9. PI-Controller Step Response
the internal parameters of Brushed DC motor are obtained from
Matlab Estimation Process as follows.
J=5.2363e-6 Kg. 4.3 PID-Controller Control Result
b=1.9557e-5 The simulation result for KP=4.835, KI=6.318 and KD=0.37116
K=0.010905 V/rad/s (or) N.m/A with MATLAB simscape library output plot is resulted, as shown in
R=1.9888 Ohm Fig. 10. It shows that the rise time becomes 0.944 and the overshoot
L=0.018601H is 1.96% and the settling time is 1.43 by small amount of change. By
using final value theorem, the steady state error is reduced to 1-1=0
4 SIMULATION TESTS AND RESULTS since the final value of the output is 1. So ess is eliminated.

The transfer function of motor position is used to check the sta-


bility using P control, I control, PI control and PID controller in
Matlab. By checking step by step, only the PID controller based step
IJSER © 2019
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 10, Issue 8, August-2019 432
ISSN 2229-5518

And the result is added to the controller by using hardware pro-


gramming with Verilog on FPGA platform. After that, motor power
pins, encoder pins and L293D motor driver are connected with
FPGA Board. In Fig. 12, setpoint of 45 degree testing can be seen.
After that, setpoints of 90 degree, 180 degree and 270 degree are
tested and error are shown in Table 1.

TABLE 1
Output Result and Error Analysis for Four Set Points
Set Current P- I- D- Error
point Value Gain Gain Gain
Fig. 10. PID-Controller Step Response
By comparing the results of P, PI and PID controllers in manual
45 44 4 5 0 2.2%
tuning result, PID controller is suited to implement this system.
Therefore KP=4, KI=5 and KD=0 are used in program for implemen- 90 89 4 5 0 1.2%
tation. 180 180 4 5 0 0%
270 269 4 5 0 0.4%
5 HARDWARE TEST AND RESULT OF MOTOR AND
FPGA BOARD 6 CONCLUSION
The hardware program for the implementation of motor control The proposed system has benefits. Since motor modeling is gen-
system with PID controller includes five sub modules in one main eral type, any type of motor can be modeled by knowing its parame-

IJSER
program. That sub modules are pid fsm module, display module, ters. The difficulties of the PID gain can be reduced because the de-
quadrature decoder, pwm module, frequency divisor module and tail facts of PID tuning methods are presented. The methods of im-
ROM for LCD display module. The program is testing with Quartus plementing PID controller with hardware programming method can
II software and implements the program with FPGA DE2-115 Board be known and easily implemented in real world. The FPGA based
and the result is shown in Fig. 11. implementation system is flexible than general MCU and it has rapid
prototyping. The usages of MATLAB software and Quartus II soft-
ware are studied for control systems.

ACKNOWLEDGEMENT
I am grateful to my teachers for providing me an opportunity to
do this research work. I am also special thanks for my pupils for their
help. I am deeply indebted to my parents and my husband, for their
support through out the period of work.

REFERENCES
[1] Allen Houng. “Interfacing a DC Motor with an FPGA”. Terasic Technolo-
gies.Aug10,2011
Fig. 11. Testing the Overall Program in Quartus II Software
https://www.scribd.com/document/213624403/Implementation-of-a-Pid-
Controller-Embedded-in-a-Fpga-for-Positioning-a-Dc-Motor.
[2] BM. Chen. Personal Course Website EG1108 Electrical Engineering Part 2-
Chapter 4:http://vlab.ee.nus.edu.sg/bmchen/courses/EG1108_DCmotors.pdf.
[3] Jose Carlos Gamozo-Real, Ernesto Vazquez-Sanchez and Jaime Gomez-Gil,
“Position and Speed Control of Brushless DC Motors Using Sensor less
Techniques and Application Trends”,
https://www.mdpi.com/1424-8220/10/7/6901/pdf.
[4] K.B.T.M. Khali, “PID controllers”.
http://ospid.com/blog/what-is-pid-control.
[5] Kemal ARI,Faik Tekin ASAL and Mert COSGUN,“P, PI, PID Controller”.
https://pdfs.semanticscholar.org/d149/c7ad9deba6d0f3a7a615a48fbd11fc16a
1a8.pdf.
Fig. 12. Result of 45 Degree Setpoint [6] Su Su Yi (Nov, 2015). “DESIGN AND SIMULATION OF SERVO MOTOR

IJSER © 2019
http://www.ijser.org
International Journal of Scientific & Engineering Research Volume 10, Issue 8, August-2019 433
ISSN 2229-5518

SPEED CONTROL USING PID CONTROLLER”. Pyin Oo Lwin, Myan-


mar: University of Technology-Yatanarpon Cyber City (UT-YCC).
[7] Yuen Fong Chan, M. Moallem, Member, IEEE, and Wei Wang, Member,
IEEE-2007. “Design and Implementation of Modular FPGA-Based-
PIDControllers”, https://ieeexplore.ieee.org/document/4271566.
[8] http://www.arduino.org/products/boards/arduino-uno.

IJSER

IJSER © 2019
http://www.ijser.org

You might also like