- Home
- Articles
- Control Systems & PID
- What is a PID controller
// Article · Control systems
What Is a PID Controller? How Kp, Ki and Kd Work and How to Tune Them
PID is the most widely used controller in industry because the idea is simple: look at the error between the desired value and the measured value, then adjust the control signal from three viewpoints: the present, the past and the future of the error.
- where
- P = present · I = past (removes steady-state error) · D = trend (reduces overshoot)
- Start with Ziegler–Nichols, then fine-tune from the real response
The PID formula and transfer function
Let be the desired value, the measured value, and the error .
In the domain the controller can be written in two equivalent forms.
The first form is used in many software manuals; the second appears in textbooks and industrial controllers. Check which form your device uses before entering values.
What each term does
- P (proportional): a large error gives a strong command, a small error a gentle one. Raising makes the response faster, but too much causes oscillation or instability, and most systems still keep a steady-state error with P alone.
- I (integral): as long as some error remains, it keeps accumulating until the command is strong enough to remove it. This drives the steady-state error to a constant reference to zero, but it slows the response and can cause overshoot.
- D (derivative): looks at the rate of change of the error and brakes in advance, reducing overshoot, but it amplifies high-frequency noise.
Effect of increasing each gain on the step response
| Increase | Rise time | Overshoot | Settling time | Steady-state error |
|---|---|---|---|---|
| Decreases | Increases | Small change | Decreases | |
| Decreases | Increases | Increases | Eliminated | |
| Small change | Decreases | Decreases | No change |
This table shows general trends for low-order systems. The three gains interact, so tune them together rather than finishing one at a time.
Starting values with Ziegler–Nichols (closed-loop method)
Set and raise a little at a time until the system oscillates steadily. Record that as (the ultimate gain) and the oscillation period as , then read the values from the table.
| Type | |||
|---|---|---|---|
| P | – | – | |
| PI | – | ||
| PID |
You find and seconds
Starting values: , , . This method often gives high overshoot, so use it as a starting point and then reduce or according to the real response.
Problems you meet in practice
- Integral windup: the actuator saturates but the I term keeps accumulating, causing large overshoot when the error changes sign. Fix it with anti-windup, for example stop integrating while saturated.
- Noise in the D term: add a low-pass filter on the derivative, and take the derivative of the measurement instead of the error so a sudden setpoint change does not cause a kick.
- Dead time: the larger it is, the more you must reduce , and the D term helps little.
Keep learning in the library
The full lessons are in Thai, with English technical terms and the same formulas.
Frequently asked questions
What do Kp, Ki and Kd each do?
Kp reacts to the present error: raising it speeds up the response but risks overshoot. Ki accumulates past error and removes steady-state error. Kd looks at the trend of the error: it reduces overshoot but is sensitive to noise.
Why do some systems use only PI instead of PID?
Because the derivative term amplifies sensor noise. Loops with noisy measurements, such as flow and liquid level, usually use PI, which is simple and good enough. Slow processes with clean measurements may benefit from the D term.
What is integral windup?
When the actuator (valve, motor, heater) saturates but the error is still not zero, the integral term keeps accumulating. When the error finally changes sign it takes a long time to unwind, causing large overshoot. Anti-windup, such as stopping integration while saturated, fixes it.
Does Ziegler–Nichols work for every kind of system?
No. The closed-loop method requires letting the system oscillate continuously at , which can be dangerous on a real process, and the result is usually an aggressive, oscillatory response. Use it as a starting point and then fine-tune.