PID Tuning Guide

PID controller basics — what each term does, tuning methods, and common pitfalls.

Reference Reference Updated Apr 19, 2026
Reference

The equation

u(t)
= K_p·e(t) + K_i·∫e dt + K_d·de/dt
e(t)
setpoint − measured
K_p
Proportional — reacts to current error
K_i
Integral — eliminates steady-state error
K_d
Derivative — dampens overshoot, reacts to error trend

Term effects

Term Increase → rise time Overshoot Settling Steady-state error
K_p Decrease Increase Small change Decrease
K_i Decrease Increase Increase Eliminate
K_d Small Decrease Decrease No effect

Ziegler–Nichols (closed-loop)

  • 1. Set K_i = K_d = 0.
  • 2. Increase K_p until sustained oscillation. Call that K_u, period T_u.
  • 3. For P: K_p = 0.5·K_u.
  • 4. For PI: K_p = 0.45·K_u, K_i = 1.2·K_p / T_u.
  • 5. For PID: K_p = 0.6·K_u, K_i = 2·K_p / T_u, K_d = K_p·T_u / 8.

Practical pitfalls

  • Integral windup: clamp the integral when output is saturated.
  • Derivative kick: compute K_d on the measurement, not the error, to avoid huge spikes on setpoint change.
  • Noisy derivative: filter the measurement or apply derivative only to a smoothed signal.
  • Actuator limits: clamp u(t) to actuator range. Apply anti-windup inside the loop.
  • Sample rate: should be at least 10× the closed-loop bandwidth.

Last updated: