Hi All,
I am trying to implement a closed-loop speed controller using encoders. My encoders have only 3 pins. (PWR, GND, and SGN)
I fed the output from the eQEP (QPOSCNT) to a GPIO pin (digital output) to display the signal using my oscilloscope.
My measurements showed that the period of the QPOSCNT signal is changing as the duty cycle of the PWM signals changes (as expected).
At 20% duty cycle: the period of QPOSCNT is 344ms.
At 40% duty cycle: the period of QPOSCNT is 47.20ms.
Now, how can I calculate the angular velocity from the QPOSCNT signal?
My guess is to configure a rising or falling edge interrupt, count the number of edges in a fixed period (e.g. 1 second) and then calculate the angular velocity using the formula below:
w_rpm = (N/Nppr)*(60sec/1min)/T
where N is the number of edges, Nppr is the number of slots in the encoder (mine has 10), and T is 1.
But if this is the correct way of doing it, why are we using the eQEP in the first place? I could have triggered an interrupt directly from the SGN pin of the encoder (which also outputs a square wave whose frequency is proportional to the w_rpm.)
Image of my encoders: