THE PID CONTROLLER — Part 2 •••••
20mS / div
2V / div
Start up delay = 20mS
FIGURE 2. Delayed response of a modified HiTec HS-322 servo: blue =
voltage applied to motor; red = motor response as measured via resistor.
statement, but take a moment to think about the attributes
of a mechanical system. The moving parts of a motor have
mass. Consequently, they have inertia and momentum. It
takes a finite amount of time before the motor will respond.
It takes time and energy to get the motor armature, gears,
and load moving. Figure 2 shows how the modified Hi Tec
HS-322 R/C servo motor responds when a 6 VDC signal is
applied. We see that it takes approximately 20 mS before
the motor even starts to move. Conversely, once the motor
is moving, it does not want to slow down.
The motor is also an electrical device — again an obvious statement. The motor windings have the characteristics
of an inductor and a resistor. Recall that an inductor works
to keep the current constant. Consequently, when the
motor is turned off, there is no current flow. When the
voltage is first applied, the inductance of the windings tries
to keep the current at zero. Therefore, the motor
inductance accounts for some of the delay seen in Figure
2. The motor resistance also limits the amount of current
and, thus, the torque that the motor can deliver.
How Do I Connect the Servo
In a word, carefully! Things can get out of control
when designing and experimenting with control
systems. In preparing this article, I stripped no less than
three sets of gears out of the servo motors! After that, I
got smart and added limit switches to the servo. Also, it
is a good idea to put a current-limiting resistor in series
with the motor — 10 to 20 ohms works nicely.
The PID loop requires negative feedback. If either
the motor or feedback resistor is installed incorrectly, we
will have positive feedback and the system will go nuts.
Remember those limit switches!
When we first connect the PID, it is best to disable the
integrator and differentiator. The integrator is disabled by
shorting out the feedback capacitor. The differentiator is
disabled by shorting out the resistor connected between
IC3D and ground. These components are marked on
Schematic 1. On my circuit board, I have added headers
to facilitate this process. Just add a shunt on top of the
headers to disable the integrator’s derivative section.
The motor and feedback resistor should be connected
to the circuit. If possible, do not physically connect the
motor shaft to the feedback resistor. If you are using a
servo, the top may be opened and the final gear removed.
Short the set point, i.e., 0 volts input. Apply power to the
system. The motor will most likely turn. Move the feedback resistor. You should be able to make the motor
change directions. The motor should turn in a direction
opposite that of the feedback resistor. If it doesn’t, reverse
the polarity of the motor.
At this point, we can physically connect the motor
and the feedback resistor. Be ready to disconnect the
power. Things can get out of hand quickly. When power is
NUTS & VOLTS
PHOTO 1. Complete analog PID controller.
FIGURE 3. Factors to consider when tuning a control system. In general,
you can optimize two, but not all three.
Steady state error