LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to locate the (physical) z index of encoder

Solved!
Go to solution

Hello,

 

I am trying to locate the Z-Index of a rotary encoder. I need the counter to reset to 0 everytime the encoder's shaft reaches that same point.

 

My problem is that when I run the VI, the angular position starts at 0 no matter where the shaft is located, and this point is used to reset the counter to 0 once a 360 degree revolution occurs. Hence, everytime I run the VI, the current shaft position is used as the Z-Index.

 

Is it possible to locate the actual physical Z-Index of the encoder which is at a specific location of the shaft, so that everytime the shaft reaches that point the counter is reset to 0 and this specific point becomes the Z-Index everytime I run the VI (and not be at the location of the shaft at the instant the VI is run)?

 

Basically, I am trying to accomplish the homing technique to be at a fixed location of the encoder's shaft and not at arbitrary locations which are at the location of the shaft when the VI is run, which may be different everytime I run the VI.

 

Thank you,

r15

0 Kudos
Message 1 of 8
(5,407 Views)

That behavior doesn't sound right.  What data acq hw are you using?  Are you using a quadrature encoder?  Does it have an integral Z-index signal, or are you hoping to use some other once-per-rev signal to reset the count? 

 

The only reason I can think for your position to reset to 0 each time you return to the shaft position you happened to start from would be:

- hardware-based z-index reset isn't being used, or at least not being used properly AND

- software-based processing of the position data, such as a modulus function, is causing the reset to 0.

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 2 of 8
(5,402 Views)

From your description, I think you need an absolute encoder.


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 3 of 8
(5,396 Views)

The data acquisition device I am using is the USB 6341 that enables quadrature decoding. Also I am reading the angular positions of 3 quadrature encoders that have their Z-Index enabled. The problem is that when I run the VI, they all start at an angle of 0 and after a full revolution they are back at 0 at their starting position. That means that the Z-Index varies according to the shaft's starting position everytime I run the VI. 

 

Is there a way to set one position for the shaft as the Z-Index, where each time the shaft passes through that position (and only that position) it is reset to 0? (And not have the Z-Index at the position I happened to start with, when I run the VI)

 

r15

 

0 Kudos
Message 4 of 8
(5,382 Views)

I agree with Philip, It looks like what you need is an absolute encoder. With an incremental encoder there is no retention of the position when the power is removed. It is normal behavior that you get 0 when you start the vi since the counter the start to count. To detect the z-index I'm moving the axis at slow speed until the counter output value minus the previous value is negative.

 

Attached are pics of the code and of the DAQmx task settings in MAX for the counter.

 

Hope this help.

 

Ben64

Download All
Message 5 of 8
(5,380 Views)
Solution
Accepted by topic author r15

You can set a Z index position that will reset the counter to 0 whenever it passes through that position.  The counter will always be pre-loaded with some value (0 unless you change it) when you first start the counter, and you will need to move to the Z index position first to establish the reference position before doing anything else.  The "Measure Angular Position" example shows how you configure the initial counter value and enable the Z index.

0 Kudos
Message 6 of 8
(5,371 Views)

Have you verified with a voltmeter or oscilloscope that the encoders are actaully generating Z channel pulses?  What do you have the Z pulses connected to?

 

I once saw a system where the Z channel signal was inverted and it kept the counters reset all the time excpet for the few degrees where the Z pulse was present.  That does not sound like your problem.

 

My guess is that you do not have the Z channel signals connected correctly.

 

Lynn

0 Kudos
Message 7 of 8
(5,354 Views)

One way out might indeed be to use absolute encoders, but it isn't yet clear to me that it's the only way or even the best way.  So let's make sure we first cover the basics very clearly.

 

If your encoder has a z-index and your task is configured to use it properly, the z-index pulse will cause a reset at a specific shaft angle.  The very first such reset will usually occur in less than 360 degrees of motion, depending how far away you started from.  The remaining resets will always be at the same physical angle, thus every 360 degrees thereafter.

 

If you want to perform z-index reset with an encoder task, it's important that the z-index *signal* is coming from the quad encoder.  The task config depends on a z-index signal that is sync'ed to the A & B quad signals and requires you to define which 1 of the 4 possible A quad B states should be used for the reset.  This helps NI support both full-cycle and quarter-cycle gated index pulses.  (Full-cycle means the index pulse lasts one full cycle of the A channel, quarter-cycle means that it lasts for one A quad B state, i.e. 1/4 of a full cycle.)

 

A z-index signal that isn't sync'ed to the encoder may cause multiple resets per pulse or none at all depending on how & whether the pulse overlaps the A & B quad state changes.

 

Having said all that, the symptoms you describe sound more software-ish.  If you aren't explicitly doing a modulus function, I would start to wonder whether something about the task config is doing something similar behind the scenes.  I wasn't aware that DAQmx would or could do that, but I haven't done much encoder work since before X-series existed and that was many DAQmx versions ago.  Perhaps it now supports modes for non-cumulative angular position?

 

-Kevin P 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 8 of 8
(5,331 Views)