What's a PID?
We need to have our microcontroller control the heater to keep the temperature stable. It can heat the water by turning on the rice cooker (control), and it can measure the temperature with our waterproof sensor (feedback). The stuff in the middle is the the algorithm that ties these together. The PID algorithm is a type of feedback control. In this application, the temperature measurement is compared with the setpoint and the difference between them is called the error. The error is used to calculate an adjustment to the output which controls the heating element.The PID name comes from the three terms in the equation used to calculate the output:
-
P - The Proportional term looks at the present state of the process. Its value is proportional to the current error.
-
I - The Integral term looks at the history of the process. Its value is the integral of past errors.
-
D - The Derivative tries to predict the future of the process. Its value is the derivative or rate of change in the error..
These gotchas have been expertly addressed by Brett Beauregard in his Arduino PID Library. And clearly documented in his blog post: Improving the Beginners PID.