••••• THE PID CONTROLLER — Part 2
applied, the motor will either move the feedback resistor to
midrange or the system will oscillate back and forth. If the
system oscillates, decrease the proportional gain.
How Do I Tune a PID Controller?
This question is a bit like asking how to ride a bike.
The best answer is to just do it. I chose the servo motor
example as the basis of this article because it operates at
just the right speed. The system is slow enough so that we
can see what is happening, but not so slow that we have to
wait to see our changes. This is nice because we can quickly
tune the system. Taking this analogy further — tuning a PID
controller is like riding a bicycle. We are trying to balance
three criteria, as shown in Figure 3. An ideal system would
be unconditionally stable. It would respond instantaneously
to an input and it would have no error, i.e., it would go
exactly where we tell it to.
There is no such thing as an ideal system and our servo
motor is no exception. We already know that the servo motor
is a slow device. It takes over 20 mS before the motor starts
moving. We also know that it will not stop instantaneously.
Once it is moving, the momentum will keep it moving.
In real systems, we are left with compromises. We are
left to balance stability, rise time, and steady state error.
Let me explain using a series of oscilloscope views. The
test set-up used to capture the “oscillographs” is shown in
Photo 2. In the following sections, we will observe the “step
response” of the servo motor system.
A step input is nothing more than a square wave. We are
telling the servo motor to instantly move from one position
to another. The blue line represents the step function applied
to the input. The red line represents the actual response of
the servo mechanism, as measured at the feedback resistor.
PHOTO 2. Test set-up for PID control of servo motor.
We will first examine how the servo motor responds to
changes in proportional gain. The integrator and differentiator
should be disabled at this time. When we adjust the proportional gain, we are adjusting how hard the system will be
driven. Higher proportional gains send more current to the
motor. The motor will develop more torque and, as a result,
will move faster. This results in a more responsive system
that is better able to follow the set point. However, there is a
limit, as can be seen in Figure 4. The curve in Figure 4 is a
classic example of an “under damped” system. In an under
damped system, the system is seen to oscillate about the set
point in response to a step input. The system is optimized
for rise time. The final steady state error is minimal.
In Figure 5, we see what happens when the proportional
FIGURE 4. Proportional only control has a fast rise time with
considerable overshoot and oscillation around the set point:
blue = set-point; red = feedback from resistor.
100mS / div
1V / div
Delay = 150uS
FIGURE 5. The proportional gain is lowered, resulting in a critically
damped response and long risetime: blue = set point;
red = feedback from resistor.
100mS / div
1V / div
Delay = 400uS