Skip to main content
Associate III
September 4, 2024
Question

Count the motor's revolutions

  • September 4, 2024
  • 1 reply
  • 901 views

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.

    1 reply

    GMA
    Technical Moderator
    October 9, 2024

    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
    Associate III
    August 14, 2025

    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.

    Senior III
    August 14, 2025

    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.