 Approximations for first-order derivatives are made by backward finite differences.The integral term is discretized, with a sampling time formula_88, as follows,

The derivative term is approximated as,

Thus, a "velocity algorithm" for implementation of the discretized PID controller in a MCU is obtained by differentiating formula_5, using the numerical definitions of the first and second derivative and solving for formula_92 and finally obtaining