This page was last edited on 6 November 2017, at 09:06. This page was last pid controller book pdf on 17 September 2017, at 13:24. I’ve decided to release this series of posts.
The last library, while solid, didn’t really come with any code explanation. This time around the plan is to explain in great detail why the code is the way it is. People directly interested in what’s going on inside the Arduino PID library will get a detailed explanation. Anyone writing their own PID algorithm can take a look at how I did things and borrow whatever they like.
It’s going to be a tough slog, but I think I found a not-too-painful way to explain my code. I’ll then improve it step-by-step until we’re left with an efficient, robust pid algorithm. The PID algorithm functions best if it is evaluated at a regular interval. If the algorithm is aware of this interval, we can also simplify some of the internal math. Not the biggest deal, but easy to get rid of, so we’re going to do just that. A good PID algorithm is one where tuning parameters can be changed without jolting the internal workings.
This last one isn’t a change in the name of robustness per se. Once we’ve addressed all these issues, we’ll have a solid PID algorithm. We’ll also, not coincidentally, have the code that’s being used in the lastest version of the Arduino PID Library. So whether you’re trying to write your own algorithm, or trying to understand what’s going on inside the PID library, I hope this helps you out. True double precision is WAY overkill for PID.