# Understanding PID

Discussion in 'Electronic Design' started by [email protected], Feb 21, 2007.

2. ### martin griffithGuest

I'm not that good at PIDs( ie useless), but one thing confused me, is
the input differential or single ended?
what was the original input circuit?

martin

3. ### John PopelishGuest

The proportional gain is approximately R3/R2.

The integral time is approximately R3*C3.

The derivative time is roughly R2*C1.

In addition, the T network limits the very low frequency
gain (integral gain limit) once the frequency is so low that
impedance of C3 is feeding back as much current to the -
input as the T network does.

R1*C1 is the time that sets the gain limit for the
derivative, in this case about a factor of 20, since R1 is
1/20th of R2. If the precess feedback variable arrives at
the non inverting input (if the process, itself is
inverting) and setpoint is fed to inverting side, then you
have to add 1 to gain at all frequencies.

4. ### John BarrettGuest

The circuit should be taking a "command" voltage on one input, and an
"error" voltage on the other, and will generate a "control" voltage on the
output (with commerial PID controllers, these are usually 4-20ma or 0-10v
signals, center neutral)

I've done PID in software, so I know the theory, but have no idea how that
translates to op-amp hardware !!

you need to be looking for 3 things

the P term is multiplicitive so it will probably be represented by one of
the resistor/capacitor nets, same thing for the I term.. the D (which I know
as damping rather than differentiation) is usually subtractive and is
probably represented by the resistor divider that the top of the schematic.

This next part is referenced to servo motor motion control systems

so -- when the command and error voltages are not equal, this is going to
generate a command voltage that is used to activate a servo driver -- the
servo driver uses the absolute magnitude of the signal to set the PWM duty
cycle (for DC motor systems) or to set the AC frequency for AC servo
motors., and the polarity (around the center of the voltage/current range)
to determine direction

the P term causes acceleration, which, the longer the inputs are unequal,
the I term will magnify (it is multiplicitive and cumalative), attempting to
give a little more UHMPH to bring things back into sync, while the D term
takes over during deceleration (as the command and error voltages converge)
reducing the command output so that things coast smoothly to a stop.

Now for the fun part -- identifying which parts of that circuit handle each
part of the process -- and that I am absolutly unable to help you with at
all !!

I guess I can make a guess -- the network on the op-amp input might be the P
term.. the resistor net is the D term, and the res/cap net right below that
the I term......

alternativly -- P net on the input -- everything above the op-amp is the I
term (with protection for integrator runaway, a common problem when the I
factor is set too high), and the net on the output below the op-amp might be
the D term.

Good Luck !!

5. ### JoergGuest

John Barrett wrote:

[...]
Adjusting the parameters of a PID regulator to accomodate a plant can be
easy or it can be as tricky as adjusting the carburetor of a vintage
race car. Depends on how unorthodox the plant can behave. Tim Wescott
has written a nice article about the topic:

http://www.embedded.com/2000/0010/0010feat3.htm

[...]

6. ### martin griffithGuest

I'm a dumbo, of course it thats the way it works, just needed to stand
back and look at it.....grrrrr. Engage brain, before opening the
usenet tubes
any samples of code? A friend down the road wants his fishtank
optimised/boiled/fried (I could g**gle of course)

martin

7. ### Tim WescottGuest

As long as you can stand doing the whole thing in floating point you can
use it as-is. If you need to get fancy and use fixed-point math you're

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html

8. ### John BarrettGuest

Drop me an email off-group tomorrow and I'll dig it out -- its designed for
the AVR microcontrollers and a rotary encoder input -- but should be easy to
change that to a A/D interfaced thermocouple, and use the PWM output to
drive a DC heater element through a mosfet.. or turn the loop freqency down
REAL low and use triacs to control a standard AC tank heater -- either
on/off or "light dimmer" style.. the code already has RS232 interfacing for
configring the PID, and there are plenty of pins left over to drive a 4 bit
interface LCD and a few control buttons if desired.. the target hardware is
the Atmega 816 (successor to the Atmega8 series of controllers) 18 pin dip
pacakge.

If I dont get back to you about it -- BUG ME -- I've been hammered at work
all week which tends to make me wanna get away from the puter after hours !!

(not that I know what after hours is right now -- been working 30 hours
straight !!)

9. ### martin griffithGuest

On Wed, 21 Feb 2007 17:26:00 -0800, in sci.electronics.design Tim
Hi Tim, I've put your book on the todo list.

martin

10. ### BanGuest

Lets assume the non-inverting input is grounded.
Start with the T-resistor net. It effectively increases the value of the
feedback resistor, and can be replaced by a single resistor of 502M=Rfb. It
limits the DC-gain to 68dB, so the offset voltage doesn't saturate the
opamp, but it introduces a small DC-error.
At C3*R3 starts the proportional part with a gain of 0.5, which ends at
C1*R2.
R1 limits the gain of the differential part.
C2*R3 rolls off the high frequencies to stabilize the opamp.
R7, R8 and C4 are another lowpass to filter RF-noise, but it is not clear
where the output is.

11. ### Guest

Thanks for the response. Yes the non-inverting input is grounded.
How did you come up with a value of 68dB when you dont know what the
Zin and Zout is? Just curious?

Also can you please explain what do you mean by "At C3*R3 starts the
proportional part with a gain of 0.5, which ends at
C1*R2"

Thanks