Hi guys
I have dc motors with quadrature hall effect sensors (just using one channel for now) that at full speed have a tick about every 20 ms (per channel).
I want to be able to do speed control and later on maybe self balancing.
To get speed, if i use time between ticks, as the motor slows down, time between ticks becomes larger and larger, meaning two very small speeds can have very large time difference between them causing problems for PID control.
Ideally i would have something that measures the amount of ticks during a certain time interval (value proportional to RPM) but given that the encoder is slow this time interval would have to be large, resulting in a slow update frequency, which would difficult self balancing later on.
It seems my best option would be to measure time between ticks (polling or interrupt) and invert the value (1/x). This would give me true speed but this means going into floats which i would prefer to avoid for the sake of update frequency.However given that worst case scenario i would have to do the 1/x operation twice every 20ms this probably is not that bad.
Any thoughts?
Regards