PID (Proportional, Integral, Derivative) Control

Introduction

The SmartMotorincludes a very high quality, high performance brushless servomotor with extremely powerful rare earth magnets and a stator (the outside, stationary part): a densely wound, multi-slotted electromagnet.

Controlling the position of a brushless servo’s rotor with only electromagnetism working as a lever is like pulling a sled with a rubber band. Accurate control would seem impossible.

The parameters that make it all work are found in the PID (Proportional, Integral, Derivative) control section. These are the three fundamental coefficients to a mathematical algorithm that intelligently recalculates and delivers the power needed by the motor 8,000 times per second. The input to the PID control is the instantaneous desired position minus the actual position, be it at rest, or part of an ongoing trajectory. This difference is called the position error.

The Proportional parameter of the PID control creates a simple spring constant. The further the shaft is rotated away from its target position, the more power is delivered to return it. With this as the only parameter, the motor shaft would respond just as the end of a spring would if it was grabbed and twisted.

If the spring is twisted and let go, it will vibrate wildly. This sort of vibration is hazardous to most mechanisms. In this scenario, a shock absorber is added to dampen the vibrations, which is the equivalent of what the Derivative parameter does. If a person sat on the fender of a car, it would dip down because of the additional weight based on the constant of the car’s spring. It would not be known if the shocks were good or bad. However, if someone jumped up and down on the bumper, it would quickly become apparent whether the shock absorbers were working or not. That’s because they are not activated by position but rather by speed. The Derivative parameter steals power away as a function of the rate of change of the overall PID control output. The parameter gets its name from the fact that the derivative of position is speed. Electronically stealing power based on the magnitude of the motor shaft’s vibration has the same effect as putting a shock absorber in the system, and the algorithm never goes bad.

Even with the two parameters working, a situation can arise that will cause the servo to leave its target created by “dead weight”. If a constant torque is applied to the end of the shaft, the shaft will comply until the deflection causes the Proportional parameter to rise to the equivalent torque. There is no speed so the Derivative parameter has no effect. As long as the torque is there, the motor’s shaft will be off of its intended target.

That’s where the Integral parameter comes in. The Integral parameter mounts an opposing force that is a function of time. As time passes and there is a deflection present, the Integral parameter will add a little force to bring it back on target with each PID cycle. There is also a separate parameter (KL) used to limit the Integral parameter’s scope of what it can do so as not to overreact.

Each of these parameters has its own scaling factor to tailor the overall performance of the PID control to the specific load conditions of any one particular application.

The scaling factors are as follows:

KP        Proportional
KI        Integral
KD        Derivative
KL        Integral Limit