Using Single Ended and Differential Quadrature Encoders With NI DAQ Cards

Updated Nov 19, 2020

Environment

Hardware

  • Quadrature Encoder
  • PXIe-6341
  • PCI-6229
  • PXIe-6612

Driver

  • NI-DAQmx

I have a quadrature encoder that I want to use with my NI data acquisition (DAQ) card, but I am unsure what measurements I can take and how to connect the encoder to my DAQ card.

If you are not already familiar with the fundamentals of quadrature encoders, please see the Encoder Measurements: How-To Guide​.

How you use your quadrature encoder with your NI DAQ Card depends on whether you are using a single ended or a differential quadrature encoder.
 

Single Ended Quadrature Encoder

A standard single ended quadrature encoder has up to 3 channels— A, B and Z.
There are also 3 types of encoding possible, X1, X2 and X4.
These are explained in the Additional notes section below. 

To use your quadrature encoder with your DAQ card, connect channels A, B and Z to the counter's SOURCE, AUX and GATE pins, respectively. To find the pinout specific to your DAQ card, right click the card in NI MAX and select Device Pinout. Refer to the guide Connecting Quadrature Encoders to a DAQ Device for step-by-step instructions for wiring and configuring your NI DAQ device for quadrature encoder measurements.

 

Differential Quadrature Encoder

Differential quadrature encoders typically have 2 signals for each channel, where the second signal is the inverse of the first. These are often labelled either as plus and minus, or the second channel is specified as the inverse or compliment. Most NI-DAQ cards do not support differential encoder measurements. The alternative would be to use the NI-9411's differential digital inputs to measure the encoder's differential outputs. 

However, we can use these differential encoders in the same way we would use a single ended quadrature encoder. You can connect just the A, B and Z index channels to the SOURCE, AUX and GATE pins on your counter, this will allow the encoder to operate as though it is a single-ended device. You can also make the same connections with the A inverse, B inverse and Z channels to a second counter. 

Additional Information

Channels A and B are both output by the quadrature encoder 90 degrees out of phase with each other. Images of the A and B channel outputs are shown below. The direction of rotation is determined by which phase leads. When phase B leads A, then the shaft is rotating in the counter-clockwise direction. 


The types of encoding (X1, X2 and X4) simply determine what edges of channel A and B signals the counter increments/decrements on. For more information about these types of encoding, see page 7-15 of the M Series User Manual

It is also important to note that when setting up a counter task in DAQmx, the PPR (Pulse per Revolution) is a property of the encoder itself and its value will not change with the selected encoding type. DAQmx will internally adjust its calculations for X2 and X4 encoder measurements. There is no need to scale this value by 2 (for X2) or by 4 (for X4).