Measuring speed with Hall effect sensing on a BLDC motor.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Measuring speed with Hall effect sensing on a BLDC motor.

1,053 Views
lancefisher
Contributor III

I came up with what I think is a novel method for measuring speed from the Hall effect inputs that I believe is better than what I've seen in example BLDC projects from NXP.  The common approach measures the time between each transition on the Hall effect inputs with a Timer in Input Capture mode fed by the XOR of the three Hall effect signals.  Depending on the motor, it's not unusual to see a 10-20% difference in the measured times when running at a constant speed but sequential measurements for the same sector are much more tightly grouped.  This variation in the speed measurement adversely affects the speed control loop and while a low pass IIR or FIR filter can remove the variance it adds delay and limits the bandwidth of the loop.

My approach implements a 6 element array indexed by the Hall effect sector number or raw Hall effect value (either works the same).  The interrupt handler for the Hall effect capturing timer simply stored the latest time measurement in the array element corresponding to the Hall sector and then updates the speed measurement to equal the sum of the elements in the array.  To minimize the time in the interrupt handler this can be accomplished by subtracting the existing value in the element from the sum before storing the new value and adding it to the sum.  Also calculating the actual speed value which may involve a time consuming divide operation doesn't need to be done in the interrupt handler, the sum of the 6 time intervals can be converted to a speed value in the speed loop itself. Further filtering can also be performed in the speed loop code if necessary and the bandwidth of that filter can be quite a bit higher than what would be required if the sector to sector variance were present in the filter input.

The array can be initialized with all elements equal to a value representing the the lowest possible speed  but regardless of the initial values in the array the sum will become correct once all six Hall effect sectors have been measured once as long as the math doesn't overflow.  If it's important to have a valid measurement before that, the handler can count the interrupts since the motor started (limited at 6) and  feed that to a switch statement which generates the correct sum based on the number of valid time intervals available.

I've tried this with a few different motors and in all cases the variation in the speed measurement at any constant speed was under 1%. 

0 Kudos
1 Reply

1,012 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi Lance,

Thank you for sharing your method for the review of the members of this community!

Regards,

Diego.

0 Kudos