0% found this document useful (0 votes)
25 views7 pages

Sjeat 78 472-478

PID

Uploaded by

riyan.rmdhn1712
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)
25 views7 pages

Sjeat 78 472-478

PID

Uploaded by

riyan.rmdhn1712
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/ 7

Saudi Journal of Engineering and Technology

Abbreviated Key Title: Saudi J Eng Technol


ISSN 2415-6272 (Print) |ISSN 2415-6264 (Online)
Scholars Middle East Publishers, Dubai, United Arab Emirates
Journal homepage: https://saudijournals.com

Original Research Article

Real-Time PID Controller for a DC Motor Using STM32F407


Nguyen Le Thai1*, Nguyen Thi Kieu1
1
Faculty of Engineering & Technology, Nguyen Tat Thanh University, Ho Chi Minh City, Vietnam

DOI: 10.36348/sjet.2022.v07i08.007 | Received: 20.08.2022 | Accepted: 13.09.2022 | Published: 20.09.2022


*Corresponding author: Nguyen Le Thai
Faculty of Engineering & Technology, Nguyen Tat Thanh University, Ho Chi Minh City, Vietnam

Abstract
This paper presents a real - time model of the DC motor speed control system. The PID controller is used to estimate the
error between the actual speed and the set speed to adjust the Pulse - width modulation (PWM) inverter. The actual speed
is measured through the encoder that provides training and testing data for PID controller. Simulation results are
compared with the real-time results to address advantages and disadvantages of the system.
Keywords: PID Controller; DC motor; Speed control; Real-time model.
Copyright © 2022 The Author(s): This is an open-access article distributed under the terms of the Creative Commons Attribution 4.0 International
License (CC BY-NC 4.0) which permits unrestricted use, distribution, and reproduction in any medium for non-commercial use provided the original
author and source are credited.

1. INTRODUCTION controller and the Mathematical Model of DC Motor.


DC motors are widely used in machine tools, Section 3 presents the simulation results of the model.
printing presses, ans, pumps, hoists, robotics, Small DC Experimental results are given in Section 4 and
motors are mainly used in control devices and servo conclusions are summarized in Section 5.
motors for positioning and tracking. DC motors are also
used in many high- precision industrial applications 2. MODEL DESIGN
such as robot control, position control, steel mining and The model of DC Motor speed is presented in
paper and textile industries. Therefore, the study of Figure 1. Where, r(t) is desired speed, u(t) is the actual
motor speed control methods has received great speed of motor that is measured from speed sensor, e(t)
attention in recent years [1-3]. is the error between desired speed and real speed that is
transmitted to PID controller to stabilize the speed of
The proportional-integral-derivative (PID) the motor.
controller is widely used in industrial control processes
because of their simple structure and robust 2.1 PID Controller
performance. The design of a PID controller depends on The PID controller is defined by the following
three parameters which are proportional gain Kp, relationship between the controller input e(t) and the
integral time constant Ki and derivative time constant controller output u(t) that is applied to the motor as
Kd [4]. Many authors have used the Fuzzy Logic follows:
controller to automatically detect the parameters of Ki, ∫ (1)
Kp and Kd of the PID controller [5-7]. However, the use
of fuzzy controller will increase the complexity of the
system leading to increase product costs. In this Laplace transform of the equation (1) gives the
experiment, we detect the parameters Kp, Ki and Kd of transfer function G(s) as follows:
the PID controller corresponding to the used DC motor. (2)

In this paper, we first build a simulation model The discrete-time equation (2) expression is
of DC motor speed using PID controller by Matlab given as:
Simulink. And then we use Kit STM32F407, DC motor
∑ (3)
servo encoder and the necessary equipment to conduct
experiments.
Here, u(k) is the control signal, e(k) is the error,
The remainder of the paper is organized as Ts is the sampling period for the controller, and
follows. Section 2 describes theoretical basis of the PID .
Citation: Nguyen Le Thai & Nguyen Thi Kieu (2022). Real-Time PID Controller for a DC Motor Using STM32F407. 472
Saudi J Eng Technol, 7(8): 472-478.
Nguyen Le Thai & Nguyen Thi Kieu; Saudi J Eng Technol, Sept, 2022; 7(8): 472-478

Figure 1: The model of DC motor speed control using PID controller

2.2 Mathematical Model of DC Motor

Figure 2: Block diagram of DC motor

The dynamic behavior of DC motor is given constant, Jm is inertia of rotor, Bm is viscous damping,
by following set of relations [8] and its block diagram is Tm is developed motor torque, Tl is torque delivered to
shown in Figure 2. A simplified linear model is load, Td is disturbance torque, ra is armature resistance,
presented for this work ignoring the nonlinearities like L is armature inductance, Ia is armature current, and s is
the backlash and dead zones to simplify the application s-plane.
of metaheuristic techniques. Consider
By using (1) the transfer function of DC motor is
(4) ̇
(10)
(5)
̇ (6)
̇ 3. SIMULATION
(7)
In this section, simulation results are given to
(8) verify the convergence of the PID controller. The
(9) simulation model is shown as Figure 3.

Where, Ua is armature applied voltage, Ub is


back-emf, Km is motor constant, Kb is back emf

Figure 3: PID controller simulation model

© 2022 |Published by Scholars Middle East Publishers, Dubai, United Arab Emirates 473
Nguyen Le Thai & Nguyen Thi Kieu; Saudi J Eng Technol, Sept, 2022; 7(8): 472-478
The simulation parameters of DC motor are shown in Table 1.

