LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle quadrature encoder pulses when the rotation direction changes

Apparently the drive mfg does this incorrect count (compares counts on A and B), which as you pointed out is incorrect, otherwise, why would they state too many or too few pulses on A or B?  We have found numerous faults in the drive software so it doesn't surprise me much they do this wrong too.  They are a major drive manufacturer, but I won't mention their name...they are a good company with great support.

 

Thanks Kevin.

 

Todd

Message 11 of 16
(1,308 Views)

If you have indeed corrected your code to count correctly...

 

I have seen issues in industrial environments where we ended up using a filter on the input lines. In the most recent case we were watching an encoder to track the rotation of a train wheel  as we did ultrasonic inspections. The filter cleaned it up very nicely. Not all hardware has the low pass filter options and (forgive me if I am wrong but is this running in a FPGA?) some de-bounce logic may help.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 12 of 16
(1,305 Views)

When a change occurs and any channel (A, B, Z), the timestamp, the change, and state of other the other encoder channels is logged is collected in the FPGA, passed to RT and stored on a USB drive.

 

The example that was previously linked does seem to work quite with my encoder data...but so does code I came up with that uses allowed states, sequencing to the next allowed state (i.e. 00 to 01 results in +=1, 11 to 01 results in -=1)...if I do a reset on a positive-going transition.

 

Works quite well...but not perfectly, I still get miscounts on the PGT (positive-going transition) of the index....still seems to get confused when the encoder goes the other direction, then back.

 

I'm giving up on this...I have spent far too much time on something that really doesn't matter...masking the faults on the drive works.

 

Thanks to all for helping.

 

Todd

0 Kudos
Message 13 of 16
(1,298 Views)

@Ben wrote:

If you have indeed corrected your code to count correctly...

 

I have seen issues in industrial environments where we ended up using a filter on the input lines. In the most recent case we were watching an encoder to track the rotation of a train wheel  as we did ultrasonic inspections. The filter cleaned it up very nicely. Not all hardware has the low pass filter options and (forgive me if I am wrong but is this running in a FPGA?) some de-bounce logic may help.

 

Ben


Differential line drivers/receivers are a massive help in noisy environments. I am a big fan of the am26c31 / am26c32 for this.

0 Kudos
Message 14 of 16
(1,274 Views)

Our encoder uses RS422 transmitters which are differential. The signals are pretty clean considering the large and noisy drives the cables are routed by.

 

I found an example in LabVIEW that seems to take into consideration how to interpret the index pulse (Quadrature Decoder.lvproj), which apparently varies by encoder vendor?. I wish I would have thought to check for the examples!

 

Here is an excerpt on the setting for this form the code:

 

"Specifies the states at which signal A and signal B must be while signal Z is high for the code to reset the measurement. If signal Z is never high while signal A and signal B are high, for example, you must choose a phase other than A High B High.  When signal Z transitions to high and how long it stays high will vary by encoder. Refer to the documentation for the encoder to determine the timing of signal Z with respect to signal A and signal B."

Message 15 of 16
(1,255 Views)

 


@labviewman wrote:

Our encoder uses RS422 transmitters which are differential. The signals are pretty clean considering the large and noisy drives the cables are routed by.

 

I found an example in LabVIEW that seems to take into consideration how to interpret the index pulse (Quadrature Decoder.lvproj), which apparently varies by encoder vendor?. I wish I would have thought to check for the examples!

 

Here is an excerpt on the setting for this form the code:

 

"Specifies the states at which signal A and signal B must be while signal Z is high for the code to reset the measurement. If signal Z is never high while signal A and signal B are high, for example, you must choose a phase other than A High B High.  When signal Z transitions to high and how long it stays high will vary by encoder. Refer to the documentation for the encoder to determine the timing of signal Z with respect to signal A and signal B."


Indeed thats true, if you ever use the DAQ assistant for any QE position task, when you enable Z you have to select the A and B phases for the index to be valid.

If only they had an option for Z inverted, they would have all the wacky QE options covered.

0 Kudos
Message 16 of 16
(1,249 Views)