The pid controller

Control of the brake signal is implemented in the software using a so-called PID control loop. Using this, you need to setup 3 parameters for your brake, Kp, Ki and Kd.

Here is a schematic of the PID controller with its outputs and inputs:

e(t) is the Error signal (actual RPM – target RPM) which should be as small as possible. The 3 equations P, I and D use this error signal to create 3 components that are summed together to create the PWM signal, which controls the brake. The actual RPM is fed back again to create e(t) together with the target RPM (which by now might have changed slightly depending on the curve).

The quick start guide is to set Kp = 0.3, Ki = 0.15 and Kd = 0. If you see oscillations, reduce Kp. You will see some steady state error, which is fixed with the Ki parameter, but first get it stable with only Kp.

You don’t need to understand how the PID controller works, but you should however have a certain feel for what the three parameters, Kp, Ki and Kd do if you want to optimize your system. Read on!

This is the proportional component. Many control systems work only with a Kp parameter. It is the first parameter to setup (leave the others at 0). Here is how to think about it.
Higher Kp = less error, so you want Kp as high as possible
Too high Kp = oscillations, an unstable system
Setup procedure:
Increase Kp until the system becomes unstable, then reduce back to get a healthy margin. At this point, with only Kp non-zero, your system should be stable, but will have a steady state error. For example, if your brake curve is set to hold say 5000 RPM, the brake will actually hold say 4700 RPM. How to fix that? Enter Ki:

This is the integral component. This component is a steady state error remover.
Higher Ki = shorter time to reach 0 steady state error
Too high Kp = oscillations, an unstable system
Note that with any positive Ki, the steady state error will eventually become 0. The parameter only sets how fast it becomes 0.
Setup procedure: Once Kp is set, start with Ki = 1 and increase until unstable. Reduce firmly back to safety. Check how it behaves in ramps and steps in RPM.

This is the derivative component. It can in certain setups help increase stability, but in many cases it makes the system less stable. It is recommend always setting it to 0, except for water brakes that need a small Pd. Start with for example 0.05.


Last updated byJostein on March 23, 2019

Leave a Reply

Your email address will not be published. Required fields are marked *