- Home
- :
- General Purpose Microcontrollers
- :
- Kinetis Microcontrollers
- :
- Measuring speed with Hall effect sensing on a BLDC...

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Measuring speed with Hall effect sensing on a BLDC motor.

06-12-2020
08:53 AM

63 Views

lancefisher

Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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%.

1 Reply

06-15-2020
09:48 PM

22 Views

diego_charles

NXP TechSupport

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi Lance,

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

Regards,

Diego.