cancel
Showing results for 
Search instead for 
Did you mean: 

Count the motor's revolutions

Christophe65
Associate II

Hello,

I am controlling my motor with the Hall effect sensor first. I am not using any auxiliary sensor. I am able to control my motor correctly, and I can visualize the angle from the Hall sensor. I need to evaluate the number of turns the motor makes and be able to reset this counter to zero at the start. Thank you.

3 REPLIES 3
GMA
ST Employee

Hello @Christophe65,

Plotting HALL_EL_ANGLE computed at "HALL_CalcElAngle(&HALL_M1);" call, an angle transition from positive value to negative value gives you an electrical lap, divided by pole pair value value gives you the mechanical lap.

GMA_0-1728490271404.png

Gpio are available to trig an interrupt to clear your local counter (as Start button feature).

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

Hello, I can't seem to get the angle traveled by the motor. What method should be applied with the ST MC library? The Control Pilot application seems to be able to read it since it displays it, but how can I retrieve it in my C project to deduce a traveled distance in degrees? Thank you.

As per my understanding 

HALL_Handle_t HALL_M1
and typedef SpeednPosFdbk_Handle_t
int16_t hElAngle;                   /*!< Estimated electrical angle reported by the implemented speed and position
                                           method. */

 

The hElAngle variable of int16_t data type can be used or read it into another variable and perform the necessary action.