Proportional – your error, the value between where it is now and where it should be.
error = (target value) – (sensor reading)
Integral – the running sum of previous errors, used for making fine movements when the error is small.
integral = integral + error*dT
Derivative – the change in errors, used to predict what the next error might be.
derivative = ( (current error) – (previous error) ) / dT
The loop – the calculations all need to be run inside a loop – don’t forget to include it!
Put the three components together, plus some accurate values for Kp, Ki and Kd, and you will have a very consistent and accurate controller.
Download:
PID Controller Guide.pdf (141.0 KB)