You can read about P, I and D forever, but tuning only clicks when you feel the loop fight back. This is a live closed loop: a simulated first-order process with deadtime, controlled by a PID you tune with three sliders. Step the setpoint, kick it with a disturbance, and watch overshoot, settling and steady-state error move as you turn each knob. Break it on purpose first. Then tune it until it behaves.
The controller looks at error = setpoint − process value, and sums three responses. Each has one job, and one failure mode if you overdo it.
🟦 P · Proportional (Kp): push in proportion to the present error. More Kp = faster & stronger, but too much = oscillation. P alone leaves a permanent offset.
🟩 I · Integral (Ki): accumulate past error until it's gone. This is the term that kills the offset. Too much = more overshoot, slower settling and worse windup.
🟨 D · Derivative (Kd): react to the rate of change, so the controller anticipates and damps. Calms overshoot, but amplifies noise, so it's used sparingly (often zero).
➕ Output = Kp·e + Ki·∫e + Kd·(de/dt), clamped to 0–100%. The art is balancing the three so the process reaches setpoint fast, flat and stable.
The grey line is your setpoint; the orange line is the process value chasing it; the faint blue is the controller output. Drag the knobs and watch the response redraw live. Try a preset, then hit Step setpoint or Disturbance to test it.
Don't twiddle randomly. The classic manual recipe gets you 90% there in minutes:
📐 Ziegler–Nichols formalises step 1: find the ultimate gain Ku (where it oscillates) and period Tu, then for a classic PID set Kp = 0.6·Ku, Ki = 1.2·Ku/Tu, Kd = 0.075·Ku·Tu. The result is aggressive: a good starting point, and rarely the final answer.
📈 Integral windup
When the output saturates (100%), the integral keeps piling up, so when you finally reach setpoint it overshoots badly. Fix: clamp the integral (anti-windup) when the output is maxed.
⚡ Derivative kick
A step change in setpoint makes de/dt spike, slamming the output. Fix: compute D on the process value, not the error ("derivative on measurement").
📻 Noise amplification
D multiplies high-frequency noise into a jittery output that wears valves. Fix: filter the input or keep Kd small/zero on noisy signals.