Sjeat 78 472-478
Sjeat 78 472-478
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.
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
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.
© 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.
In this simulation, the speed motor is selected 200 rpm and 300 rpm. Figure 4 and Figure 5 show simulation
results of PID controller.
© 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
© 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.
© 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
© 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