What is PID?

  • PID systems are found in a wide range of applications for industrial process control, sensor devices, and even robotics.
  • the first or P part of the PID controller, proportional. The I is integral, and the D is derivative.
  • These three modes are used in different combinations:
    • P - Sometimes used
    • PI - Most often used
    • PID - Sometimes used
    • PD - rare, but can be useful for controlling servomotors.

image.png

  • The idea of this algorithm revolves around manipulating the error.
    • Process Variable (PV - what we are trying to control, e.g. current temperature in our home)
    • Set Point (SP - e.g. the temperature we would like our home to be)
  • The PV is subtracted from the SP to create the error.
    • The error is simply multiplied by one, two, or all of the calculated P, I and D actions(depending which are implemented);
    • Then the resulting combination of error values are added together and sent to the controller output;
    • If the PV and SP are the same, we don’t have to do anything.
    • However, if there is a disparity between the SP and the PV, we have an error, and corrective action is needed.

      How the P(proportional) part of our PID controller works

Driving a car, and changing lanes on a freeway

image.png

Proportional control

  • There is the proportional only part of our feedback loop in the diagram below.

image.png

  • In proportional mode, the controller simply multiplies the Error by the Proportional Gain to get the controller output.
  • If P is large, then there is a tendency to overshoot, and then to overshoot again on the correction.

image.png

  • If we want to change something quickly, using proportional feedback only can cause overshoot and oscillation around the set point
  • On the other hand, too little(small KP), means that the change takes way too long.
  • So, let’s look at what happens when we add Integral control(I).

    Adding Integral control

    How can we allow for these disturnbances?

  • The integral works simply by resetting the bias of the gain until it’s zero again.image.png

  • The combination of Proportional and Integral action seems to do a reasonably good job of controlling our system. In fact, PI controllers are probably the most common configuration.

    Adding Derivative action

    The third type of action in PID control is the Derivative.

  • The effect of the derivative is to counteract the overshoot caused by P and I.

  • When the error is large, the P and the I will increase the controller output
  • This controller response makes the error change quickly, which in turn causes the derivative to act more aggressively to counteract the P and the I.
  • Kd uses the rate of change of the error to calculate its “damping” effect on the system.

image.png

  • Note the PID control brings it to the set point faster. However, the D action is very hard to fine tune, so If the PI is good enough for what is needed, that will get used.

    PID summary

  • The Proportional corrects instances of error;

  • The Integral corrects accumulation of error
  • The Derivative corrects present error versus error the last time it was checked.
  • Get it right, and PID is one of the best methods to control your IoT system