PID Controller Tuning Calculator (Ziegler-Nichols)

Calculate PID controller gains (Kp, Ki, Kd) using Ziegler-Nichols tuning rules.
Supports step response and ultimate gain methods for P, PI, and PID controllers.

Step response method. The flat stretch after you bump the input, before the output starts to move.
Step response method. Time to cover 63% of the total change once it starts moving.
Ultimate gain method. The Kp at which the loop first oscillates steadily, with Ki and Kd both off.
Ultimate gain method. Peak to peak time of that steady oscillation.
PID Gains

What Is a PID Controller? A PID (Proportional-Integral-Derivative) controller is the most widely used feedback control algorithm in industrial automation. It reads the error between a setpoint (desired value) and process variable (actual value) and adjusts a control output to minimize that error. PID controllers regulate temperature in ovens, speed in motors, pressure in pipes, flow rates, altitude in drones, and thousands of other processes. It is estimated that over 90% of industrial feedback control loops use PID controllers.

The PID Control Law u(t) = Kp × e(t) + Ki × ∫e(t) dt + Kd × de(t)/dt Where: u(t) = controller output, e(t) = error = setpoint − process variable. Kp = proportional gain: responds immediately to current error. Ki = integral gain: eliminates steady-state error over time. Kd = derivative gain: predicts future error, dampens overshoot.

Ziegler-Nichols Step Response Method (Open-Loop) The process is given a step change in input and the open-loop response is recorded. From the S-shaped step response curve, two parameters are identified: L = apparent dead time (the lag before the response begins to ramp). τ (tau) = time constant (the time for the response to complete 63% of its total change). These come from drawing a tangent line at the inflection point of the S-curve.

Ziegler-Nichols step response tuning rules: P only: Kp = τ / L PI: Kp = 0.9 × τ / L, Ti = L / 0.3 → Ki = Kp / Ti PID: Kp = 1.2 × τ / L, Ti = 2L, Td = 0.5L → Ki = Kp / Ti, Kd = Kp × Td

Ziegler-Nichols Ultimate Gain Method (Closed-Loop) Increase Kp with Ki = 0 and Kd = 0 until the loop oscillates steadily. Ku = ultimate gain (at onset of sustained oscillation). Tu = ultimate period (period of sustained oscillation in seconds).

Ultimate gain tuning rules: P only: Kp = 0.5 × Ku PI: Kp = 0.45 × Ku, Ti = Tu / 1.2 → Ki = Kp / Ti PID: Kp = 0.6 × Ku, Ti = Tu / 2, Td = Tu / 8 → Ki = Kp / Ti, Kd = Kp × Td

Typical PID Behavior High Kp: fast response but oscillations. Too high → instability. High Ki: eliminates offset but can cause integral windup. Too high → sustained oscillations. High Kd: reduces overshoot but amplifies noise. Too high → chattering. The Ziegler-Nichols method often produces an aggressive tuning. Trimming the gains by 20 to 30% usually gives a smoother response.

Modern Alternatives to Ziegler-Nichols Cohen-Coon: similar to Z-N but gives less oscillatory response for slow processes. AMIGO (Approximate M-constrained Integral Gain Optimization): developed in 2002 by researchers in Sweden for robust industrial tuning. IMC (Internal Model Control) tuning: λ-tuning with a single adjustable robustness parameter. Auto-tuning: most modern industrial PLCs and controllers include built-in auto-tuning functions.

Integral Windup When the controller output saturates (hits a limit), the integral term keeps accumulating error. That is integral windup. When the process finally responds, the overloaded integral causes large overshoot. Anti-windup techniques: back-calculation, conditional integration, or clamping the integrator when output is saturated.

Practical Notes Ziegler-Nichols is a starting point; always fine-tune on the actual process. Derivative action (Kd) should often be filtered (Td / N where N = 3 to 20) to reduce noise sensitivity. For pure temperature control loops, a well-tuned PI often performs as well as PID.

Where Ziegler-Nichols works, and where it does not

The step-response rules were fitted to processes with a dead time somewhere between about a tenth and a whole time constant. Inside that band they land close enough that a bit of hand trimming finishes the job. Outside it they get strange fast.

A process with almost no dead time (L/τ under 0.1) produces an enormous Kp, because Kp = 1.2τ/L divides by a number close to zero. On real hardware that gain runs straight into the actuator limit and the loop chatters. A process that is nearly all dead time (L/τ above 1) goes the other way: Z-N gives a sluggish, badly damped result, and dead-time compensation such as a Smith predictor is the honest answer rather than more tuning.

Both methods here also assume the process gain is 1, which is what the classic τ/L form implies. If a 10% change in your valve moves the temperature by 40 degrees, the process gain is 4 and every Kp above needs dividing by it. Controllers that work in engineering units rather than percent hide this, and it is the most common reason a textbook tuning comes out four times too hot on the first try.

Reading the simulated response

The chart below runs your tuned controller against a first-order-plus-dead-time model of the process and plots what the loop actually does after a setpoint step. For the ultimate-gain method there is no process model in the inputs, so the page derives one: the frequency and gain at which a first-order-plus-dead-time process oscillates fix L and τ uniquely, so Ku and Tu are worked back into an equivalent L and τ and the same simulation runs.

Classic Ziegler-Nichols aims at quarter-amplitude decay, which means each overshoot is about a quarter of the one before. On the chart that shows up as a first peak well above the setpoint and two or three visible wobbles before it settles. If that looks too lively for your process, and on most real plants it does, cut Kp first and leave the integral alone.


How we build and check this calculator

This calculator runs entirely in your browser, so the numbers you enter stay on your device. The math behind it is written by hand and tested against worked examples and standard references before the page goes live.

SuperGlobalCalculator is independently built and maintained. See how we build and verify our calculators.


Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.