A PID controller sets the power output based on the error fro\m some target sensor value (). When tuned properly, PID controllers can prevent overshooting and oscillation.

where is the power output, represents the error from target, represents the proportional (p), integral (i), and derivative (d) constants. The output depends solely on the error and the constants.

P: Proportional

The proportional constant does most of the work — it calculates the power output proportional to the error. For simple systems P is usually enough.

I: Integral

The integral constant reduces static state error, i.e. it recognizes and eliminates an often small but persistent error from the target and add them up over time. As time passes the integral error will be large enough for the term to influence the output. However, when the integral error gets too big (a.k.a. integral windup) it needs to be adjusted or simply reset (to 0, for example).

D: Derivative

The derivative constant reacts to the rate of change in the power output, thus it can damp the output and reduce oscillation.

PID Tuning

VariableRise timeOvershootSettling TimeSteady-state ErrorStability
+KpDecreaseIncreaseSmall increaseDecreaseDegrade
+KiSmall DecreaseIncreaseIncreaseLarge decreaseDegrade
+KdSmall DecreaseDecreaseDecreaseMinor changeImprove

Resources