Skip to content
RFrftools.io
Motor ControlMarch 21, 20266 min read

Ziegler-Nichols PID Tuning: From Open-Loop Step Response to Practical Controller Gains

Learn Ziegler-Nichols PID tuning using process gain, dead time & time constant. Worked example with real motor control values. Free online calculator.

Contents

Why PID Tuning Still Matters

PID controllers are everywhere — from the thermal regulation loop on your reflow oven to the speed controller in a brushless DC motor drive. Despite the rise of model-predictive and adaptive control strategies, the classic PID remains the workhorse of embedded control. The reason is simple: it works, it's cheap to implement on an 8-bit micro, and when tuned properly it delivers excellent performance.

The catch, of course, is "tuned properly." A badly tuned PID oscillates, overshoots, or responds so sluggishly that it might as well not be there. The Ziegler-Nichols open-loop method gives you a disciplined, repeatable starting point based on three measurable process characteristics: process gain KK, dead time LL, and time constant τ\tau.

The Open-Loop Step Response Method

The idea is straightforward. You put your system in open loop, apply a step change to the actuator (say, a voltage step to a motor driver), and record the process variable (motor speed, temperature, position — whatever you're controlling). From the resulting S-shaped response curve, you extract three parameters:

  • Process Gain KK — the ratio of the final change in output to the step input. Dimensionally, this might be RPM per volt, °C per percent duty, etc.
  • Dead Time LL — the delay before the output begins to respond, in seconds.
  • Time Constant τ\tau — the time it takes the output to reach roughly 63% of its final value after the dead time.
With these three numbers in hand, Ziegler-Nichols provides direct formulas for P, PI, and full PID controllers.

The Ziegler-Nichols Formulas

For a PID controller, the classic Ziegler-Nichols open-loop tuning rules are:

Kp=1.2τKLK_p = \frac{1.2\,\tau}{K\,L}
Ti=2LT_i = 2L
Td=0.5LT_d = 0.5L

The integral and derivative gains in the parallel (ISA) form are then:

Ki=KpTiK_i = \frac{K_p}{T_i}
Kd=KpTdK_d = K_p \cdot T_d

For a PI-only controller (no derivative action — often preferred in noisy systems or when derivative kick is a concern):

KpPI=0.9τKLK_p^{\text{PI}} = \frac{0.9\,\tau}{K\,L}
TiPI=L0.3=3.33LT_i^{\text{PI}} = \frac{L}{0.3} = 3.33L

These formulas target a quarter-decay ratio — each successive overshoot is about 25% of the previous one. It's a moderately aggressive tuning that works well as a starting point.

Worked Example: DC Motor Speed Control

Let's say you're designing a speed controller for a 24 V brushed DC motor driving a conveyor belt. You step the PWM duty cycle from 0% to 20% and record the motor speed with a tachometer encoder. Here's what you observe:

  • The motor doesn't begin accelerating until 0.15 s after the step → L=0.15sL = 0.15\,\text{s}
  • Speed reaches 63% of its final value at t=0.15+0.8=0.95st = 0.15 + 0.8 = 0.95\,\text{s}τ=0.8s\tau = 0.8\,\text{s}
  • Final speed settles at 600 RPM for a 20% duty input → K=60020=30RPM/%K = \frac{600}{20} = 30\,\text{RPM/\%}
Plugging these into the PID formulas:
Kp=1.2×0.830×0.15=0.964.5=0.2133K_p = \frac{1.2 \times 0.8}{30 \times 0.15} = \frac{0.96}{4.5} = 0.2133
Ti=2×0.15=0.3sT_i = 2 \times 0.15 = 0.3\,\text{s}
Td=0.5×0.15=0.075sT_d = 0.5 \times 0.15 = 0.075\,\text{s}
Ki=0.21330.3=0.711s1K_i = \frac{0.2133}{0.3} = 0.711\,\text{s}^{-1}
Kd=0.2133×0.075=0.016sK_d = 0.2133 \times 0.075 = 0.016\,\text{s}

For PI-only control:

KpPI=0.9×0.830×0.15=0.724.5=0.16K_p^{\text{PI}} = \frac{0.9 \times 0.8}{30 \times 0.15} = \frac{0.72}{4.5} = 0.16
TiPI=3.33×0.15=0.5sT_i^{\text{PI}} = 3.33 \times 0.15 = 0.5\,\text{s}

You can verify these instantly — open the PID Controller Tuning (Ziegler-Nichols) calculator, enter K=30K = 30, L=0.15L = 0.15, τ=0.8\tau = 0.8, and confirm the results.

Practical Tips for Real Systems

Start with PI, then add D. In many motor control applications, sensor noise on the speed feedback (especially from low-resolution encoders) makes the derivative term more trouble than it's worth. Begin with the PI gains, verify stable operation, and only add derivative action if you need faster disturbance rejection. Ziegler-Nichols is a starting point, not a destination. The quarter-decay criterion often produces more overshoot than you'd like in a production system. A common practice is to start with the Z-N values, then reduce KpK_p by 20–30% and increase TiT_i slightly to trade speed for smoother settling. Watch your sample rate. If your control loop runs at 1 kHz but your dead time is 150 ms, you have 150 samples of pure delay. That's fine. But if your loop only runs at 50 Hz, you have just 7–8 samples of dead time, and the derivative term will be very coarse. Make sure TdT_d is at least 5–10× your sample period. Anti-windup is not optional. The integral term will accumulate error during saturation (e.g., when the motor is at full duty and still hasn't reached setpoint). Implement clamping or back-calculation anti-windup, or you'll see massive overshoot on recovery. Re-tune at operating conditions. Process gain and time constant can change with load, temperature, and supply voltage. If your motor drives a variable-mass payload, the Z-N gains tuned at no-load may oscillate under full load. Tune at the worst-case (most challenging) operating point.

When to Use a Different Method

Ziegler-Nichols open-loop tuning assumes a first-order-plus-dead-time (FOPDT) process model. If your system is significantly higher order — for instance, a cascaded thermal system with multiple time constants — the FOPDT approximation may be poor, and methods like Cohen-Coon or relay auto-tuning may give better initial gains. For systems where you can't perform a step test safely (high-power drives, chemical processes), the Ziegler-Nichols ultimate gain (closed-loop) method or software-based auto-tuning is more appropriate.

Try It

Grab your step-response data, extract KK, LL, and τ\tau, and open the PID Controller Tuning (Ziegler-Nichols) calculator to get your starting gains in seconds. It computes both PI and full PID parameters, so you can compare and choose the right structure for your application. Bookmark it — you'll use it more often than you think.

Related Articles