cancel
Showing results for 
Search instead for 
Did you mean: 

Reading RPM from Motor using hall encoder

totino5
Associate

I am trying to implement a code that can read the velocity of a DC motor with built in encoder. I am using STM32 F446RE and a CQrobot motor equipped with an Hall encoder.. specifications below:

http://www.cqrobot.wiki/index.php/DC_Gearmotor_SKU:_CQR37D

I wrote a code that uses 3 timers: one timer (TIM1) for PWM signals to send to the motor, another timer (TIM2) to use in encoder mode and the last timer (TIM7) that generates an interrupt every second so I know the time interval between two counts. I attached the code file. RPM values are wrong because I powered the motor with 5 V and give a duty cycle of 100% so I expect that my motor will speed up around 4500 rpm of the motor shaft and 22 rpm of the gear shaft. This code gives me values about 61 rpm. Anyone can help solving this issue? Thank you in advance.

0 REPLIES 0