A PID controller looks at the current value of the error, the integral of the error over a recent time interval and the current derivative of the error signal to determine not only how much of a correction to apply, but for how long.

A feedback controller is designed to generate an output that causes some corrective effort to be applied to a process to drive a measurable process variable towards a desired value known as the setpoint. Virtually all feedback controllers determine their output by observing the error between the setpoint and the actual process variable measurement.
Defining a PID controller
A proportional-integral-derivative, or PID, controller looks at the current value of the error, the integral of the error over a recent time interval and the current derivative of the error signal to determine not only how much of a correction to apply, but for how long. Those three quantities are each multiplied by a tuning constant and added together to produce the current controller output CO(t) thusly:
In equation (1), P is the proportional tuning constant, I is the integral tuning constant, D is the derivative tuning constant, and e(t) is the error between the setpoint SP(t) and the process variable PV(t) at time (t).
e(t) = SP(t) – PV (t)
If the current error is large, has been sustained for some time or is changing rapidly, the controller will attempt to make a large correction by generating a large output. Conversely, if the process variable has matched the setpoint for some time, the controller will leave well enough alone.
The basics of tuning a PID controller
Conceptually, that’s all there is to a PID controller. The tricky part is tuning it, meaning setting the P, I and D tuning constants so the weighted sum of the proportional, integral and derivative terms produces a controller output that steadily drives the process variable in the direction required to eliminate the error.
This will cause the controller to initiate a burst of corrective efforts the instant the error changes from zero. The proportional term will then come in to play to keep the controller’s output going until the error is eliminated.
The controller will continue to generate an output based on the history of errors that have been accumulating in the controller’s integrator. The process variable may then overshoot the setpoint, causing an error in the opposite direction.
The accumulated errors are eliminated. Meanwhile, the derivative term will continue to add its share to the controller output based on the derivative of the oscillating error signal. The proportional term too will come and go as the error waxes and wanes.
This article originally appeared Jan. 1, 1997.