What is PID?
PID stands for Proportional, Integral, and Derivative and is a type of feedback control system. It
compares a measured value (from a sensor, say) against a desired value (the setpoint or aim) and
adjusts outputs to reduce the difference (error) between the two.
The controller (or ECU in our case) uses a constantly updating calculation to control a physical
system. It looks at the current value of the error, the integral of the error over a recent time interval,
and the current derivative of the error signal to determine not only how much of a correction to
apply, but for how long.
A Real World Analogy
Think of a driver with no brakes wishes to stop a car at a set of lights. The driver is using the
accelerator pedal to give the car forward movement to get to the lights. The closer the car gets
the less the driver pushes on the accelerator pedal. The amount of throttle is the Proportional Gain.
The Driver is relying on the car to slow down because of rolling friction between the tires and the
road. If the driver is trying to get to the lights quickly, more throttle will be used.
The problem is that if the driver relies solely on the rolling friction to stop the car, they may roll
straight past the lights and then need to put the car into reverse and head back. This could
happen several times before the car comes to rest at the lights and the faster the driver tries to get
there, (better system response) the worse the over/undershooting problem becomes.
Now consider if the driver also has a braking system. When approaching the lights they can reduce
the amount of throttle to slow the car and also apply the brakes to reduce the speed. The brakes
act as the Derivative component of the system. It is logical to suggest that with the throttle and
brakes the driver can now get to and stop at the lights with greater ease and generally more
quickly, with less over/undershoot.
Now consider the driver has to do this when the lights are on a slight upward sloping hill. The driver
can perform the stopping exercise using the throttle and brakes but the car will start rolling
backwards when it is stopped. The driver now needs to apply a little bit of throttle (assume the
brakes are ONLY for reducing speed and not to stop movement) to hold the car at the stopping
point so it does not roll backwards, this is the Integral component of the system.
It can be seen that if the same driver has a very powerful car, the amount of throttle and brake
needed to get to the set of lights is different to the amount of throttle and brake needed for a less
powerful car. Obviously the high powered car will get the job done quicker but with more energy
needed and therefore more stress on the equipment.