Table 1: Parameters of DC motor


Parameter Values and Unit
R 1Ω
Kb 0.023 Kg-m/A
Kt 0.023 Vs/Rad
L 0.5 H
Jm 0.01Kgms2/Rad
Bm 0.00003Kgms/Rad

The simulation parameters of PID controller are shown in Table 2.

Table 2: Parameters of PID controller


Parameter Values and Unit
Ki 12
Kp 50
Kd 0.75
N 100

In this simulation, the speed motor is selected 200 rpm and 300 rpm. Figure 4 and Figure 5 show simulation
results of PID controller.

Figure 4: Simulation result at 200rpm

Figure 5: Simulation result at 300 rpm

4. EXPERIMENTAL RESULTS motor is used L298. The parameters of the PID


4.1 Experimental Model controller are selected at Table 3 and the control
Experimental model is shown in Figure 6. software using waijung library in matlab simulink
Where, microcontroller is selected STM32F407. The R2020b as shown in Appendix.
encoder DC motor is selected GA37 and driver DC

© 2022 |Published by Scholars Middle East Publishers, Dubai, United Arab Emirates 474
Nguyen Le Thai & Nguyen Thi Kieu; Saudi J Eng Technol, Sept, 2022; 7(8): 472-478

Figure 6: Experimental model: Missing

Table 3: Parameters of Discrete PID controller 4.2 Experimental Results


Parameter Values and Unit The experimental results are shown in Figure 7,
Ki 12 Figure 8, Figure 9 and Figure 10. Figure 7 and Figure 8
Kp 50 show results of PID control performance with two
Kd 0.75 different speeds of 200 rpm and 300 rpm, respectively.
Ts 0.01
Figure 9 provides the test results at the speed
increasing from 400 rpm to 500 rpm. Figure 10 shows
the test results at the speed increasing from 450 rpm to
550 rpm.

Figure 7: Experimental results for speed 200 rpm

Figure 8: Experimental results for speed 400 rpm

© 2022 |Published by Scholars Middle East Publishers, Dubai, United Arab Emirates 475
Nguyen Le Thai & Nguyen Thi Kieu; Saudi J Eng Technol, Sept, 2022; 7(8): 472-478

Figure 9: Experiment results for speed from 400 rpm to 500 rpm

Figure 10: xperiment results for speed from 450 rpm to 550 rpm

APPENDIX
A. Control program using waijung library.

B. Discrete PID Controller and Encoder reading function.

© 2022 |Published by Scholars Middle East Publishers, Dubai, United Arab Emirates 476
Nguyen Le Thai & Nguyen Thi Kieu; Saudi J Eng Technol, Sept, 2022; 7(8): 472-478

C. Program to read real speed of DC motor

5. CONCLUSIONS 2. Hassan, A. A., Al-Shamaa, N. K., & Abdalla, K. K.


This paper introduces a DC motor speed (2017). Comparative study for DC motor speed
control model using the PID controller. The main object control using PID controller. International Journal
of the paper lies in checking the actual speed of the DC of Engineering and Technology, 9(6), 4181-4192.
motor using Kit STM32F407 and waijung libraty. 3. Mohammed, J. A. (2011). Modeling, Analysis and
Experimental results show that the system works stably Speed Control Design Methods of a DC
for controlling small DC motors. Motor. Eng. & Tech. Journal, 29(1), 141-155.
4. Anderson, K. L., Blankenship, G. L., & Lebow, L.
REFERENCES G. (1998). A rulebased adaptive PID controlleR. In
1. Frayyeh, H. F., Mukhlif, M. A., Abbood, A. M., & Proc. 27th IEEE Con J Decision, Control, 564-569.
Keream, S. S. (2019). Speed control of direct 5. Akbari-Hasanjani, R., Javadi, S., & Sabbaghi-
current motor using Mechanical Characteristics. Nadooshan, R. (2015). DC motor speed control by
Journal of Southwest Jiaotong University, 54(4), 1- self-tuning fuzzy PID algorithm. Transactions of
9. the Institute of Measurement and Control, 37(2),
164-176.

© 2022 |Published by Scholars Middle East Publishers, Dubai, United Arab Emirates 477
Nguyen Le Thai & Nguyen Thi Kieu; Saudi J Eng Technol, Sept, 2022; 7(8): 472-478
6. Wang, T., Wang, H., Hu, H., Lu, X., & Zhao, S. International Electronics Symposium on
(2022). An adaptive fuzzy PID controller for speed Engineering Technology and Applications (IES-
control of brushless direct current motor. SN ETA) (pp. 179-184). IEEE.
Applied Sciences, 4(3), 1-16. 8. Richard, R. H. B., & Dorf, C. (2008). Modern
7. Jaya, A., Purwanto, E., Fauziah, M. B., Murdianto, Control Systems, Pearson, 11th edition.
F. D., Prabowo, G., & Rusli, M. R. (2017, 9. Mishra, A. K., & Narain, A. (2012). Speed control
September). Design of PID-fuzzy for speed control of dc motor using particle swarm
of brushless DC motor in dynamic electric vehicle optimization. International Journal of Engineering
to improve steady-state performance. In 2017 Research and Technology, 1(02), 2278-0181.

© 2022 |Published by Scholars Middle East Publishers, Dubai, United Arab Emirates 478

You might also like