United States - Flag United States

Please confirm your currency selection:

Bench Talk for Design Engineers

Bench Talk

rss

Bench Talk for Design Engineers | The Official Blog of Mouser Electronics


Making Mathematical Sense of PID Controllers Mike Parks

Industry 4.0

If you’ve experimented with using sensors and actuators, you’ve probably come across the concept of a PID controller. Short for “proportional-integrative-derivative” and sometimes referred to as a three-term controller, PID is a control loop feedback mechanism. Simply stated, a PID controller keeps the output of a system constant based on a user provided setpoint.

For example, think of your thermostat. The setpoint would be the desired temperature you set at the thermostat, and, in turn, it triggers your HVAC system’s attempt to bring the ambient temperature to your desired temperature. A PID controller assists in that process by ensuring the HVAC system gets to your desired setpoint temperature as efficiently as possible, so as not to make the room cooler (or warmer) than desired and to prevent the system from constantly turning on and off. Failure to prevent this thrashing can cause undue wear-and-tear on mechanical components and increase energy consumption (and costs).

PID controllers are products of late 19th century and early 20th century theory and engineering. Nautical problems with ship steering and torpedo control were among the initial applications where early PID controllers were used. Today the PID controller concept has been reduced to software libraries that even low-cost, maker-oriented embedded platforms can take advantage of. While the abstraction of PID to a function call is certainly a timesaver, it’s still useful to understand the underlying concepts. That way you are better prepared to understand how and why the PID concept can be used in your control application.

P… I … D: Hello Calculus, My Old Nemesis Friend

I have been very open in the past that, while I survived engineering school, mathematics has never been a strong subject of mine. I struggled through high school for the most average of grades, and it wasn’t until college that a professor of differential equations (a former U.S. Navy submariner) finally helped me see the practical applications of math. My point? To appreciate the technology—and tune the controller parameters—we must first appreciate the terminology: Proportional, Integral, Derivative. To really grasp a PID controller we must first delve into a little math.

Proportional (Kp)

The proportional component (known as a tuning parameter) is the most straightforward concept of the three parameters. The proportional tuning parameter is simply the difference between the desired setpoint and the present output of a system.

Word of warning on terminology: Because we are using a feedback loop, the output of the system becomes an input to our PID controller for purposes of calculating the error between setpoint and the current system output. The PID controller attempts to minimize this error by generating an output control signal that will serve as an input to the system control mechanisms (e.g., speed up or slow down the fan). Just be careful when talking inputs and outputs so as not to confuse yourself. Thanks, feedback!

Integrative (Ki)

The integrative tuning parameter informs us of a duration of time, representing how long there has been a difference between setpoint and present system output.

Derivative (Kd)

The final tuning parameter, the derivative, informs us of the rate of change between setpoint and present system output—in other words, how fast is the gap between the setpoint and the current output closing to reach the desired end.

By taking all three tuning parameters into account, we can close the error quickly but not so fast as to overshoot, having to constantly over- and under-correct. The goal is to smoothly eliminate the error, but not as to remove the error as fast as possible (as it might lead us into overcorrecting). Table 1 shows how changing each parameter affects a system’s responsivity.

Table 1: Effects of increasing a parameter independently. (Source: Wikipedia)

Parameter

Rise time

Overshoot

Settling time

Steady-state error

Stability

Kp

Decrease

Increase

Small change

Decrease

Degrade

Ki

Decrease

Increase

Increase

Eliminate

Degrade

Kd

Minor change

Decrease

Decrease

No effect in theory

Improve if Kd small

 



« Back


Michael Parks, P.E. is the co-founder of Green Shoe Garage, a custom electronics design studio and embedded security research firm located in Western Maryland. He produces the Gears of Resistance Podcast to help raise public awareness of technical and scientific matters. Michael is also a licensed Professional Engineer in the state of Maryland and holds a Master’s degree in systems engineering from Johns Hopkins University.


All Authors

Show More Show More
View Blogs by Date

Archives