Skip to content

Control Systems

How to tune a PID controller with Ziegler-Nichols

The Ziegler-Nichols method tunes a PID controller in two runs. First, with P control only, raise the gain until the system swings steadily, neither growing nor dying away. That gain is Ku, the ultimate gain, and the time from peak to peak is Tu, the ultimate period. Then a recipe turns those two numbers into all three gains.

Step 1: find the edge

Turn off the I and D terms. Start with a small Kp and raise it run by run:

  • Too low, and any swing dies away.
  • Too high, and each swing is bigger than the last.
  • At the edge, the swing holds its size for ever. That's Ku.

Time the swing's peaks: that's Tu. On a potter's wheel aiming at 100 rpm, Kp 8 dies away, 12 grows off the chart, and 10 swings steadily with peaks exactly 1.00 s apart. So Ku = 10 and Tu = 1.0 s.

Step 2: apply the recipe

ControllerKpKiKd
P0.5 Ku
PI0.45 Ku0.54 Ku ÷ Tu
PID0.6 Ku1.2 Ku ÷ Tu0.075 Ku × Tu

For the wheel's full PID:

Kp = 0.6 × 10 = 6, Ki = 1.2 × 10 ÷ 1.0 = 12, Kd = 0.075 × 10 × 1.0 = 0.75

The PID row is often written with times instead: an integral time of Tu ÷ 2 and a derivative time of Tu ÷ 8, which give the same gains.

Live experiment

Find the steady swing, then apply the recipe

A potter's wheel aiming at 100 rpm. Run one is P only: find the gain where the swing neither grows nor dies, and note Ku and Tu. Run two applies the recipe, Kp 0.6 Ku, Ki 1.2 Ku ÷ Tu and Kd 0.075 Ku Tu, and settles after a lively first swing.

Try it yourself: free lesson

“Tune by the recipe” is lesson 5 of 6 in Balance Bluffs, Control Systems World 3. Free with an account. Lessons unlock in order, so you’ll do the 18 before it first.

Step 3: trim

Ziegler and Nichols aimed for a fast, lively response, and their gains deliver one: the wheel reaches 100 rpm quickly, swings up past 150 on the way, and settles in under three seconds. For a lot of jobs that's too much overshoot. Treat the recipe as a starting point. Lower Kp and Ki a little and run it again until the response is calm enough.

When not to use it

Step 1 deliberately drives the system into a sustained swing. For a small wheel or a hobby robot that's fine. For a big motor, a boiler or anything that could break, it isn't. Ziegler and Nichols' 1942 paper also gave a second method that uses a single step response instead, and many industrial controllers autotune with a relay test, switching the output between two levels to find Tu and Ku safely. The recipe is the same idea: measure how the system responds, then set the gains from that.

Free lesson

Now build it yourself

Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.

Try it yourself: free lesson

“Tune by the recipe” is lesson 5 of 6 in Balance Bluffs, Control Systems World 3. Free with an account. Lessons unlock in order, so you’ll do the 18 before it first.

Or start from the very first lesson, no account needed

Practice questions

Three quick questions from the lessons. Pick an answer to check it.

  1. Question 1 of 3The recipe's PID overshoots by about half. What would you try first, to calm it?
    Show the answer

    Answer: Lower Kp and Ki a little and run it again. The recipe aims for quick and lively. It's a starting point: trim the gains from there.

    • Why not “Throw the recipe away”? The recipe is a good starting point; trimming its gains is the normal next step, not abandoning it.
    • Why not “Raise Ki”? More Ki adds more stored push, which makes overshoot worse, not better.
    • Why not “Raise Ku”? Ku is measured, not chosen. It's a property of the machine, found where the swing holds its size.
  2. Question 2 of 3The recipe's first run is P only, raising Kp until the swing…
    Show the answer

    Answer: Neither grows nor dies away. That gain is Ku, and the swing's period is Tu.

    • Why not “Dies away”? A swing that dies away means the gain is still below the edge; raise it further.
    • Why not “Stops”? A swing that stops entirely means the gain is far too low to find the edge yet.
    • Why not “Grows”? A swing that grows means the gain is past the edge; Ku is lower than that.
  3. Question 3 of 3Tuning a PID loop by hand, which gain do most engineers set first?
    Show the answer

    Answer: P: get it arriving, then add D to stop the overshoot, then I for the last inch. P does most of the work and shows you the loop's character. D fixes the overshoot P causes. I is last and smallest, for the error that remains. Changing all three at once hides which one did what.

    • Why not “All three at once”? Changing all three at once hides which gain did what, so it's hard to learn anything from each run.
    • Why not “I”? I is usually set last and smallest, for the steady error left once P and D are working.
    • Why not “D”? D only makes sense once P is pushing; it brakes the overshoot that P causes.
Keep practising: free lesson

“Tune by the recipe” is lesson 5 of 6 in Balance Bluffs, Control Systems World 3. Free with an account. Lessons unlock in order, so you’ll do the 18 before it first.

Questions people ask

What are Ku and Tu in Ziegler-Nichols?

Ku, the ultimate gain, is the proportional gain at which the system, under P control alone, swings with a steady size that neither grows nor dies away. Tu, the ultimate period, is the time from one peak of that swing to the next.

What are the Ziegler-Nichols PID formulas?

For a full PID: Kp = 0.6 Ku, Ki = 1.2 Ku ÷ Tu and Kd = 0.075 Ku × Tu, the same as an integral time of Tu ÷ 2 and a derivative time of Tu ÷ 8. For P only, Kp = 0.5 Ku; for PI, Kp = 0.45 Ku and Ki = 0.54 Ku ÷ Tu.

Is Ziegler-Nichols tuning good?

It's a quick, systematic starting point, but the gains it gives are aggressive: expect a large first overshoot. Most engineers apply it, then lower Kp and Ki until the response is calm enough for the job.

When should you not use Ziegler-Nichols?

When driving the system into a sustained swing is unsafe or costly, like a large motor, a chemical process or anything that could break. A step-response test or a relay autotune finds similar numbers without the risk.

Every topic