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

Ziegler-Nichols PID Tuning: Open-Loop to 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. Seriously — they control everything from the thermal loop in your reflow oven to the speed regulation of a brushless DC motor. Despite all the fancy new control strategies like model predictive control, the classic PID remains king. Why? It works, it's dirt cheap to implement on a basic microcontroller, and when you nail the tuning, it performs beautifully.

The trick is in that tuning. A poorly configured PID will oscillate like a drunk on a tightrope or respond so slowly you might as well have manual control. I've seen thermal controllers that overshoot by 40°C because someone just guessed at the gains. Not great when you're trying to reflow a board full of 0201 passives.

The Ziegler-Nichols open-loop method gives engineers a solid, repeatable starting point based on three key process characteristics: process gain KK, dead time LL, and time constant τ\tau. It's been around since 1942, and it still gets used because it cuts through the guesswork. You run one test, measure three parameters, plug them into some formulas, and you've got a baseline that usually gets you 80% of the way there.

The Open-Loop Step Response Method

Here's the game plan: put your system in open loop, slam a step change into the actuator (like a voltage step to a motor driver), and record what happens to your process variable. From that S-shaped response curve, you'll extract three critical parameters.

First is process gain KK — how much output change you get per input step. Could be RPM per volt, degrees Celsius per duty cycle percentage, whatever units your system speaks. If you step your heater PWM from 0% to 50% and the temperature eventually rises by 75°C, your process gain is 1.5°C per percent duty cycle.

Next is dead time LL — the delay before anything starts moving, measured in seconds. This is pure lag. You change the input, and for a frustrating moment, nothing happens. Then the system wakes up and starts responding. Dead time is the enemy of fast control. The more you have, the more conservative your tuning needs to be.

Finally, there's time constant τ\tau — how long it takes to reach about 63% of the final value after that initial delay kicks off. This comes from first-order system theory. An exponential response hits 63.2% of its final value after one time constant. In practice, you draw a tangent line at the inflection point of your S-curve, see where it crosses the final value line, and measure back to when the response started.

Collect those three numbers, and Ziegler-Nichols hands you direct formulas for P, PI, and full PID controllers. The beauty is that you don't need to know the underlying physics. You don't care if it's a thermal mass with convective losses or a motor with back-EMF dynamics. The step response tells you everything.

The Ziegler-Nichols Formulas

For a PID controller, the classic open-loop tuning rules look like:

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

These give you the proportional gain KpK_p, integral time TiT_i, and derivative time TdT_d in the standard form. Most modern controllers use parallel (ISA) form though, so you'll need to convert:

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

For a PI-only controller (useful in noisy systems where derivative action causes more problems than it solves):

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

Notice the PI tuning is more conservative — lower proportional gain, longer integral time. That's intentional. Without the derivative term to provide lead compensation, you need to back off a bit to maintain stability.

These formulas aim for a quarter-decay ratio — each overshoot is about 25% smaller than the last. Aggressive but usually a solid starting point. You get decent speed without turning your system into a jackhammer. Most engineers end up detuning from here, but it's way better than starting from zero.

Worked Example: DC Motor Speed Control

Let's make this concrete. Imagine you're designing a speed controller for a 24 V brushed DC motor on a conveyor belt. You step the PWM from 0% to 20% and track speed with a tachometer encoder. Here's what you see:

The motor starts moving 0.15 s after the step. That's your dead time → L=0.15sL = 0.15\,\text{s}. Could be electrical time constants, mechanical inertia getting overcome, whatever. You don't care why, just that it's there.

Speed hits 63% of the final value at t=0.15+0.8=0.95st = 0.15 + 0.8 = 0.95\,\text{s}. You started responding at 0.15 s, so the time constant is τ=0.8s\tau = 0.8\,\text{s}. This is probably dominated by the mechanical inertia and viscous damping of the system.

Final speed settles at 600 RPM for 20% duty cycle. Your process gain is K=60020=30RPM/%K = \frac{600}{20} = 30\,\text{RPM/\%}. Nice and linear, at least in this operating range.

Now plug 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}

Converting to parallel form:

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 (which I'd probably start with on a real motor, honestly):

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 with the PID Controller Tuning (Ziegler-Nichols) calculator. Saves you from doing the arithmetic by hand every time.

Practical Tips for Real Systems

Start with PI, then maybe add D. Sensor noise often makes derivative terms more trouble than they're worth. I've seen derivative action amplify encoder quantization noise into a 50 Hz buzz that made the whole mechanical assembly sing. Begin with PI, confirm stability, and only add derivative if you need faster disturbance rejection or tighter tracking. In many cases, you won't. Ziegler-Nichols is a starting point. The quarter-decay approach can produce more overshoot than you want, especially in systems where overshooting is expensive or dangerous. Most engineers reduce KpK_p by 20–30% from the calculated value and tweak TiT_i to balance speed and smoothness. I usually multiply the proportional gain by 0.7 and see how it feels. You can always increase it later. Sample rate matters. If your control loop runs at 1 kHz but dead time is 150 ms, you're golden. At 50 Hz, you'll have coarse derivative action that might not help much. The rule of thumb is that your sample period should be at least 5–10× faster than the derivative time constant. Otherwise, you're just amplifying noise between samples. For the motor example above with Td=0.075T_d = 0.075 s, you'd want to sample at least every 7.5 ms, which means 130 Hz or faster. Anti-windup is critical. The integral term will accumulate error during saturation, like when your motor is already at 100% duty cycle but the setpoint is still higher. Without anti-windup protection, the integrator keeps winding up, and when the error finally reverses, you get massive overshoot because the integral term takes forever to unwind. Implement clamping or back-calculation, or risk your conveyor belt launching parts across the room. Re-tune under real conditions. Process characteristics change with load, temperature, supply voltage, and a dozen other variables. A motor's effective time constant increases when you load it down. A heater's gain changes as ambient temperature shifts. Tune at your worst-case operating point, or at least verify that your gains still work there. The system you characterized empty might behave totally differently when it's actually doing useful work. Watch out for nonlinearities. The Ziegler-Nichols method assumes your system is reasonably linear around the operating point. If your actuator saturates, has significant deadband, or the process gain changes dramatically with operating conditions, you might need gain scheduling or adaptive control. A single set of PID gains can only do so much.

When to Use a Different Method

Ziegler-Nichols assumes a first-order-plus-dead-time (FOPDT) model. That's a pretty good approximation for a lot of industrial processes, but not everything. For complex systems with multiple time constants — like a cascaded thermal system with a heater, heat spreader, and thermal mass — methods like Cohen-Coon or relay auto-tuning might work better. Cohen-Coon handles processes with larger dead-time-to-time-constant ratios more gracefully.

If you can't safely do a step test because the process is running production or a big step would damage something, consider closed-loop identification methods or software auto-tuning. Some controllers have built-in auto-tune routines that do relay feedback tests to characterize the system while keeping it under control.

For really fast systems with minimal dead time, you might get better results from pole placement or other model-based techniques. But honestly, for 90% of the embedded control problems you'll face, Ziegler-Nichols gets you close enough that a bit of manual tweaking finishes the job.

Try It

Grab your step-response data, extract KK, LL, and τ\tau, and fire up the PID tuning calculator. It'll compute PI and PID parameters so you can choose the right approach for your system. Bookmark it — you'll use it more than you think. Every time you're staring at an oscilloscope trace wondering why your control loop is ringing, this is where you start.

Related Articles