For my Introduction to Mechatronics course, I made a motor control system to follow user specified angles and trajectories. The motor was controlled using a PID (proportional-integral-derivative) Feedback Control on the measured electric current and position of the motor.
I programmed the control system in both Matlab and C. The Matlab code was to send instructions to and read data back from the microcontroller. The C code was to read sensors, actually control the motor, and send the trajectory data.
I also wired components on a bread board, so that the components could communicate with each other.
A normal motor is rather impossible to control well without a control system. Something "simple" like turning to a particular angle would be difficult because a motor would need to react dynamically.
How can I control a motor precisely to follow trajectories?
I used a PID Feedback Control System. The control system would receive in a user specified instruction and would output an electric control signal so the motor would follow the instruction.
A proportional-integral-derivative (PID) controller has three parts to create an electric control signal. The three parts perform different operations on the error (e), which is the reference signal minus the sensed output. The relationship is show below as the control law.
The figure below shows the nested feedback control loops used in this project. The inner loop is a PI electric current loop, and the outer is PID position loop.
The motor control system worked really well and was able to turn to specific angles when given that input. It followed trajectories relatively well, but could use a bit more tuning. A video of the motor control system will be added soon!