I haven't found a text that explains the PID controller in simple words. I know the theory: that it calculates the derivative and the proportional gain and the integral etc, but I need to know in reality what is the output of each function and each combination of functions.

For example, starting with the proportional: it sends an input that is proportional to the error recorded. So if the error is 5 V, does it do $\frac{1}{2}\cdot5\text{ V}$ to diminish it? or $\frac{1}{5}\cdot5\text{ V}$? or $-\frac{1}{5}\cdot5\text{ V}$ or what? I don't understand.

As for the derivative, it monitors the derivative across a specific time? And then does what? Also, what if there is a noise/disturbance at the begining, so the PID controller will not have normal use rates of change to compare? Same with integral. Can you point me to a good resource or explain me please?


3 Answers 3


A PID function that most people use every day is the hand-eye coordination to steer a car or bicycle. Your eyes are the input, the angle of the steering wheel/handle bars is the output. The set point is usually the center of your lane (until a deer hops out or a dog chases you).

Your mind has to constantly consider 3 different factors when preforming this task. The importance it places on each factor is based on past experience, which is called "tuning" in the PID world.

Proportional: "I am a long ways from the center of the lane, I should turn back that direction."
Naturally, if I am further away I want turn sharper than if I am very close. This will allow me to get back to the center of my lane in a timely manner.

Derivative: "I better not just yank the wheel/ handle bars over that direction or I will over-correct, roll, and crash."
You may be in the gutter, but your driving experience teaches you that if you turn sharply things will change very quickly and you need to reduce how sharp you turn to keep from over shooting your set-point and entering on-coming traffic.

Integral: "The wind keeps pushing me to the edge of the road, and I have to turn into it to stay on coarse"
You are pretty close to the center of your lane, but not quite where you want to be. Proportional is small because you are really close and Derivative is small because you are not changing very fast. Integral is the term that steps in and says "Hey now, I know we are not off by much but we have been off for a pretty long time; how about we turn into the wind so we can hold our set point."

PID's aren't perfect, and your steering abilities are actually quite a bit better than a standard PID. You are smart enough to realize that when the wind disappears (for some unknown reason) you zero out your integral term and don't wander into opposing traffic while waiting for the wind to come back. Humans also self tune during operation by considering other inputs like accelerations and physics, while most machines/computers are not currently capable of this.

  • $\begingroup$ Thanks nice explanation. So to sum up, proportional correction would be ideal but it has these disadvantages: it cannot cope with the inertia, it cannot cope with external noises. That's why we need D to cope with inertia and I to cope with noises. Is this a good summary? Do I miss anything? $\endgroup$
    – ergon
    Mar 1, 2016 at 10:57
  • $\begingroup$ Proportional works great when you have a long time to get there. Just tune it over damped and it will work fine. Integral makes sure that we reach our true set point when we are close but not quite there. Derivative is most important when we want to get to our set point quickly. Proportional is set more aggressive then Derivative is used to reduce the overshoot; not only to counteract inertia but counteract the output as well (angle of the steering wheel). $\endgroup$
    – ericnutsch
    Mar 2, 2016 at 16:05
  • $\begingroup$ The PID does not know the system @ergon. Thats the beauty of the PID, but also its biggest failing. It is not able to anticipate things, it can only react. Derivate is in practice a bit hard since its often noisy due to how its being measured. It mainly counter balances big P values. $\endgroup$
    – joojaa
    Dec 24, 2016 at 15:53

In intuitive terms I have found the following explanation to be useful.

For the sake of argument lets say that our system is filling a bucket with a hole in it water from a tap. We measure the depth of water in the bucket and control the flow rate of water via a tap. We want to fill the bucket as quickly as possible but don't want it to overflow.

The proportional element is a linear measure, in this case the height of the water in the bucket this is a useful measure of how full the buck is at a given time but it tells us nothing about how quickly it is filling so by the time we notice it is full it may be too late to turn off the tap or if we fill it too slowly water will leak through the hole faster than it fills and it never quite gets full.

On paper this sound s like it should be enough on it's own and in some cases it is, however it break down when the system itself is inherently unstable (like an inverted pendulum or a fighter jet) and the lag between measuring the error and the input taking effect is slow compared to the rate at which external noise induced perturbations.

The derivative element is the rate of change of the water level. This is especially useful when we want to to fill the bucket as quickly as possible eg we might open the tap as far as it will go at the start to fill it quickly but close it off a bit once the level gets near the top so we can be a bit more precise and not over fill it.

The integral element is the total volume of water added the bucket. If the bucket has straight sides this doesn't matter much as it fills at a rate proportional to the flow of water BUT if the bucket has tapered or curved sides then the volume of water in it starts to have an effect to the rate at which the water level changes. More generally because this is an integral it accumulates over time so applies a greater response if the P and D elements aren't correcting enough eg by maintaining the bucket at half full.

Another way to look at this is that the integral is a measure of the cumulative error over time and is effectively a check on how effective the control strategy is at achieving the intended result and is able to modify the input depending on how the system really behaves over a period of time.

So in summary :

the P (proportional) element is proportional to the variable that you want to control (like a simple thermostat)

the D (derivative) element is proportional to the rate of change of that variable

the (integral) element is perhaps the most difficult to understand but relates to the quantity that your P parameter is measuring typically this will be a cumulative quantity like volume, mass, charge, energy etc.

  • $\begingroup$ Amazing answer, best explanation I have found anywhere. But 2 further questions: 1. How are parameters tuned? Automatically, or otherwise? If it were just one parameter, I vaguely see how it could be nudged up or down, algorithmically for example, eventually arriving at a stable value. 2. In a way, this value itself leads to the need for a PID system if the nature of the environment were to change. For example, if the bucket or tap were to be changed, how could the parameters be made to adjust most efficiently? I hope this is not asking too much, perhaps it warrants a separate question or two? $\endgroup$
    – Jodes
    May 4, 2016 at 6:50
  • $\begingroup$ Tuning the parameters really comes down to how you model the system in the first place. You can do this mathematically with Laplace transforms which model the system response in respect to frequency ie you treat it as a mass/spring/damper system. Or you can just have a physical system where you just tweak actual dials and knobs. In practice it may well end up being a bit of both, the mathematical model gives you a reasonable starting point which you fine tune in response to real world behaviour. $\endgroup$ Dec 24, 2016 at 0:22
  • $\begingroup$ @Jodes in practice real systems many have behavioirs that can not be known beforehand with modeling. $\endgroup$
    – joojaa
    Dec 24, 2016 at 15:48

PID controllers use tuning parameters to adjust the response.

From the equation for PID control:

enter image description here

The three K-subscript terms are the tuning parameters, and there's one for each term of the PID controller output: proportional, integral, and differential.

So, for example, with an error of +5V and a Kp of 0.3, the output would be 1.5V. Likewise for the integral and differential terms.

In practice, these parameters are determined experimentally. The Ziegler-Nichols (pdf) tuning method is a simple heuristic method that used to be very popular in industry.

These days, most off-the-shelf PID controllers and PLC functions have built-in tuning.

Hope that helps!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.