PID – One Algorithm to Rule them All

Posted on March 28, 2018 by bryan costanich Leave a Comment

Of all the various algorithms used in controlling systems; probably the most common, the most versatile, and the most useful algorithm is the Proportional, Integral, Derivative (PID) method. PID is a mathematical tool for efficiently affecting change in a system to get it to a particular target state, and keeping it there, harmoniously.

It’s the algorithm that keeps drones balanced in the air, your car at the right speed when cruise control is on, and ships on the right heading with variable winds. It’s also the algorithm that efficiently heats a cup of coffee to the perfect temperature and keep it there. Wanna build a self-balancing robot? You’ll need PID.

Consider the following graph of heating a cup of coffee from room temp to 75ºC. The green line represents the ideal, that is, we decide that our coffee which sits at 22ºC (72ºF) is too cold to drink, and so we want it instantly heated to 75ºC. This “ideal value” is also known as the reference, target, or setpoint (SP) signal. And the blue line represents an efficient realization of the reference signal in the real world; in which it takes time to heat the coffee to that temp:

In this idealized example, the coffee is quickly brought up just past the target temperature, and then stabilized.

The PID algorithm is a tool to heat the coffee just as illustrated above: efficiently. That is, with only a small amount of error, defined as the area between the reference temperature and the actual temperature.

PID is a foundational algorithm in industrial control and so we’re excited to bring you a comprehensive set of resources for using it, including:

Check out our PID guide which covers control theory, ideal and standard PID algorithm theory, implementation, and usage.

We’ve add first-class PID support to Netduino.Foundation which includes both a StandardPIDController and an IdealPIDController , as well as an IPIDController interface and PIDControllerBase for implementing your own, custom PID controllers.

Check out the Dehydrator3000 sample app, which illustrates how to use PID in the real world.

More PID Goodness Coming Soon

Stay tuned for more PID examples, as well as a guide for PID tuning!