Lab 11b: More Op Amp Applications: Active Filter PID Motor Control
Lab 11b: More Op Amp Applications: Active Filter PID Motor Control
Lab 11b: More Op Amp Applications: Active Filter; PID Motor Control
REV 3: Þx I-source references; revise ckt to adjust overall gain rather than P separately: add annotating ”balloons”
to Þgures, & explan. of D gain; March 14, 2002
Re: active Þlters: Chapter : 5.01 - 5.10: skim most of this, but read closely the sections that
concern the active Þlter you will build: the passive and VCVS: 5.01, 5.03-5.06 and Þrst pages of
5.07
1 Introduction
Today’s lab invites you to look at two useful circuits that ßirt with instability. In the Þrst, the
Þlter circuit, the stability issue is incidental; in the PID circuit (where the circuit response includes
“proportional,” “integral,” and “derivative” of the circuit error) , stability is the central issue.
The second circuit, the PID, will give you a chance to apply several subcircuits that you have met
before (integrator, differentiator, summing circuit, push-pull brought within feedback loop), plus a
new one (differential ampliÞer). This exercise provides a Þrst chance to use multiple op amps in
one larger circuit.
Both circuits, above, work fundamentally the same way, feeding back a boost in a frequency band
around f3dB . We ask you to build the right-hand circuit, because this form—which the Text
calls“VCVS”—is easy to build and then easy to tune. The VCVS form lets us use just one R value
and one C, and then vary the positive feedback by adjusting the gain of the op amp circuit:
Figure 2: VCVS: a particular implementation, with cascaded RC’s added for comparison
ConÞrm that the circuit behaves like a low-pass; note f3dB , and note attenuation at 2 X f3dB and
4 X f3dB . We hope you will Þnd the“-12dB/octave” slope that is characteristic of a“2-pole” Þlter,
though you won’t see that full steepness in the Þrst octave above f3dB . We hope, also, that the
simple cascaded RC looks wishy-washy next to this improved Þlter. The simple RC and the active
Þlter should show the same f3dB .
Presumably you have been watching the outputs of both Þlters on the scope, as you drive the two
Þlters with a common input. For a vivid display of the two Þlters’ frequency-responses you will
want to sweep frequencies automatically. You have done this before, using the
function-generator’s sweep function, but this time you must do the task a little differently from
the way you did it earlier. This time, you cannot use the X-Y display mode. Instead, use a
conventional sweep (this allows you to watch two output signals, not just one), while triggering
the scope on the function generator’s RAMP output (use the steep falling edge of the ramp).
2.2 Effects of Varying the amount of Positive Feedback: other Þlter Shapes
Once you have a pretty display of a ßat passband, try altering the Þlter shape: in place of the
4.7k feedback resistor (which helps deÞne the op amp circuit’s gain), try the following values (this
change of gain is very easy if you are using a resistor substitution box). The 4.7k is shown again,
in the table below, to make the point that 4.7k provides an intermediate behavior.
Filter Type R2 Gain
best time delay (Bessel) 1.8k 1.3
ßattest (Butterworth) 4.7k 1.6
steep, 2dB ripple (Chebyshev) 7.5k 2.1
nasty peak (no one claims this one!) 12K almost 3
OSCILLATOR! 15K >3
The last case, in which we deliberately overdo the positive feedback, is pointless in a Þlter—but for
today’s lab it may be useful: it reminds us of the boundary we are moving toward in this lab,
where positive feedback becomes harmful (a page or so farther, just below).
of the Þlters (with R = 1.8k), which shows the best step response, also shows the least waveform
distortion. The R=7.5k Þlter should show most distortion. Try a triangle as test waveform. The
contrast will not be very striking: we saw only a little distortion, from the worst of the Þlters.
Here’s a block diagram of our feedback scheme, with the variables indicated, as they work their
way around the loop. We’ll show it Þrst in the more formal control-loop form used in our class
discussion:
Figure 5: Loop to control motor shaft position: block diagram in form used in class discussion
Now, here’s the same diagram redrawn to look more like the op amp loops that we are
accustomed to seeing:
Figure 6: Loop to control motor shaft position: block diagram in form familiar from op amp discussions
Stability We will Þnd that we can make the circuit at least marginally stable, simply by
keeping the gain of the circuit low enough: more precisely, we’ll keep the loop gain, AB low
enough. In Lab 10b, we saw the same pattern–in which stability improved when loop-gain was
reduced ; in those Lab 10b experiments, we could not control the gain of the op amp (“A”), so we
varied the fraction fed back (“B”).
Just below is the circuit where we met the effect: capacitive load could make the circuit unstable,
but cutting gain (“B”) could restore stability.
Lab 11b: More Op Amp Applications: Active Filter; PID Motor Control 5
Figure 7: Lab 10b circuit: diminishing signal fed back was able to stabilize circuit despite C-load
The signal fed back was shrinking as its phase shift was growing more dangerous (approaching the
-90 degrees that could bring on oscillation). So, when we attenuated it further (with a voltage
divider, in exercise 10b-2), we were able to keep our circuit stable.
Today, we again regulate loop gain (AB ), but we will do this, Þrst, by varying “A,” the “ampliÞed
error” term, rather than “B”. (We will be able to vary “A” because we replace the usual
very-high-gain op amp with a pseudo-op amp made from a differential amp followed by a gain
block). We will not play with “B,” the fraction fed back.
Once this “P”-only loop is wired, we will try gradually increasing the gain –much as in the
active-Þlter case. We should Þnd the circuit fairly stable for low gains, then as we increase gain
we should begin to see overshoot and ringing, evidence of the circuit’s restlessness; at still higher
gains, the circuit should oscillate continuously.
Figure 8: Proportional-only drive will cause some overshoot; gain will affect this
At the end of these notes we attach some scope images describing just such responses to
variations in simple “proportional” gain.
Figure 9: Motor-driver
Wire up the two potentiometers, as well. The resistors at the ends of the two
potentiometers–6.8k resistors on input, 4.7k resistors on the motor pot–restrict input and
output range to a range of about ± 10V, so as to keep all signals within a range that keeps the op
amps happy. The difference in R values makes sure that the input range cannot exceed the
achievable output range.
You can test this motor driver by varying the input voltage, and watching the voltage out of the
motor-driven pot. Any VIN more than a few tenths of a volt should evoke a change of output
voltage. You will hear the motor whirring, and will see the shaft slowly turning (the motor drive
is geared down through a two-stage worm- and conventional- gearing scheme). A clever clutch
scheme allows the motor to slip harmlessly, when the pot reaches either end of its range. If the
signs of VIN and the change in VOU T do not match, then be sure to interchange leads of one of
the pots, so as to make them match. We don’t want a hidden inversion, here, to upset our scheme
when we later close the loop.
Lab 11b: More Op Amp Applications: Active Filter; PID Motor Control 7
Figure 11: Try making motor spin, to test the diff amp, gain stage, sum and motor drive
Figure 13: P only: gain is high enough to take us to the edge of oscillation
With a little more gain (RSum = 1M , in our case) and the application of either a step change at
the input, or a displacement of the output pot by hand we saw a continuous oscillation. Find the
gain that sets your circuit oscillating, and then note the period of oscillation, at the lowest gain
that will give sustained oscillation. We will call this the period of “natural oscillation,” and soon
we will use it to scale the remedies that we’ll apply against oscillation.
position. Additional integrations lagging phase shifts can carry us to the deadly minus-180-degree
shift that turns nice feedback into nasty, and brings on the oscillation you have just seen.
. We know that
VOUT = I × RF eedback
and this I is just .
C × dVIN /dt.
So
R × C × dVIN /dt
VOU T /(dVIN /dt) = = RC.
dVIN /dt
So, RC deÞnes the differentiator’s gain. A differentiator’s output amplitude grows linearly with
frequency; VOUT , in other words, for a sinusoid is proportional to ω:
We want this VOUTDeriv to equal VOU TP roportional –which is just equal to VIN (“VIN ”, to both “P”
and D” circuits, is the Error signal: the output of the diff amp).
If we set these quantities equal, then
ωRC = 1
2πf RC = 1
RC = 1/(2πf ).
In words, this suggests that RC should be about 1/6 of the period of natural oscillation. In our
case, where TOscillation = 0.3s, we’d set RC to about 0.05 s, or a bit less.2 If we use a convenient
C value of 0.1 µF, the our observations (fnatural−osc ≈ 3Hz) seem to call for R of about 0.5M.3
Let’s make this value adjustable, though–because we want to be able to try the effect of more or
less than the usual derivative weight: if you have a second resistor substitution box, use it to set
the differentiator’s gain (RC ). Otherwise, use a 1M variable resistor. Watching the position of the
rotator will let you estimate R to perhaps 20 percent; the midpoint value certainly is 500k, and
700k is close to the 3/4-rotation position. The differentiator’s output goes into the summing
circuit installed earlier, through a resistor chosen to give this “D” term weight equal to the “P”’s.
We hope you will Þnd this “D” to be strong and effective medicine. Once it has tamed your
circuit’s response–eliminating the overshoot and ringing–crank up the “P” gain, taking it to the
gain that just set off oscillation in the “P-only” circuit. Is the circuit stable? If not, try more “D.”
Does an excess of “D” cause trouble? Incidentally, you can also use the scope image’s time-domain
image of the circuit’s response to judge whether you have too much or too little D: too little, and
you’ll see remnants of the overshoot you saw with “P-only”; too much D, and you’ll see an RC-ish
curve in the output voltage as it approaches the target: it chickens out as it gets close.
Switch The toggle switch across the feedback resistor will let us cut “D” in and out; the switch
seems preferable to relying, say, on a very-large variable R to feed the summing circuit. We Þnd it
hard to keep track of multiple pot settings, to know whether we’re contributing “D” or not. A
switch makes the ON/OFF condition easier to note.
2
See., e.g., Tietsche and Schenk (sp?)..... A less formal approach appears in St.Clair..... From his website, ...., one
can download an interesting simulator that allows one to try his rules. See also, [Exeter, UK simulator]
3
We must confess that our circuit worked better with about half this “D” gain; we hope you’ll come closer to the
target.
Lab 11b: More Op Amp Applications: Active Filter; PID Motor Control 12
...but Stability may suffer It sounds dangerous, doesn’t it?–tacking an integral term when
integration, plus other lagging phase shifts, are just what threatens the circuit’s stability. It is
dangerous, as you can conÞrm by overdoing the “I”. You should be able to evoke continuous
oscillation, as in the dark days before you knew about the stabilizing effect of “D”!
Lab 11b: More Op Amp Applications: Active Filter; PID Motor Control 13
Figure 17: Increasing P-only gain, taken to brink of oscillation; and effect of integration term
lb11b Mar02.tex; March 14, 2002