PID Gain Calculator

Calculate P, PI, or PID gains for controllers. Choose ZN, Cohen-Coon, or IMC tuning methods. See clean results, then download CSV and PDF files.

Calculator
Pick a tuning method, enter test values, and calculate gains.
No external libraries are required for exports.
Choose based on the test data you have.
PID gives the most flexible shaping.
All time inputs use this unit.
Gain that produces sustained oscillation.
Oscillation period at Ku.
Steady-state output change / input change.
First-order lag time constant.
Transport delay before the response starts.
Higher λ improves robustness and noise tolerance.
Desired closed-loop time constant.
Reset
Tip: For Z-N closed-loop, start with P only to find Ku and Pu safely.

Example data table

Method Mode Inputs Kc Ti Td
Z-N Closed PID Ku=8, Pu=2s 4.8 1 s 0.25 s
Z-N Open PI K=1.5, T=20s, L=3s 4 9.99 s
IMC PID K=1.5, T=20s, L=3s 0.5621 21.5 s 1.3953 s
Values are examples for learning and benchmarking only.

Formula used

Controller forms
  • Ideal: gains expressed as Kc, Ti, Td.
  • Parallel: Kp=Kc, Ki=Kc/Ti, Kd=Kc·Td.
  • For P-only, integral and derivative terms are zero.
Ziegler–Nichols (ultimate gain)
Uses ultimate gain Ku and period Pu.
  • P: Kc = 0.5·Ku
  • PI: Kc = 0.45·Ku, Ti = Pu / 1.2
  • PID: Kc = 0.6·Ku, Ti = 0.5·Pu, Td = 0.125·Pu
Ziegler–Nichols (reaction curve)
Uses FOPDT fit: process gain K, time constant T, dead time L.
  • P: Kc = T / (K·L)
  • PI: Kc = 0.9·T/(K·L), Ti = 3.33·L
  • PID: Kc = 1.2·T/(K·L), Ti = 2·L, Td = 0.5·L
Cohen–Coon (FOPDT)
Better when dead time is significant: r = L/T.
  • P: Kc = T/(K·L) · (1 + r/3)
  • PI: Kc = T/(K·L) · (0.9 + r/12), Ti = L·(30+3r)/(9+20r)
  • PID: Kc = T/(K·L) · (4/3 + r/4), Ti = L·(32+6r)/(13+8r), Td = 4L/(11+2r)
IMC / Lambda (FOPDT)
Pick a closed-loop speed λ (τc). Larger values reduce overshoot and noise.
  • Kc = (1/K) · (T + 0.5L) / (τc + 0.5L)
  • Ti = T + 0.5L
  • Td = (T·L) / (2T + L)
Optional derivative filter constant:
α = τc·(T+0.5L) / (T·(τc+L))

How to use this calculator

  1. Select a tuning method based on your available test results.
  2. Choose controller mode: P, PI, or PID for your loop objective.
  3. Enter Ku/Pu from sustained oscillation, or K/T/L from a step test.
  4. For IMC, pick a speed (λ) that matches robustness needs.
  5. Press Calculate to show results above the form instantly.
  6. Apply gains carefully, then fine-tune using live trends.
  7. Download CSV or PDF to share settings and assumptions.

Why Accurate Gains Matter

PID gains shape rise time, overshoot, settling. Increasing proportional gain speeds response, but it reduces phase margin and can create oscillation. Integral action removes steady offset, yet too much integral can wind up and prolong recovery after saturation. Derivative action adds damping, but it amplifies noise unless filtered. This calculator reports ideal and parallel forms so you can match controller manuals and keep units consistent.

Collecting Inputs That Represent the Process

Closed-loop Ziegler–Nichols needs ultimate gain Ku and period Pu, measured at sustained oscillation with safety limits and alarms enabled. Open-loop methods use a step test and a first‑order plus dead‑time fit: process gain K, time constant T, and dead time L. Record enough points to see the delay clearly, and keep the step small to stay linear. Repeat the test to confirm timing stability.

How Methods Differ in Practice

Ziegler–Nichols targets a quarter‑decay response and can be aggressive on noisy loops. Cohen–Coon adapts to large L/T ratios and often improves tracking when delay dominates. IMC (lambda) lets you choose robustness by selecting a closed‑loop speed τc; larger τc reduces overshoot and actuator movement. Use IMC for most production loops, then consider Cohen–Coon when you must push bandwidth near the dead time limit.

Interpreting Results and Units

Ideal form uses Kc, Ti, and Td, where Ti and Td are time values in your selected unit. Parallel form uses Kp, Ki, and Kd with Ki expressed per time unit and Kd expressed in time units. The calculator converts between forms with Kp=Kc, Ki=Kc/Ti, and Kd=Kc·Td. For digital control, start with the suggested sample time and validate it against noise and computation delays.

Commissioning Checklist After Calculation

Apply gains in a safe mode, limit output, and verify sensor scaling before closing the loop. If the response overshoots, increase Ti or lower Kc; if it is sluggish, raise Kc slightly or reduce τc for IMC. Add anti‑windup when actuators saturate, and keep derivative on measurement with filtering when noise is present. Document final gains, test conditions, and any setpoint weighting so maintenance stays repeatable.

FAQs

What is the difference between Kc and Kp?

Kc is the ideal-form proportional gain used with Ti and Td. Kp is the parallel-form proportional gain. In this calculator they are equal, so Kp = Kc.

When should I use IMC tuning instead of Ziegler–Nichols?

Use IMC when you need robust, low-overshoot control or the loop is noisy. By choosing λ (τc), you can trade speed for stability and actuator wear, which is harder with fixed Ziegler–Nichols rules.

Why are Ki and Kd shown with units?

Integral and derivative gains depend on time scaling. Ki is per time unit because it multiplies the integral of error, while Kd is in time units because it multiplies the error slope.

My loop oscillates after applying gains; what should I adjust first?

Reduce Kc (or Kp) in small steps and retest. If oscillation continues, increase Ti to weaken integral action. For noisy signals, reduce Kd or add filtering and keep derivative on measurement.

Can I use minutes instead of seconds?

Yes. Select the time unit before entering Pu, T, L, or λ. The calculator converts internally and keeps Ki and Kd consistent with your selected unit.

Do these gains work for nonlinear or integrating processes?

They are best for near-linear, self-regulating loops that can be approximated by a first-order plus dead-time model. For integrating, nonlinear, or constrained systems, use these values as a starting point and validate with staged tests.

Related Calculators

Timer Prescaler CalculatorBaud Rate CalculatorUART Timing CalculatorPWM Duty CalculatorInterrupt Latency CalculatorRTOS Load CalculatorRAM Usage CalculatorHeap Size CalculatorPower Consumption CalculatorBattery Life Calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.