PID Control - A Brief Introduction

PID Control - A Brief Introduction
Submitted by Brian Douglas on 12/25/2020
Explanation 9 resources
Last Edited: 10/27/2023

This journey covers the very basics of PID control.  The goal is to give you an intuitive understanding of the controller, how to implement it in code, and how to tune it.  Plus, if you're up for the challenge, at the end of the journey you can test one out on hardware.  It is broken up into several sections:

  1. Introduce the basic concepts - an overview of the PID control with minimal mathematics
  2. Write your own controller - give it a shot!
  3. Tuning introduction - different ways to approach tuning (model-based and heuristics)
  4. Additional topics - Cascade control and discrete PID
  5. Try it yourself - build a PID controller on hardware and test it out

Introduce the basic concepts - I think it's helpful to get a good intuitive sense of what a PID controller is trying to accomplish before we jump into any of the mathematics. In this video, the thing you should take away is understanding why the three terms of a PID controller are suitable for so many types of control problems.  Once you can think of P as 'responding to current error', I as 'responding to the past error', and I as 'responding to future error', I think it'll be easier to set up, tune, and test your controller.

Write your own controller - These articles by Brett Beauregard are a must read! This will get you beyond thinking of PID control as just a simple 3-term function and get you thinking about the practical implementation of the controller.  This is important to understand for when we are writing our own controller from scratch later in this journey.

Tuning introduction - This video doesn't go into any particular tuning method for PID, but it does provide an overview of different approaches you can take. I think it'll help make sense of all of the different PID tuning resources you'll come across later.  

Tuning introduction - This video is focused on building a mathematical model of your system.  I'm putting it in the 'tuning introduction' section because going forward we're going to lean heavily on model-based techniques for PID controller design and you need a good model of your system in order to use them!

Tuning introduction - Now that we understand what goes into building a model of your system, this video covers some of the ways to use that model to tune a PID controller.

Additional topics - Most PID controllers are implemented on a digital computer, which means we're not dealing with a continuous system but a discrete system. This video introduces discrete PID control (and as a bonus it also talks about cascaded control loops, win-win!)

Additional topics - If watching videos on PID control is not for you, this resource covers some of the above information with easy-to-understand text.  

Try it yourself - I think the best way to learn PID control is to try it out yourself! The Temperature Control Lab is a nice kit that contains an Arduino, a couple of temp sensors, and a couple of heaters.  This lab is easy to use and there are tons of great resources for it on John Hedengren's website.  The next resource in this journey follows along with one of his PID controller design examples.

Try it yourself - Once you have the Temperature Control Lab, check out this PID controller example.  And while you're on the site, definitely check out all of the other resources that use the TCL.