Negative D value in PID loop?

What is the effect of the sign of the D value in a PID loop? It would seem that since D is derivative, a positive D value would exponentially increase the output, while it would seem a negative value would exponentially decrease the output.

Does this mean that if we want to dampen the output, we need to use a negative D value?

The D term acts on the derivative of the error. If your error is increasing (bad), the derivative will be positive and you would increase the output voltage.

If your error is decreasing (good), the derivative will be negative and you would decrease the overall output voltage, causing the damping effect that you mentioned.

4 Likes

Absolutely correct, but to clarify one possible source of confusion:

The D term is the only term out of P, I, D, and (in most cases) F that acts to slow progress towards the target. You can think of it as a counter to momentum to prevent overshooting your target position and hence to improve settling time. Generally you do not want a D term in speed control, because there is no second-order momentum. See Wikipedia.

4 Likes

No. You can see in a typical PID implementation that all the errors have the same sign - move in the same direction from desired - so all the 3 constants must have the same sign. If the 3 constants are negative, that merely means the process is inverted from the controller. An example might be the more you press the brake pedal the slower the vehicle goes. Or maybe your encoders are spinning the opposite direction from your wheels.

1 Like