# Analog PID Controller/Filter delay and stability

recently I had an exercise where I had to build and measure an analog PID controller/filter. The starting point was this circuit.

This is a tamed PID controller implemented with a single opamp. Resistor and capacitor values are calculated regarding the crossover frequency and a 40 degree phase margin.

First question I have: When this circuit is connected to a power supply and given an input voltage(sine wave while manually editing the frequency) the output voltage slowly but surely goes up to the supply voltage level where it stands which draws the conclusion that the analog PID controller is unstable right? Or am I interpreting something wrong here? If I am right, that means that it is BIBO unstable(Since the only thing bounding the output is the opamp not the controller)

However, after a new Resistor is added parallel to R3 and C2 which makes it a PID-Controller/filter(not sure about this formulation when it is mentioned as an analog filter) it becomes stable and these are the bode plot and step response of the circuit with a new resistor.

My next question would be, does an analog controller has delay? Looking at the step response I would conclude that there is no delay. Nevertheless the delay from the step response should be calculated and compared to the delay measured from the bode plot.

• Is there anything going completely wrong with the step response ? As I can think: blue line is the setpoint and red line is the system's response ? How about the steady state error ? Could you add a step response with no setpoint changes ? For example, set the setpoint at $V=0.4$ and add the step response for $15$ seconds. – Teo Protoulis Jul 17 at 17:16
• Unfortunately this is what I have now. It was checked and confirmed that it is correct. One rectangle and the red line in that time span is the step response. It is then just inverted when the polarity is changed – refa Jul 18 at 6:18

## 2 Answers

Forget about the fact that it is supposed to be a PID controller, and think about how your circuit works for a constant (DC) input.

Because of the capacitor C2, there is no feedback at all from the output of the op amp to its input for DC, so there is nothing controlling the output voltage and setting the DC gain of the circuit. Presumably, the output slowly drifts up to the supply voltage as some stray capacitance in the circuit charges up.

If you add a resistor R in parallel with R3 and C2, the DC gain is then -R/R1 and the output voltage will follow the input DC voltage.

• I edited the question since I left that out. Input was a sine wave from a wavegen – refa Jul 18 at 6:14

After consulting with a colleague following conclusions were made. Controller without resistor in the feedback part has this transfer function

$$PID(s)=\frac{K(s-z_1)(s-z_2)}{s(s-p_1)}$$

this makes it unstable(borderline stable since one pole is zero)

To move this pole along x axis in the negative direction a resistor is added which produces this transfer function

$$PID(s)=\frac{K(s-z_1)(s-z_2)}{(s-p_2)(s-p_1)}$$

Now the controller is stable.

Regarding delay, analog controller has no delay. Response to an input is immediate, However its digital counterpart has a delay which can be measured from it step response or bode plot

• Offcourse a real opamp has a finite slew rate, and signal moves at a finite rate so there will still be some delay. – joojaa Jul 19 at 8:46
• Thanks for the heads up – refa Jul 20 at 9:43