Data Acquisition: Troubleshooting Incorrect Encoder Readings

Updated May 13, 2024

Reported In

Hardware

  • Encoder
  • Quadrature Encoder

Driver

  • NI-DAQmx

Issue Details

I have a DAQ system that generates incorrect readings from my encoders. Are there troubleshooting tips for incorrect readings?

Solution

  • Confirm that the pin connections to the counters are correct.
    • Verify the pinouts for your device in Measurement & Automation Explorer (MAX) by right clicking the device and selecting Device Pinouts, or by looking in the NI-DAQmx Help file under Connecting Counter Signals.
    • If you're using a differential encoder, refer to the following article under the section "Differential Quadrature Encoder": Using Quadrature Encoders With NI DAQ Cards
  • Check ground connections, DGND to Device Ground.
  • Try different counter and ground connections, or try swapping out your counter for a different one.
  • Check your that your Z-Index is disabled while you are troubleshooting.
  • Ensure your device can accept the encoder signal type.
    • Some devices can only accept external signals that follow TTL specifications.
  • Check or switch the phase A and B connections to see if they are wired correctly.
  • Check to see if there is excessive noise on your signal, and enable a digital filter on the encoder inputs if your device supports it.
  • Check your encoder's mode (X1, X2, X4) and see if it corresponds to the data you expect.

Additional Information

Noise
For general considerations regarding noise, see the White Paper: Field Wiring and Noise Considerations for Analog Signals

Grounding your Device
RGND stands for Reserved Ground. These are additional ground pins that can be used for noise reduction in some cables. If you think you might have noise on your encoder signal lines, you can use an Analog Input NI-DAQmx task to see if any noise or glitches are present that could cause erroneous results. 

X1, X2, X4 Encoding
Counters on M Series, C Series, and NI-TIO devices support three types of decoding for quadrature encoders: X1, X2, and X4. With X1 decoding, and signal A leading signal B, the counter increments on the rising edge of signal A. When signal B leads signal A, the counter decrements on the falling edge of signal A. With X2 decoding, the same behavior holds as with X1 except the counter increments and decrements on both rising and falling edges of signal A. Similarly, with X4 decoding, the counter increments and decrements on both rising and falling edges of both signal A and signal B. X4 decoding is more sensitive to position but is also more likely to provide an incorrect measurement if there is vibration in the encoder.