Skip to content

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

Sign in to saveSave

Inputs

Example
Output change / Input step size from step test

0.001 or more

Time before response begins

1 ms or more

Time for 63.2% of final step response

1 ms or more

The overshoot the loop may have on a setpoint step; Ziegler–Nichols tuning aims at about 25 % (Ogata, Modern Control Engineering, 5th ed., ch. 8)
%

0.1 to 200 %

Overshoot (PID)CHECK
73.2%
at most 25 %
Kp (PID)
8
Ti (PID)
200ms
Td (PID)
50ms
Settling Time (PID, 2 %)
951ms

Closed-loop step response (PID)

SPy180 %0 %L 100 mst_s 951 ms0 s200 ms400 ms600 ms800 ms1 s1.2 s1.4 s

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
1680.4%475msCHECK
873.2%951msCHECK
460.4%1.87sCHECK
2.66749.1%2.62sCHECK
1.630.4%3.84sCHECK
0.83.4%5.93sPASS
Ki (PID)Ki
401/s
Kd (PID)Kd
400ms
Kp (PI only)KpPI
6
Ti (PI only)TiPI
333ms

Formula

Ziegler & Nichols, 1942
Kp=1.2τ/(K⋅L),Ti=2L,Td=0.5LKp = 1.2τ/(K·L),\quad Ti = 2L,\quad Td = 0.5L
SymbolQuantityYour value
KProcess gain1.5
LDead time (s)100 ms
τTime constant (s)1 s

Assumptions

5 items
  1. 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.
  2. 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.
  3. 03The overshoot is the response's peak above the set point, and the settling time the last time it is outside ±2 % of it.
  4. 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).
  5. 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?

StepExpressionResult
Proportional gain1.2 × 100 ms / (1.5 × 20 ms)4
Integral time2 × 20 ms40 ms
Integral gain4 / 40 ms100 1/s
Derivative time20 ms / 210 ms
Overshoot, simulated, against the 25 % budget(y_max − r) / r60.4 %
Settling time, ±2 %|y(t) − r| ≤ 2 % · r, t ≥ t_s187 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.

  • NEMA 17 Stepper MotorNEMA 17 bipolar stepper motors for precision motion controlAmazon →
  • Stepper Motor Driver (A4988)A4988 stepper driver modules for microstepping controlAmazon →
  • DC Motor with Encoder12 V DC motors with encoders for closed-loop drive applicationsAmazon →