This was dug up from the classic archives of Prof. John Blackwell, coffea arabica machina extraordinaire. An interesting read for those not familiar with or can use a refresher on the messy mechanics of how a PID controller works.



by John Blackwell

In an espresso machine we have an electric heating element in water and we are trying to control a given setpoint (maximum achieved temperature).

The THERMOSTAT is an electromechanical switch trying to control the on/off cycle of the heating element in water. The thermostat can turn off the heating element at the exact setpoint, but the heating element is still hot (it can not cool instantly) and continues to heat the water causing a temperature raise above the ideal setpoint (the problem). So what to do? Position the setpoint lower so it turns off sooner then rises to the desired maximum. Oh great now, at least the water did not get too hot but it has to cool down to the lower setpoint before it will turn on. The best we can do now is to have a thermostat with a very narrow bandwidth (the difference between on and off setpoints) and hope for the best in our cycle of heating and cooling.

PID can be described as a set of rules with which precisely regulates a closed loop control system. In our heating element in water example, the PID predicts when to control the on/off setpoint, making corrections so the heating element does not under or over shoot the desired temperature.

How PID works without the math? Closed loop control system means a method in which a real time measurement of the process being controlled is constantly fed back to the controlling device to ensure that the value which is desire is, in fact, being realized. The mission of the controlling device is to make the measured value, known as the process variable, equal to the desired value, usually known as the setpoint. The best way to accomplish this task is to use the control algorithm known as PID.

In its basic form, PID involves three mathematical control functions working together. The most important of these, Proportional control (the P), determines the magnitude of the difference between the setpoint and the process variable (known as the error), and then applies appropriate proportional changes to the control variable to eliminate the error. Integral control (the I) examines the offset of the setpoint and the process variable over time and corrects it when necessary. Derivative control (the D) monitors the rate of change of the process variable and makes changes to the output variable to accommodate unusual changes.

Each of the three control functions is governed by a user defined parameter. These parameters can be adjusted to optimize the precision of control. The process of determining the values of these parameters is know as PID Tuning, or BIG MATH!!