Engineering · Lesson 03
PID Control & Feedback Loops
Every autopilot, thermostat, and self-driving car relies on the same elegant idea: measure the error, then correct it — proportionally, by its accumulation, and by its rate of change. Tune a virtual drone and feel the math come alive.
Quick Brief
- P — Proportional: correction scales with current error
- I — Integral: corrects accumulated past error (drift)
- D — Derivative: dampens based on rate of change (overshoot)
- Together they form the most widely used control algorithm in engineering
Live Simulator
Error Over Time
Blue = setpoint · Orange = actual position · Shaded area = error
Proportional (P)
The P term produces an output proportional to the current error. High Kp responds aggressively but can overshoot. Too low and the system is sluggish, never quite reaching the setpoint ("steady-state error").
Integral (I)
The I term sums all past error over time. It eliminates steady-state error that P alone cannot fix, but too much Ki causes oscillation and "integral windup."
Derivative (D)
The D term reacts to the rate of change of the error. It acts as a brake, smoothing out overshoot and damping oscillations. Too much Kd amplifies sensor noise.
Tuning in the Real World
Engineers use methods like Ziegler–Nichols to find good starting gains. The goal: reach the setpoint quickly, with minimal overshoot and no sustained oscillation. Explore the sliders above to feel this balance.
Challenge Mode — Coming Soon
Random wind gusts will push your drone off course. Can you tune the PID gains to recover within 2 seconds every time?