2026-06-01
PID (Proportional-Integral-Derivative) control is the most widely deployed feedback algorithm on Earth. It runs cruise control in your car, temperature in your oven, altitude in autopilot, and flow rate in chemical plants. Three terms, one equation, infinite real-world applications.
The setup: you have a setpoint (where you want to be), a process variable (where you actually are), and an error (the difference). PID computes a corrective output from that error:
output = Kp·e + Ki·∫e·dt + Kd·de/dt
Concrete example — espresso machine boiler: setpoint is 93°C. The PID reads the thermistor, computes error, and modulates the heater duty cycle via PWM. Too much Kp: the boiler oscillates ±5°C. Too little Ki: it settles at 91°C and never reaches setpoint. Too much Kd: every drop of cold water added triggers a derivative spike that slams the heater to 100%.
Tuning rule of thumb (Ziegler-Nichols): Set Ki and Kd to zero. Increase Kp until the system oscillates steadily — call that gain Ku and the period Tu. Then use Kp=0.6·Ku, Ki=1.2·Ku/Tu, Kd=0.075·Ku·Tu. It's aggressive but gets you in the ballpark; tune from there.
Many real systems use only PI — derivative is omitted because sensor noise costs more than the damping benefit. For systems with long deadtime (chemical processes), PID struggles fundamentally; you'll see Smith predictors or model predictive control instead.
