You are on page 1of 17

Chapter 10L

Lab 10: Op Amps V: PID Motor Control


REV 2
1
; October 1, 2013
Time: 130 min.: 2
hours, 10 min.
Contents
10LLab 10: Op Amps V: PID Motor Control 1
10L.1Introduction: Why Bother with the PID Loop? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
10L.1.1Todays Feedback Loop. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
10L.1.2. . . And why it interests us . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
10L.2PID Motor Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
10L.2.1The Motor-Pot Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
10L.2.2The Motor Control Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
10L.2.3Motor Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
10L.2.4Pseudo Op Amp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
10L.2.5Drive the Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
10L.2.6Close the Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
10L.3Add Derivative of the Error . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
10L.3.1Derivative Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
10L.4Add Integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
10L.4.1...but Too Much I again brings Instability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1
Revisions: small rewordings (2/13); insert photo of motor pot (10/10); insert better drawings; renumber gures to 11pid... (8/07);
try to cut repetition (3/07).
1
2 Lab 10: Op Amps V: PID Motor Control
10L.1 Introduction: Why Bother with the PID Loop?
10L.1.1 Todays Feedback Loop. . .
Todays circuit looks straightforward: a potentiometer sets a target position; a DC motor tries to achieve that
position, which is measured by a second potentiometer. Lags cause the difculty: the correction signal is
likely to arrive too late to solve a problem that the circuit senses. If that happens, the remedy can make things
worse.
This motor control circuit is a classic feedback network called a PID circuit: the circuit response ulti-
mately will include three functions of the circuit error signal, P, I, and D: proportional, integral, and
derivative. Stability is the central issue.
10L.1.2 . . . And why it interests us
This feedback problem holds two sorts of interest, for our course.
Pedagogical Appeal:
It gives us a chance to applyand to apply in concerta collection of circuits that you have seen
either only as fragments, or only on paper:
differential amplier, made of op amps (this we have met only on paper)
differentiator
integrator
summing circuit
high-current driver (with motor as load)
PID confronts a classic control problem; it provides a scheme with many practical applications
10L.1.2.1 Putting the pieces together
Students often tell us that they like to build circuits that do somethingin contrast to circuits that produce just
images on a scope screen. Todays circuit qualies: it guarantees to make a little DC motor squirm (squirm
when its unstable; tamely spin, then stop, when its stable).
This PID circuit is by far the most complex in this course to date. That makes it a good setup for improving
your debugging skills (this is a glass-half-full way to say that youre very likely to make some wiring errors
today). We often boast that in this course, bugs are our most important product. This boast becomes most
convincing near the end of the course, when you may choose to put together a computer from ICs; but even
today the circuit is complex enough to make it a challenge. (The debugging will be especially challenging if
your sloppy lab partner fails to keep leads short and color-coded, and forgets to bypass power supplies. We
know you wouldnt make such errors.)
Finally, were happy to let this lab reinforce a concern rst discussed in the fourth op amp lab: stability.
Although todays circuit problem is singularintegrator within the loopand the remedy more subtle than
usual, the general stability problem is one that confronts us in almost every circuit that has gain.
Lab 10: Op Amps V: PID Motor Control 3
10L.2 PID Motor Control
The task we undertake here is one we have described in the class notes for Op Amps 5. We will repeat some
of what appears in those notes, to save you the trouble of consulting those as you do the lab. But those notes
are more thorough than what we will write in this lab.
Our goal, most simply stated, is just to use a feedback loop to get one DC voltage to match another; and since
both voltages come from potentiometers, the goal can also be described (maybe sounding more exciting) as
making the position of one potentiometer shaft mimic that of another. We want to be able to use our ngers
to turn a potentiometer by hand and see a motor-driven pot mimic our action. Such controls are sometimes
offered on fancy audio equipment, so that the equipment can be controlled either by twisting a knob, or by
using a remote that controls the knob from across the room.
10L.2.1 The Motor-Pot Assembly
The motor-pot gadget is nicely made, with an extreme gear-reduction box driving the pot slowly at high
torquebut mediated by a nylon clutch that can slip:
Figure 1: Motor-potentiometer assembly, exposed
The clutch serves two purposes: it permits a human hand to control the potentiometer directly, when the
motor is stopped. It also protects the motor against stalling and overheating, if the motor drives the pot to one
of its limits.
10L.2.2 The Motor Control Loop
Heres a minimal sketch of todays circuit:
Figure 2: Basic Motor-Position Control Loop: Very Simple!
The special difculty, today, comes from the fact that the motor-to-potentiometer block, our circuits load,
4 Lab 10: Op Amps V: PID Motor Control
integrates voltages. So, we cant use an ordinary op amp as the triangle in the feedback loop of g.2.
The extra -90 degree shift, or integration, in todays circuit forces us to alter our methods. Since we cannot
afford the phase shift of an ordinary op amp, we build ourselves a custom amplier: one that provides modest
gain and no phase shift. We will apply the radical remedy, in other words of altering not the load in the loop
but the op amp itself.
And heres a reminder of todays circuitredrawn to suggest that we now will be able to tinker with the
ampliers gain. Later, we will alter also its phase behavior.
Figure 3: Proportional-only drive will cause some overshoot; gain will affect this
We will rst try this circuit with its gain adjusted low, and we expect to nd the circuit fairly stable. Then, as
we increase gain, we should begin to see overshoot and ringing; if we push on to still higher gains, we should
see the circuit oscillate continuously.
At the end of these notes we attach some scope images describing just such responses to variations in simple
proportional gain.
10L.2.3 Motor Driver
Time: 25 min.
Lets start with a subcircuit that is familiar: a high-current driver, capable of driving a substantial current (up
to a couple of hundred milliamps). Well use the power transistors youve met before: MJE3055 (npn) and
MJE2955 (pnp). The motor presents the kind of troublesome load likely to induce parasitic oscillations, as
in the last exercise of Lab Op Amps 4. We need, therefore, the protections that we invoked there: not only
decoupling of supplies, but also both a snubber and high-frequency feedback that bypasses the troublesome
phase-shifting elements.
We are trying hard, here, to decouple one part of the circuit fromthe others: the 15F caps should prevent sup-
ply disturbances from upsetting the target signal. Similar caps at the ends of the motor-driven potentiometer
aim to stabilize the feedback signal.
You may also want to use an external power supply to provide the motors 15V supplies, if you have
such an extra supply handy. We suggest this not for decoupling, but because the motors maximum current
exceeds the breadboards 100mA rated output, and might disturb those supplies even if one inserted plenty of
decoupling caps. The external supply, unlike the breadboard supply, can provide the necessary current. (But
we have also built this lab happily without this separate power supply.)
Lab 10: Op Amps V: PID Motor Control 5
Figure 4: Motor-driver
Note that your motor pots resistance value may differ from the 10k shown in g. 4 on the facing page. If
so, scale the resistors appropriately. If your motors potentiometer has value 100k, for example, just scale the
target pot (labelled breadboard pot in g. 4 on the preceding page) and the 4.7k and 6.8k divider Rs up by
a factor of ten.
Note, also, that you must not use 411 op amps. The 411 has the nasty propertycommon to bi-fet
devicesthat it can ip its output phase if the input voltage goes below its specied common-mode input
range.
2
The result is that if an input to any of the ampliers in this loop momentarily swings to within about
a volt of the negative supply, the loop is very likely to get hung up by this nasty positive feedback.
3
Wire up the two potentiometers, as well as the motor-driver itself. The resistors at the ends of the two
potentiometers6.8k resistors on input, 4.7k resistors on the motor potrestrict input and output range to
a range of about 7V, so as to keep all signals well 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. Dont be dismayed if you see a good deal of hash on the scope screen. This hash may look very much
like a parasitic oscillation, familiar to you from the recent nasty oscillators lab. The image just below shows
what we saw, when watching the motor drive, with the motor moving:
Figure 5: Motor drive hash looks like a parasitic oscillation. . .
2
The op amp output is forced high in this event. If the input going too far negative is the non-inverting, this changes the avor of
feedback from negative to positive.
3
This hazard is not hypothetical; we rst breadboarded this circuit with 411sand were forcibly reminded of the parts nasty
phase-inversion by the occasional lock-up failure of the loop.
6 Lab 10: Op Amps V: PID Motor Control
But if we look at this hash more closely, we nd some clues that it is not the usual parasitic oscillation at
work:
Figure 6: Motor drive hash seen in greater detail: not parasitic oscillation, after all
These spikes seem to be the effects of the DC motors brushes breaking contact periodically with the motors
commutator. One clue is the fact that noise is not continuous, but seems to be a set of narrow spikes at a
low repetition rate. The other cluepretty conclusiveis the fact that the spike voltages exceed the power
supply: this effect looks a lot like the behavior of an inductor (the motor winding), angry each time the
commutator switches the current off. So, dont let this hash worry you. Its ugly, but well live with it.
Any V
IN
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
4
). After perhaps 20 seconds, the pot will reach its limit and will cease
turning. But thats all right: a clever clutch scheme, mentioned back in 1 on page 3, allows the motor to
slip harmlessly when the pot reaches either end of its range. If the signs of V
IN
and the change in V
OUT
do
not match, then be sure to interchange leads of one of the pots, so as to make them match. We dont want a
hidden inversion, here. It would upset our scheme when we later close the loop.
10L.2.4 Pseudo Op Amp
Time: 25 min.
Now we do a strange thing: we use three op amps to make a rather-crummy op-amp like circuit.
Figure 7: Differential Amp Followed by Gain Stage and an inversion
4
See photo of motor-pot innards, g. 1 on page 3.
Lab 10: Op Amps V: PID Motor Control 7
The rst stage you recognize as a standard differential amp. It shows unity gain. The second stage simply
inverts;
5
the third stage seems to be doing no more than undoing the inversion of the preceding circuit, along
with permitting adjustment of gain. That is true, at this stage; but we include this circuit because soon we
will use it, fed by two more inputs, as a summing circuit. So used, it will put together the three elements of
the PID controller: Proportional, Integral, and Derivative. In the present P-only circuit
6
we also use the third
amplier to vary the overall gain of our home-made op amp.
The entire circuit, then, is simply a differential amplier with adjustable gain. And this gain is always low
relative to the very-high values we are accustomed to in op amps. We need the modesty of this gain, and we
need an associated virtue of this simple circuit: no appreciable phase-shift between input and output. Both
characteristics contrast with those of an ordinary op amp, as you know. The xed, high gain of an ordinary
op amp, along with its integrator behavior beginning at 10 or 20 Hz would get us into trouble today, turning
negative feedback into positive.
10L.2.4.1 Check Common-mode and Differential Gains
Common-mode gain. . . We suggest that you use a resistor substitution box to set the summing circuits
gain. Set the gain at ten, and see whether a common-mode signala volt or so applied from the input pot,
applied to both inputsevokes the output you would expect. (Do you expect zero output?)
. . . (Pseudo-) Differential Gain Then ground one input (the 100k that feeds the rst op amps inverting
input), using the level from the potentiometer as input. Watch that input, and the circuit output, with the R
substitution box value set to 100k: see if you get the expected gain of +10.
A couple of features of this test may bear explaining:
Yes, the gain is positive when the input pot drives the non-inverting input to this home-made op amp,
since two inverting stages followthe diff amp;
we are applying a pseudo-differential signal by grounding one input of the diff amp and driving the
other. (You did this also in Lab 5, as you drove the home-made op amp.) Since the differential gain is
so much higher than the common-mode, this pseudo-differential signal works almost as a true differen-
tial signal would: an applied signal of v appears as a differential signal of magnitude v, combined with
a common-mode signal of magnitude v/2. Given even a mediocre CMRR, this modest common-mode
signal mixed with the differential is harmless.
A DVM may be handier than a scope, at this point, to conrm that the output of this chain of three op-
amp circuits shows a pseudo-differential gain of +10, while you drive the input with the input potentiometer
voltage. When you nish this test, leave the output voltage close to zero volts.
10L.2.5 Drive the Motor
You have already tested the motor driver. Lets now check the three new stagesthose that form the pseudo
op ampby letting their output feed the motor-driver. Conrm that you can make the motor spin one way,
then the other, by adjusting the input pot slightly above and then below zero volts. (The motor-driven pot, as
we have said, fortunately can take the pot to its limit without damaging pot or motor.)
5
This inversion is included so as to let this signal share a polarity with the Derivative and Integral signals, soon to be generated;
these signals will come from circuits that necessarily invert.
6
We call this P, as we call the other signals, soon to be added, D and I, although all are inverted. Strictly, then, this is -P. We
omit the minus in these labels, thinking it easier to refer to P than to minus P.
8 Lab 10: Op Amps V: PID Motor Control
Figure 8: Try making motor spin, to test the diff amp, gain stage, sum and motor drive
10L.2.6 Close the Loop
Time: 15 min.
Now reduce the gain, using the R substitution box: set gain to about 1.5 (R
gain
= 15k). Replace the ground
connection to the inverting input of our pseudo op amp with the voltage from the output potentiometer.
Figure 9: The loop closed, at last: Proportional only
Watch V
in
on one channel of the scope, V
outputpot
on the other channel. If a digital scope is available, this
is a good time to use it, because a very-slow sweep rate is desirable: as low as 0.5 second- or even 1 second
-per division.
Lab 10: Op Amps V: PID Motor Control 9
Several ways to test the loop: Apply Voltage Steps, by Hand or from Function-Generator? Two or
three methods are available to you, to test the new setup:
Two ways to drive the input:
square wave from function generator: a function generator can provide a small square wave
(0.5V, say), at the lowest available frequency (about 0.2Hz on our generators). This input can
replace the manual input potentiometer, temporarily. This is probably the best choice, since it
provides consistency you cannot achieve by hand.
Manual step input: you may, however, prefer the simplicity of manually applying a step input
from the input pot: a step of perhaps a volt.
The output pot should followshowing a few cycles of overshoot and damped oscillation.
An alternative test: Disturb the output, and watch recovery: a second way to test the circuits
response is available, if you prefer (and you may want to try this in any case, after looking at the
response to a step input): leave the input voltage constant, then manually force the pot away from its
resting position, simply by turning the knob of the output pot. Let go, and watch the knob return to its
initial positionshowing some overshoot and oscillation, as when the change was applied at the input
pot.
You start with a very low gain (1.5), which should make the circuit stable, even in this P-only form. Now use
the substitution box to dial up increasing gain. At R
Sum
= 220k (|gain| = 22) we saw some overshoot and
a cycle or two of oscillation, evident in the motion of the motor and pot shaft. If this shaft were controlling,
say, the rudder of an airplane, this effect would be pretty unsettling. The circuit worksbut it would be nice
if we could get it to settle faster and to overshoot less.
Increasing the gain, at R
Sum
= 680k (|gain| = 68), we were able to make out several cycles of oscillation
(the bigger, uglier trace shows the motor drive voltage; there the oscillation is more obvious):
Figure 10: P only: gain is high enough to take us to the edge of oscillation
With a little more gain (R
Sum
= 1M, in our case |gain| = 100) 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 well apply against oscillation.
10 Lab 10: Op Amps V: PID Motor Control
10L.3 Add Derivative of the Error
Time: 40 min.
Well, of course we can get it to settle faster; we can improve performance. (If we couldnt, would the name
of this sort of controller include the I and D in its name, PID?)
We can speed up the settling markedly, and even crank up the P gain (proportional) a good deal, once
we have added this derivative. Thinking of the stability difculty as a problem of taming the phase shifts of
sinusoidsas we did for op amps generallywe can see that inserting a derivative into the feedback loop
will tend to undo an integration.
The integrations are the hazard, here: one is built in, the translation from motor rotation to motor position.
Additional integrations resulting from lagging phase shifts can carry us to the deadly minus-180-degree shift
that converts nice feedback into nastythe sort that brings on the oscillation you have just seen.
10L.3.1 Derivative Circuit
The standard op amp differentiator shown below can contribute its output to the summing circuit. Here, we
show the entire prior circuit, with the differentiator added. The differentiators gain is rolled off at about
1.5kHz. Again we recommend that you use a resistor substitution box to set the D gain, if such a box is
available.
Figure 11: Derivative added to Loop
Fig. 11 also shows a switch in the feedback path that permits you to kill the derivative when you choose to.
You may sometimes want to revert to the simpler P-only scheme, as a note in 10L.3.1.1 on the next page
suggests.
Lab 10: Op Amps V: PID Motor Control 11
10L.3.1.1 How Much Derivative?
Our goal, in adding derivative, is to cancel the extra phase shift otherwise caused by a low-pass effect that
brings on instability. How do we know at what frequency this trouble occurs, and therefore how to set the
frequency-response or (equivalently) gain of the differentiator?
It turns out that you already have this information: you got it by measuring the frequency (or period) of
natural oscillation, back in section 10L.2.6. There, as you know, you gradually increased the P-only
gain till you saw that an input disturbance would evoke either an output that took a long time to settle, or a
continuous oscillation. (When we ran that experiment, for example, we got a natural oscillation period of
roughly 0.6 second).
We aim to make the derivative contribution, D, equal to the P contribution, at the corner frequency where
sustained oscillation would occur. The D should keep the loop stable, until yet another low-pass cuts in; at
that point, we should have arranged to make the loop gain safely low: less than unity, so that a disturbance
must die away.
RC denes the differentiators gain (youll nd an argument for this proposition in the Class Notes for Op
Amps 5, in case you need to be persuaded). Here, we reproduce the argument made in those Op Amps 5
notes, for setting the D gain.
How to Calculate the needed Derivative Gain
How do we calculate the necessary differentiator gain? To avoid complications, lets assume that the gain of the P path is unity. Then our goal
is to arrange things so that the derivative contribution, D, is equal to the P contribution, at the frequency where trouble otherwise would occur.
The D should keep the loop stable, until yet another low-pass cuts in; at that point, we should have arranged to make the loop gain safely low:
less than unity, so that a disturbance must die away.
Lets start by reminding ourselves what we mean by differentiator gain; then well calculate what RC we need for stability. Gain for a
differentiator, by denition is
Vout/(dV
in
/dt)
. We know that, for the op amp differentiator,
Vout = I R
Feedback
and this I is just
C dV
in
/dt.
So (neglecting the sign of the gain; the op amp version inverts)
Gain
(Deriv)
= Vout/(dV
in
/dt) =
RC dV
in
/dt
dV
in
/dt
= RC.
So, RC denes the differentiators gain.
a
If V
in
= Asin(t), then Vout
Deriv
= RCAcos(t). We want to nd the value of RC, the differentiators gain, that would set Vout
Deriv
equal Vout
Proportional
. Lets treat P gain as unity; then we want both P and D to equal V
in
.
If we set the D gain equal to unity, then
Vout
Deriv
= Vout
Proportional
= V
in
And, equivalently
RCAcos(t) = Asin(t)
Consider just the maximum amplitudes of V
in
and dV
in
/dt (where sin and cos terms equal one). We want to set these amplitudes equal to
each other, and both equal to the input amplitude, A. Then
RCA = A
and RC = 1, or RC = 1/
Or
RC = 1/(2f).
To paraphrase this equation in words: RC should be about 1/6 of the period of natural oscillation.
a
Perhaps you nd this a rehearsal of the obvious! Just a look at units make it very plausible that RC should be the differentiators gain:
input is volts/second; output is volts; the conversion factor needs units of seconds.
A Scaling Rule of thumb: frequency of natural oscillationdictatesD gain. If as this formula suggests,
RC should be about 1/6 of the period of natural oscillation, then for our T
oscillation
= 0.6s wed set RC to
12 Lab 10: Op Amps V: PID Motor Control
about 0.1 s, or a bit less.
7
If we use a convenient C value of 0.1 F, the R we need is about 1M. Lets make this
value adjustable, thoughbecause 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 differentiators 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 750k is close to the 3/4-rotation position. The differentiators output
goes into the summing circuit installed earlier, through a resistor chosen to give this D term weight equal to
the Ps.
We hope you will nd this D to be strong and effective medicine. Once it has tamed your circuits response
eliminating the overshoot and ringingcrank up the P gain, to about twenty (R
SUM GAIN
= 220k) or more.
Is the circuit still stable? Try more D. Does an excess of D cause trouble? The scope image of the circuits
response will let you judge whether you have too much or too little D: too little, and youll see remnants of
the overshoot you saw with P-only; too much D, and youll see an RC-ish curve in the output voltage as it
approaches the target: it chickens out as it gets close. And if you keep increasing the D gain still further, as
we said in the PID Class Notes, the circuit goes unstable once again; it oscillates.
Switch The toggle switch across the feedback resistor will let us cut D in and out; the switch seems prefer-
able to relying, say, on a very-large variable R to feed the summing circuit. We nd it can be hard to keep
track of multiple pot settings, to know whether were contributing D or not. A switch makes the ON/OFF
condition easier to note.
10L.4 Add Integral
Time: 15 min.
Adding the third termthe I of PIDcan drive residual error (a difference between the input pot voltage
and the output pot voltage) to zero. Here is a diagram of the full PID circuit, with the integrator added.
7
See., e.g., Tietze and Schenk, Electronic Circuits: Design and Applications (1991). A less formal approach appears in
St.Clairs paperback tutorial, self-published (Controller Tuning and Control Loop Performance By David W. St. Clair ISBN
0-9669703-6 Straight-Line Controls, Inc.; from his website (members.aol.com/pidcontrol/) one can download a simulator that al-
lows one to try his rules. The easiest simulator, along with a good tutorial, appears in a University of Exeter, U.K., site
(http://newton.ex.ac.uk/teaching/CDHW/Feedback/). The simulation lets you try (as you would expect!) the effect of varying P gain and
of adding in D and Ijust as we do in todays lab.
Lab 10: Op Amps V: PID Motor Control 13
Figure 12: Integral added, to complete the PID loop
Two details of the integrator may be worth noting:
two polarized caps placed end-to-end: this odd trick works to permit use of polarized capacitors in a set-
ting that can put either polarity across the capacitance. The effective capacitance is, of course, only one
half the value of each capacitor. We use polarized caps only because large-value caps like these 15F
parts are hard to nd in non-polarized form.
seeming absence of DC feedback: at rst glance, this integrator seems doomed to drift to saturation, since
the integrator includes neither of our usual protections against such driftfeedback resistor or momen-
tary discharge switch. But neither is necessary, here, because overall feedbackall the way around the
large loop, from input pot to output potmakes such unwanted drift impossible. In short, there is DC
feedback, despite appearances to the contrary.
Watching the effect of I: In todays circuit, the residual error is hard to see on the scope, so adding I will
not reward you as adding D did. Your best hope will come if you cut the P gain very low: try R
Sum
= 100k,
so that the circuit feedback ought to tolerate a noticeable residual error, when not fed an I of the error. If you
have been using a function generator to provide step inputs to your circuit, nowreplace that signal source with
the manually-adjusted pot input. Slow the scope sweep rate, to a rate that permits you to see the multi-second
effect of the integration.
14 Lab 10: Op Amps V: PID Motor Control
If you are using a digital scope, you will be able to watch input (Target), output (Motor pot)and Integrator
signals, after a step input applied from your input potentiometer. If you are patient, you can even make out
the effects of the motor and pots sticktion (a cute term for static friction): the motor and pot do not move
smoothly in response to a slowly-changing input (here, the I term
8
). Instead, the motor fails to move till the
I voltage reaches some minimal level; then output voltage jumps to a new level, and waits for another shove.
You can see these effects in some of the scope images attached at the end of these lab notes.
10L.4.1 ...but Too Much I again brings Instability
It sounds dangerous, doesnt it?tacking in an integral term when integration, plus other lagging phase
shifts, are just what threatens the circuits stability. It is dangerous, as you can conrm 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! Yet, remarkable though this fact is, some I does improve loop performance, and need not bring
on instability.
(end lab notes; scope images follow)
8
We dont want you to think we mean current, here, when we speak of I.
Lab 10: Op Amps V: PID Motor Control 15
Scope Images: Effect of Increasing Gain, in P-only loop
Figure 13: Increasing P-only gain brings increasing overshoot
16 Lab 10: Op Amps V: PID Motor Control
Figure 14: Increasing P-only gain, taken to brink of oscillation; and effect of integration term
lb op5 pid july12.tex; October 1, 2013
Index
PID
P: proportional to error (lab), 8
derivative of error
calculating (lab), 1112
derivative of error (lab), 1012
integral of error (lab), 1214
17