Overview
PID stands for proportional, integral, and derivative. It is a widely used control algorithm for keeping a physical variable stable, such as maintaining balance, temperature, or rotational speed. PID control is common in multirotor aircraft, self-balancing vehicles, automotive cruise control, and temperature controllers for 3D printers, among other applications.
Why not simple on/off control?
For simple tasks with loose requirements, on/off control can work: below a setpoint turn the actuator on, above turn it off. However, many systems have inertia and finite sensing and actuation delays. For example, an automotive cruise control that reacts with full throttle or full braking to a small speed error can produce large oscillations and poor ride quality. Similarly, heaters have thermal inertia, so abrupt switching can cause overshoot or instability. PID provides a continuous control action that accounts for magnitude, rate of change, and accumulated error to improve stability and response.

Functions of the three terms
The basic PID controller parameters are kP, kI, and kD. Their roles are:
kP: Proportional
Proportional control applies a corrective action proportional to the current error (setpoint minus measured value). Small errors produce gentle corrections; large errors produce stronger corrections. Implemented as a simple scaling factor, kP determines the control aggression: higher kP yields stronger corrections and faster response, while lower kP yields more conservative control.
With only proportional control, systems often exhibit steady oscillation around the setpoint. For example, a balancing robot with only P control may continuously sway around the balance angle, making it hard to maintain a stable upright position.
kD: Derivative
Derivative control reacts to the rate of change of the error. It provides a damping effect by applying a control action opposite to the error's velocity, which helps reduce oscillation and settle the system more quickly. When the controlled variable is changing, D acts to "brake" that change.
Increasing kD strengthens the damping effect. Combining P and D (a PD controller) often stabilizes systems that oscillate under pure proportional control, such as allowing a balancing vehicle to stand upright without excessive sway.

kI: Integral
Integral control accumulates the error over time and applies a corrective action based on that accumulated error. This eliminates steady-state error that proportional and derivative terms alone cannot remove. For example, if environmental heat loss balances the heater power so that the temperature stabilizes below the setpoint, the integral term will grow over time and increase the control output until the temperature reaches the target.
kI scales the integral contribution: larger kI causes the accumulated integral to influence the output more rapidly. When using integral action, it's important to limit the integral term to prevent excessive buildup (integral windup) during large or sustained errors.
PID tuning guidelines
A practical approach to tuning PID parameters is iterative and empirical:
- Start with small parameter values and increase gradually.
- Tune proportional first to obtain a reasonably fast response with acceptable overshoot.
- Add integral if steady-state error remains. Reduce the previously selected proportional gain to 50–80% before introducing integral, set a relatively large integral time constant, then reduce the integral time constant (increase integral action) until steady-state error is acceptable while adjusting proportional as needed.
- Finally, add derivative action if the dynamic response is still unsatisfactory. Start with TD = 0 and increase TD gradually while fine-tuning proportional and integral settings until the desired response is achieved.
Common heuristics:
- If the response oscillates with large amplitude and low frequency, reduce proportional gain.
- If the response drifts or is slow to recover, reduce integral time constant (increase integral action).
- If oscillations are high-frequency, reduce derivative action.
- Derivative tends to be small and has limited effect compared with P and I, but it helps damp rapid changes.
There are many formal tuning methods, but in practice PID tuning is guided by the controlled plant's characteristics and experience. P primarily affects oscillation amplitude and speed, I affects steady-state error and response speed, and D provides damping to reduce overshoot and oscillation.
Mnemonic for tuning
Here is a translated mnemonic to remember tuning order and adjustments:
"Find optimal parameters by searching from small to large; proportional first, integral next, then add derivative. If the curve oscillates frequently, reduce proportional; if the curve drifts, reduce proportional; if recovery is slow, shorten integral time; if oscillation period is long, lengthen integral time; if oscillation frequency is high, reduce derivative; if fluctuations are slow, increase derivative time. Ideal response shows two waves, front higher and back lower in a 4:1 ratio. Observe and adjust carefully to ensure quality control."