LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9411 Quadrature differential encoder: reading angular position

Hello guys,

I have a question regarding the DAQ Assist block to read the encoder (as in title) and how to properly set it up.

In particular, in the timing tab there are three parameters:

  1. Acquisition Mode
  2. Samples to Read
  3. Rate (Hz)

I want to acquire continuously the signal and save it to a file, so:

  1. Acquisition Mode -> Continous Samples. It tells me I need an external clock. Why? How can I solve it?
  2. Samples to Read -> I didn't get the meaning of the buffer size.
  3. Rate (Hz) -> Here I would like to explain better: my system does rotate for example at 15 revolution/s. Knowing the Line Counts parameter of my encoder (that's 2000), I calculated 15 revolution/s * 2000 impulse/revolution = 30.0000 impulse/s = 30kHz. Now, should I consider the Decoding Type X4 and calculate actually 30*4 kHz as the actual rate? More, should I also consider the sampling theorem (nyquist) and actually sample at 30*4*factor kHz (where factor is >= 2)?

I would like your help to properly configure these three parameters.

 

Thanks,

Luca

 

0 Kudos
Message 1 of 8
(3,852 Views)

Hi Luca,

 

1. What about using "1 sample on demand"? How often do you need the position data?

2. Here you set the number of samples to read per DAQAssistent call…

3. Here you set the samples per second (samplerate) you want to read from your DAQAssistent. This is not related to your actual sensor hardware. DAQmx will use some counters in your DAQ card to determine position - all you set here is how often you want to read that counter value…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,844 Views)

Hello Knight GerdW, thanks for your reply.

 

1) I want to have a continuous stream of data for the period of time that I will later decide (for e.g. an experiment that lasts 1 hour).

2) Can I set it equal to the rate number? I'm not sure wether this is important to my goal: all I want is to save this stream of data to a file.

3) I'm confused, is this related to the Number of Samples parameter somehow and to the continous sampling method? Can't I think of this value as the sampling frequency of the stream of data?

 

Thanks,

Your lost Luca

0 Kudos
Message 3 of 8
(3,829 Views)

Hi Luca,

 

1. You also get a "continuous stream" of data when you read them on demand each second…

 

2. Yes, you can - but you don't need to.

 

3. "Number of samples to read" and samplerate are related by the formula t [s] = #samples [S] / samplerate [S/s]. Yes, samplerate is the "sampling frequency of the stream of data".

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,824 Views)

Hello, thanks for your reply.

1) When I said "continous" I mean that I am able to acquire and then display/log data with a given frequency sampling without having any "lost gap" of data for a given period of time, for instance until I stop the acquisition. In conclusion, I would like to have a real time stream of my angular position signal for explame for 1 hour with a sampling frequency of 500Hz.

 

2) Currently I managed to get my daq assistant to work setting the sample mode to continous but when I try to route the output data of the encoder acquisition to a graph, this latter updates itself only when I manually rotate the encoder shaft. Like I don't have the "time information" but only the encoder value information.

 

Sorry but I'm having an hard time understanding what I'm doing wrong. I feel like I don't take into account some concepts that are trivial, that's also why I am not understanding you properly. Bear with me.

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

Hi Lucs,

 

unfortunately you don't attach your VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(3,785 Views)

Good morning GerdW, I attach two examples.

The first one is built with the daq assistant blocks and it's the one that doesn't store the time information with the encoder apparently.

The second one is built with ni max tasks and I copied the time information of my other module (e.g. accelorometer) to the encoder signal given the two modules have the same sampling frequency. It's the only workaround I found so far.

 

Thanks,

Luca

 

0 Kudos
Message 7 of 8
(3,774 Views)

Hi Lucs,

 

The first one is built with the daq assistant blocks and it's the one that doesn't store the time information with the encoder apparently.

You have configured the WriteMeasurement ExpressVI to use a X column for time information.

So why shouldn't it not save any time information in the data file?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(3,769 Views)