pwm speed calculation
In my application, i will need to measure the range of speed from few rpm to ~150rpm. Thus, the speed is quite low in term of rad/s
U mentioned that i may also have to write extra software if the 16 bits of the timer are not enough at very low speeds.
So, do you have any recommendation on that?
What is the extra software u meant for? Can give a sample code/algorithm?
Now, i will like to get the captured value(then convert to time) and then compare with the PWM period, if it is equal the PWM period then mean nothing change to the position, so it is no speed. For example:
R == rising
F == falling
T == period of PWM(encoder)
If i chose to detect the falling edge of the signal, then the captured value will be from F1 to F1, T1, and it will not be the same as T, period of PWM signal, and this mean that the time is not for one rotation, i.e. 2pi(since the speed i need to measure will not be so fast). Therefore, need to calculate the radian increasing in that period.
d_theta = ((T-T1)/T)*2*pi;
let's say 1cnt ---> 0.025us
163840 cnt ---> 4096us , i.e. cnt for T, period of PWM of encoder
thus, d_theta = ((163840 - cnt)/163480)*2*pi;
speed = d_theta/(cnt*0.025e-6);
*Can you give any comment of my idea on the above calculation?