From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does my linear encoder only read negative?

Solved!
Go to solution

I have a linear encoder I am trying to utilize with an NI cDAQ 9184 & 9401.  I basically used the linear encoder example I found here on the NI website, however, when I run the program I am finding that only measuring in one direction is the displacement reading accurate.  By that I mean when my encoder is moving upward (in actuality my fixture is moving down and the encoder is fixed) I am measuring displacement correctly, but when moving in the opposite direction I am way off.  I am not off a linear amount either, very different each time.  Sometimes when the movement first starts it almost seems like the device is resetting back to initial position (0") but I am clueless as to why.  Does anyone have any idea on how to rectify this situation?

I am fairly confident I have things wired correctly as this same encoder/setup reads correctly in MAX, see the second screen shot.

Download All
0 Kudos
Message 1 of 6
(7,826 Views)

*Correction, I am having the same problem in MAX as well.  Reads perfect in one direction but not in the other. Why is this?

0 Kudos
Message 2 of 6
(7,796 Views)

Hi PHDMFG,

 

Does your encoder have a Z index? Sometimes this is needed to run the encoder in both directions.

 

When you say your position "defaults" to your initial position of 0" sometimes when the movement first starts, is this also when the VI first starts, or does it also happen after the encoder had been sitting still for a while, and then moves again (without restarting the VI)?

 

The answers to these questions should help narrow down the problem.

Justin M.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 6
(7,795 Views)

Hello M0535,

 

My encoder does not have a Z index.  It reads positive and negative values leading me to believe it can tell which direction it is traveling, the positive values (fixture moving up) are just always way way lower than they should be.

 

No the VI is running, when the movement first starts to occur it almost seems like it reads a value, defaults to 0, and then starts to read again.  This happens so fast I am not certain.

Sometimes I will start the VI and then move the fixture, other times I will have the VI running without moving the fixture for a bit, and then proceed to move the fixture.  This does not seem to make any difference, and I do the same thing when moving the fixture downward and the results are accurate.

 

Does this help to narrow the problem down?

0 Kudos
Message 4 of 6
(7,790 Views)

I would guess your sensor may be out of alignment.  It gets good spacing on the pulses in one direction, but they are too close together in the other direction.  It would be interesting to look at the pulses on a scope.  If it is losing the second signal in one direction, it will ignore the pulses on the first signal, which would give you a big gap.  I would set it up to read the encoder count at fast, regular intervals (100 Hz, maybe) and plot the results on a chart.

 

How tight is the motion?  Is it possible the fixture shifts and changes the distance or orientation to the sensor when it changes direction?  Maybe lay everything flat and see if that makes a difference, or move the encoder while holding the fixture still.  The read head is probably not lining up and isn't reading the second pulse.  There might be a light on the encoder head that indicates signal quality.

 

Bruce

 

 

Bruce Ammons
Ammons Engineering
0 Kudos
Message 5 of 6
(7,696 Views)
Solution
Accepted by topic author PHDMFG

Well it appears the issue was far easier than I thought.  Obviously I am a beginner at this, but I feel that most of the confusion was due to lack of detailed information.  None of NI's documentation really explained to me the two-pulse counting option, more so the X4, and the documentation of the readhead mentioned times four counting.  However, after not receiving any solid solution I started completely over and tried every option I had along the way.  In short my solution was simply setting what I have posted in my screenshot, but simply changing the X4 option to the two-pulse counting option.

0 Kudos
Message 6 of 6
(7,667 Views)