Showing results for 
Search instead for 
Did you mean: 

Interfacing Quadrature Encoder to uSB 6001/2/3

Can one use the PFI0 and PFI1  counter inputs pins of USB 6001/2/3 for measurement of quadrature encoder pulse inputs?

The quadrature encoder under consideration is having following details :

Type : Incremental encoder, Single turn 2500 ppr. 5V signal.
Interface signals : A, B and Zero.


Thanks & Regards


0 Kudos
Message 1 of 7

No, not really.  Those devices have a single counter with very limited functionality -- only capable of counting up on each edge of a single signal at either PFI0 *OR* PFI1, not both at once.  Also, all DIO is software timed, which is very unliikely to be sufficient for an encoder of that resolution.


It is at least *conceivable* that you might be able to capture the encoder signals as AI channels if you can sample at a high enough rate.  Then you'd need to work out the quadrature and z-indexing algorithms as a software post-processing step.  So it might be possible, but it isn't particularly desirable.



-Kevin P

0 Kudos
Message 2 of 7

Thanks Kevin for the reply,

One more thing which I forget to mention is that:

  • the speed of the operation of the servo drive is going to be very low. The control of it is going to be from the same application where I want to do the measurement. The usecase is to make a universal testing machine application. The idea is to measurement the linear distance of the travelled by the Jaw. The precision required is low.
  • I understand that there is no Z signal. The Z signal can be grounded to the Digital gnd.

Can one use the USB 6211 modules PFI0 and PFI1 pins for the measurement of the A and B pulse signals? OR which other DAQ card can be used for this signal measurement?


Thanks & Regards



0 Kudos
Message 3 of 7

The USB-6211 is definitely the better choice for an encoder interface.  It has 2 counters that are each capable of handling A,B, and Z inputs simultaneously and doing all the quadrature decoding right in the hardware.   It also has more flexibility for signal routing, allowing you more options for which PFI pins to wire up.


In general, *any* USB-based device will be a worse choice for a control system than a corresponding desktop device.  Windows is also not ideal for a control system, but if you only need to change occasional setpoints for the servo drive to lock onto, you may be ok.



-Kevin P

0 Kudos
Message 4 of 7

Hello Kevin,


Could you perhaps explain capturing the pulse with an AI channel with a sample rate, or point me in the right direction?  I bought the USB-6001 before realizing I needed 2 counters.  I'm also using DAQexpress and completely new to this.  Can I set a certain sample rate in DAQexpress? 


I am trying to read the rotational speed of a roller via an encoder.  I would probably be fine with just 1 channel.  The frequency would be at most 300 counts per second.




0 Kudos
Message 5 of 7

1. Find a shipping example for continuous AI acquisition.  Make sure you can capture both A & B channels from the encoder.

2. If your encoder signals are clean, you can simply compare whether each channel of AI data is > 1.5 V or thereabouts.  That'll produce a boolean array that's T when the encoder signal is high, F when low.

3. You now have a time history of boolean states for encoder channels A & B.  You'll need to implement a software quadrature decoding algorithm.  It needs to remember previous quadrature state (using a feedback node or unitialized shift register) as well as previous cumulative count.

4. I'd recommend sampling at ~10x the post-quadrature encoder count rate.  If channel A cycles at 300 Hz, counts will increment at 1200 Hz, and you should sample at around 12000 Hz.

5. A typical way to get samples from a continuous task is to get 1/10th sec worth at a time.  You could do this by requesting 1200 samples per loop iteration.  Then pass that data into your thresholding operation and your quadrature decoding routine.



-Kevin P

Message 6 of 7

No, you can't because those devices come with a single counter and have limited functionality.

0 Kudos
Message 7 of 7