This project is a real-life implementation of the research paper Motor control application based on STM32 and PID control theory by Zhao Zhetuo, HKUST on an Arduino UNO.
The objective of the project is to precisely control the rotation angle and rotational speed of a DC brush motor, which is provided by a potentiometer. The developed board should be able to toggle between speed controller configuration and angle controller configuration.
The control law is based on 3 cascaded PID (Proportional Integral Derivative) control loops, regulating individually over the driver current, angular speed (rpm) of the motor, and the rotation angle of the motor.
The innermost PID loop controlling the motor current, and the outermost loop controlling the theta.
Trapezoidal velocity profile (TVP) generation has been used for getting the setpoint angular speed (rpm). The TVP is generated by the following equations2:
$$ t_{acc,∆} = \sqrt{θ_{m}^{*}/a} $$
$$ t_{acc,traz} = ω_{max}/a $$
$$ T = t_{const} + t_{acc,traz} $$
where,
The following angular speed response is observed from the system. The blue plot indicates the desired values and the red plot indicate the physical values. The two horizontal extreme lines reprent the maximum possible values of the angular velocity. The ripples produced are within a 5% error margin.
The angle response was quite unsatisfactory. Since the system is highly jittery and the encoder cpr (counts per revolution) very low (4x4 = 16), the control response only makes the system more unstable.
Footnotes
-
Zhao, Z.T., 2013. Motor Control Application Based on STM32 and PID Control Theory. AMM 385–386, 867–871. https://doi.org/10.4028/www.scientific.net/amm.385-386.867 ↩
-
Heo, Hong-Jun, Yungdeug Son, and Jang-Mok Kim. 2019. "A Trapezoidal Velocity Profile Generator for Position Control Using a Feedback Strategy" Energies 12, no. 7: 1222. https://doi.org/10.3390/en12071222 ↩ ↩2