PID Controller Tuning (Ziegler-Nichols)
Calculate PID controller gains using the Ziegler-Nichols open-loop (reaction curve) method from process gain, dead time, and time constant.
Ziegler–Nichols open-loop (reaction curve) tuning rulesAPI slug pid-tuning
Inputs
Closed-loop step response (PID)
sample point
Standard values of Dead Time (L)
Select a row to use it| Dead Time (L) | Kp (PID) | Overshoot (PID) | Settling Time (PID, 2 %) | Status |
|---|---|---|---|---|
| 16 | 80.4% | 475ms | CHECK | |
| 8 | 73.2% | 951ms | CHECK | |
| 4 | 60.4% | 1.87s | CHECK | |
| 2.667 | 49.1% | 2.62s | CHECK | |
| 1.6 | 30.4% | 3.84s | CHECK | |
| 0.8 | 3.4% | 5.93s | PASS |
- Ki (PID)Ki
- 401/s
- Kd (PID)Kd
- 400ms
- Kp (PI only)KpPI
- 6
- Ti (PI only)TiPI
- 333ms
Formula
Ziegler & Nichols, 1942
| Symbol | Quantity | Your value |
|---|---|---|
| K | Process gain | 1.5 |
| L | Dead time (s) | 100 ms |
| τ | Time constant (s) | 1 s |
Assumptions
5 items
- 01Ziegler–Nichols open-loop (reaction curve) rules for a first-order-plus-dead-time process K·e^(−Ls)/(τs + 1): PID K_p = 1.2τ/(K·L), T_i = 2L and T_d = 0.5L; PI K_p = 0.9τ/(K·L) and T_i = 3.33L; K_i = K_p/T_i and K_d = K_p·T_d.
- 02The step response is simulated: the closed loop of that process with the PID, proportional and integral action on the error and derivative on the measurement, with no derivative filter, actuator limit or noise, after a unit set-point step.
- 03The overshoot is the response's peak above the set point, and the settling time the last time it is outside ±2 % of it.
- 04Ziegler–Nichols tunings aim at a quarter-amplitude decay, so overshoots well above 25 % are usual; the overshoot is judged against a budget, at most (25 % by default).
- 05The standard values are dead times from 0.05 to 1 times τ, each a calculation with that dead time.
Worked example
A DC motor speed loop
A DC motor's speed responds to its drive with a gain of 1.5, a 20 ms dead time and a 100 ms lag. What do the Ziegler–Nichols rules give, and how much does the loop overshoot?
| Step | Expression | Result |
|---|---|---|
| Proportional gain | 1.2 × 100 ms / (1.5 × 20 ms) | 4 |
| Integral time | 2 × 20 ms | 40 ms |
| Integral gain | 4 / 40 ms | 100 1/s |
| Derivative time | 20 ms / 2 | 10 ms |
| Overshoot, simulated, against the 25 % budget | (y_max − r) / r | 60.4 % |
| Settling time, ±2 % | |y(t) − r| ≤ 2 % · r, t ≥ t_s | 187 ms |
How it works
This calculator determines PID controller gains using Ziegler-Nichols tuning methods for motor speed and position control. Control systems engineers, automation programmers, and robotics developers use it to establish initial PID parameters that achieve stable, responsive closed-loop performance. PID control enables ±0.1-1% regulation versus ±10-20% for open-loop systems.
Per Astrom and Murray's 'Feedback Systems' (2nd ed.), PID control combines three terms: Proportional (K_p) provides immediate correction proportional to error, Integral (K_i) eliminates steady-state offset by accumulating error history, and Derivative (K_d) dampens oscillation by responding to rate of change. The transfer function is: u(t) = K_p×e + K_i×∫e·dt + K_d×de/dt.
Ziegler-Nichols tuning provides starting-point gains based on system identification. The closed-loop method: increase K_p (with K_i=K_d=0) until sustained oscillation occurs at ultimate gain K_u and period T_u. Per Z-N rules, PID gains are: K_p = 0.6×K_u, T_i = 0.5×T_u, T_d = 0.125×T_u. These values typically produce 25% overshoot and quarter-decay response—fine-tuning reduces K_p by 20-40% for applications requiring <5% overshoot. Industry surveys show 95% of PID loops use PI control only (K_d=0), as derivative action amplifies measurement noise.
Practical tips
- Per industrial practice, start with PI control only (K_d=0)—derivative action amplifies encoder noise and rarely improves response for motor control; add D only if sustained oscillation occurs with optimized PI gains
- Implement derivative on measurement (not error) per ISA guidelines: when setpoint changes instantly, derivative of error causes infinite spike ('derivative kick'); derivative on measurement avoids this and provides identical disturbance rejection
- Per NEMA motion control guidelines, use velocity-form (incremental) PID rather than position-form: inherent anti-windup, bumpless transfer between manual and auto modes, and easier fixed-point implementation on MCUs
Common mistakes
- Applying Ziegler-Nichols gains directly to production without fine-tuning: Per control theory, Z-N rules produce 25% overshoot by design; reduce K_p by 20-40% for applications requiring <10% overshoot
- Tuning at no-load and deploying to loaded system: Per system identification principles, motor gain and time constants change 30-50% between no-load and full-load; retune or implement gain scheduling for variable-load applications
- Omitting integrator anti-windup: Per control implementation guidelines, when output saturates (motor at max speed), unbounded integral accumulation causes 50-200% overshoot on setpoint reduction—implement clamping, back-calculation, or conditional integration
Frequently asked questions
3 questions
What is the difference between position-form and velocity-form PID?
Per control implementation guides: Position-form computes absolute output from accumulated integral history—requires explicit anti-windup and can exhibit integral accumulation issues. Velocity-form (incremental) computes only the change in output each sample: Δu = K_p×(e_k - e_{k-1}) + K_i×e_k×dt + K_d×(e_k - 2e_{k-1} + e_{k-2})/dt. Velocity-form inherently prevents windup and enables bumpless transfer. Most industrial motor controllers use velocity-form PID per ISA-5.1 guidelines.
When should I use only a PI controller instead of full PID?
Per control engineering practice, use PI when: (1) Measurement noise is significant—derivative amplifies noise by 10-100× at typical filter settings; (2) Process already has inherent damping (motors with back-EMF, thermal systems); (3) Response speed is not critical. Industry data shows 95% of industrial loops use PI only. Add D only for: fast positioning (CNC, robotics) where overshoot affects cycle time, or underdamped processes requiring active oscillation suppression.
What is anti-windup and why is it important for motor control?
Per control implementation guidelines: Anti-windup prevents integral term from accumulating when output is saturated (motor at maximum speed/torque). Without it, integral grows unbounded during saturation, causing 50-200% overshoot when setpoint is reduced (the 'unwinding' of accumulated error). Three common methods: (1) Integrator clamping—stop accumulation when output saturates; (2) Back-calculation—subtract saturated output difference from integrator; (3) Conditional integration—integrate only when |error| < threshold. Clamping is simplest and adequate for most motor applications.
Shop Components
As an Amazon Associate we earn from qualifying purchases.