THE PID CONTROLLER — Part 1 •••••
FIGURE 6
4 V
Input
0V
0
2
4
6
8
-4V
2 V
Output
0V
0
2
4
6
8
-2V
the rotational position of the motor.
The servo was gutted. I only used the motor and
the variable resistor, as shown in Photo 2.
PID Block Diagram
Rf
C
Vin
Vout
FIGURE 5
a differentiator. To simplify
the math, we
will let RC=1.
From time 0
to 2, the voltage changes
- 4 volts, while
the time
changes 2
seconds. The slope of this line is, therefore, -2. The output of
the differentiator will be equal to 2 — remember the stage is
inverting.
Servo Motor System
Now that we are familiar with the P, I, and D terms,
let’s examine how they are combined to form a complete
system. We will be using the PID controller to control a DC
servo motor. I used a Hitec brand servo motor typically
found in R/C model cars and airplanes. This servo is inexpensive and readily available. You can also purchase
replacement gears — more of that in the next installment!
The servo mechanism consists of several components, as shown in Photo 1. We have a DC motor, a set of
gears, and a variable resistor. The resistor is attached to
the last gear. This variable resistor is used to determine
A block diagram showing the functional relationships of the PID controller is shown in Figure 7. The
first thing to notice is that this is a parallel process. The
P, I, and D terms are calculated independently and then
added at the summer ∑. The input to this loop is the
set-point — in this application, it can range from – 12 to
+ 12 VDC. The output is motor position. Position is
measured by the resistor and feedback as a voltage
between – 12 to 12 VDC. We will now examine each
of the PID terms independently to see how they are
related. For this discussion, assume that the set-point is 0
VDC.
On the far left of Figure 7, we see a summing junction.
The difference between the set-point and feedback is the
error of the system. If the measured motor position is positive
of where it should be, the error will be negative (i.e., a
negative correction is required). Likewise, if the measured
motor position is -1, the error will be positive 1 (i.e., a positive
correction is required — remember set-point is 0 VDC).
The error is multiplied by the gain of the proportional
block. Notice that the block diagram shows this as a
negative gain. This was done so that the block diagram and
the schematic (presented later) will be consistent with each
other. The proportional amplifier output is sent to the second summing junction, where the sign is again inverted. The
amplifier boots the signal’s current and drives the motor.
This chain gets to be quite long, so let’s summarize
proportional operation in a few simple sentences:
1. An error must be present!
2. The system will try to correct the error by turning the
motor in a direction that opposes the error.
3. The intensity of the correction is determined by proportional gain. If there is no error, there is no proportional drive.
F
o
r
E
l
e
c
t
r
o
n
i
c
s
NUTS & VOLTS
E
v
e
r
y
t
h
i
n
g
Set point
+
S
_
error
- PRO
_
Feedback
Resistor
Feedback
- INT
_
S
+
A MP
Motor
- DIF
-12V +12V
FIGURE 7
Moving on to integral — the integral is a
device that charges a
capacitor over a period
of time. Recall the
example of the audio
amplifier. In that application, the integrator
accumulated the DC
output of the amplifier
over time. It then
rebiased the amplifier
to eliminate the DC
68
JANUARY 2005