RPM Measurement

RPM measurement is done using the filtered time of the zero-cross. This means that the RPM is calculated using only half of a trapezoidal step (the point in time when the motor commutates to the point where the zero cross is found). As such, the precision of the motor RPM detection decreases.

The RPM is then computed using the zero-cross timer value, multiplying it with two to get the duration of a trapezoidal step, multiply it with six to obtain the electrical period. After this, it is just a matter of plugging the value into the formula RPM=120/(Te×P) , where Te is the electrical frequency, and P is the number of the pole pairs specific to the motor.

To compensate for this effect, the TCA1 timer/counter prescaler was adjusted in such a way that at low speeds, it does not overflow, while also obtaining the highest value possible.

The process of establishing the best prescaler was done by printing the zero-cross timer value and changing the prescaler to get the maximum value possible at the minimum RPM (that is, the maximum time interval between commutation and zero-cross signal).