Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Quadrature encoder frequency measurement Incorrect values

Solved!
Go to solution

Hello,

I'm using a rotary encoder with phase A and phase B and a ground output attached to an M-series SCB-68 which is attached to an NI PCI-6221.

I'm using the Meas Dig Frequency-Low Freq 1 Ctr.vi which I added a while loop to and is attached below.

I have phase A attached to PFI 9 for frequency measurement. (I attached ground to D GND and phase B to PFI 10).

When I run the VI I obtain a frequency that fluctuates wildly reaching frequencies as high as 2285714 Hz.

I have used a multimeter between the phase A and ground wires and obtained a frequency of 118~122 Hz which is the number I expect.

What steps do I need to take to get the correct frequency in LabVIEW?

 

My ultimate goal is to find the RPM of the encoder which has 64 PPR.

 

Thank you for any assistance you can provide.

0 Kudos
Message 1 of 4
(6,409 Views)
Solution
Accepted by topic author pd1234

Hi pd1234,

 

You are probably picking up glitches on the transitions (encoders tend to be pretty noisy signal sources).  These glitches would register as very short pulses, which would in turn be calculated to represent very large frequencies.  To fix the problem, you should enable digital filtering (see M Series User Manual😞

 

Dig Filter Frequency.png

 

 

The above will pass through any pulses larger than 6.425 us, but will ignore the small glitches that you are likely seeing.

 

 

Best Regards,

John Passiak
Message 2 of 4
(6,406 Views)

I am interested in doing something similar but with a buffered freq measurement.  The problem is that I need to sync my sample rate with another AI task and am using the ai scan clock for this purpose.  If I attempt to sample the freq measurement faster than the encoder counts are coming in then DAQmx driver throws an error.  If my shaft is stopped or is running very slowly then this measurement technique fails.  I am wondering if there is a way to configure that DAQmx driver to overlook such conditions and just pass the previous measurement to the buffer under such conditions.

0 Kudos
Message 3 of 4
(6,389 Views)

Duplicate post (from sachsm).  I'll try to get back to it later today.

 

 

Best Regards,

John Passiak
0 Kudos
Message 4 of 4
(6,379 Views)