LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering data collection based on an encoder position

I am trying to collect one piece of data each time a position is reached on a rotary encoder, like every 0.25 degrees.  I have an encoder with 3600 pulses per revolution.  I am able to get it to trigger, but it doesn't seem to be fast enough to pick up the position at the proper time.  It seems like a timing problem.  Is the program slow enough so that it can't respond faster than 5.5 ms.  This is the approximate time that it takes the encoder to turn 0.25 degrees.  Is there another way to do this?  See program file and a sample data file.

Download All
0 Kudos
Message 1 of 5
(322 Views)

Most forum users don't use the latest version of LabVIEW. Please save your VI in a previous version, preferably 2019.

 

A few more questions:

  • What is the model of your DAQ device?
  • Is your encoder running at a uniform speed? Does the speed vary?
-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 5
(303 Views)

At 3600 pulses per rev, your encoder gives you a 0.1 degree *quantized* resolution.   You *can* collect at 0.2 degree intervals or 0.3 degree intervals, but 0.25 isn't going to work.  (With certain devices there's an somewhat advanced method involving digital change detection that might support exactly 0.25 degree spacing, but for now I won't assume that's not both possible and necessary).

 

Of course, the method I'm describing is a bit advanced as well, just a little less so.  You can use DAQmx Timing properties to configure the encoder signal to be your "Sample Clock.Timebase.Source"   A subtle point -- don't configure it as the "Sample Clock.Source" itself, but rather the "Sample Clock.Timebase.Source".  Then you can also configure another DAQmx property known as the "Sample Clock.Timebase Divisor" which will divide down the encoder signal by a specified integer.  You can divide by 2 to get 0.2 degree resolultion or divide by 3 to get 0.3 degrees.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 3 of 5
(283 Views)

I am using the following: 

NI CompactDAQ Chassis (4-Slot USB)

cDAQ-9174

NI-9361 32-Bit, 8_Channel C Series Counter Input Module 783407-01

The encoder is not turning at a uniform speed which is the reason for using it to record data.  The ultimate goal is to record torque data at even rotational intervals (degrees) between 0 and about 100 degrees.

 

See attached ver 19 VI.

0 Kudos
Message 4 of 5
(262 Views)

I'd suggest you start from a shipping example for analog voltage input.  It'll let you define a sample clock source which you can set to be the PFI pin where you attach your encoder channel A (or B, shouldn't matter which).

 

This isn't *quite* what I recommended earlier, but it gives you a starting point.  You'll be getting 1 analog sample per 0.1 degree of travel or 3600 samples/rev, and it won't matter that the speed varies during the motion (provided you don't reverse direction).

 

Hopefully that'll work with the 9361.  I haven't used one of those modules myself to learn its quirks, but through various threads around here I've learned that it has some unique capabilities and also some unique limitations.  IIRC, some of those limitations relate to signal routing, so I'm not totally sure this will work with a 9361.  If you also have a more "vanilla" DI module with the right digital logic level for your encoder, there are likely other ways to get this working too.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 5 of 5
(233 Views)