This article comes to summarize the fantastic video that Peter Harrison made a few days ago on YouTube about the simplest and most effective way to tune a PID in a few minutes instead of days. I followed that video to tune the LibreServo PID and the results were amazing.
There are hundreds of guides on the Internet on how to adjust a PID and they can all be summarized in the following simple steps:
- Set KD and KI to zero and increase KP until the system corrects the error and starts oscillating. That would be the maximum KP
- Increase KD until the KP oscillation stops.
- Increase KI slightly so that the system fully corrects the error.
They seem like three simple and quick steps, but the reality is that in the end it becomes a sort of trying to guess the constants and after hundreds of tests and hours, if you are lucky, you get a relatively stable PID. It is a rather cumbersome task that rarely achieves a completely satisfactory result.
Let's forget about all that and try to obtain KP and KD mathematically. KI in a dynamic system is not necessary on most occasions and introduces more disadvantages than advantages, so we will forget about it for now. From now on, although I talk about a PID, I am really referring to a PD.