From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO Analog Input N Sample vs 1 Sample

Dear users, please I have used the Analog Input (N Samples) due to the rate of acquisition that I need (20KHz with 10,000 samples). But according to datasheet, the myRIO 1900 using High Throughput has only one channel for N Samples and I would like to have two channels with these rate (20KHz and 10,000 samples). I have tried to use Analog Input (1 sample) for two channels. It is working but I did not reach in the sample rate and samples that I need. I read some topics about to use FPGA analog input, but I am not familiar with kind of language, and I have heard that sample rate won’t be 20 KHz. Do you have any idea or example how to fix it? Please find below the diagram code for 1 Analog Input (N Samples) and the file results.

 

LVelozo_0-1680129050840.png

 

LVelozo_1-1680129164791.png

 

0 Kudos
Message 1 of 7
(1,086 Views)

What, exactly, are you trying to do with the myRIO?  What is the problem you are trying to solve?  You describe sampling for 0.5 seconds at 20 kHz, which you then appear to write to a file.  Why?  What do you plan to do with this sample?

 

If you are just acquiring data, you are well within the abilities of the myRIO.  I'm very sure (but haven't tried it!) I could easily sample 2 channels at 20 kHz with the myRIO.  If you can provide me with answers to my questions above, I might try writing some myRIO code and see how many channels I could sample continuously at 20 Hz ...

 

Bob Schor

0 Kudos
Message 2 of 7
(1,062 Views)

Hi Bob_Schor, first, thank you very much for your support. Below I’ll try to explain better my project, objective, and issue that I have found.

PROJECT - I am working in project for my master’s degree, and I need to create a dataset with voltage and current from some residential appliances and in this dataset, I need to have these signal with higher precision “microscopic”. This Dataset will be used in Non-Intrusive Load Monitoring system (NILM) for load desegregation.  

OBJECTIVE - I need acquiring data from 2 analog input continuous with 20KHz (1 sample each 50 microseconds) with time stamp and save in the file.

ISSUE – When I select Analog Input (N Samples) I have only an option for one channel. If I choose Analog Input (1 Sample) it is possible to have multi channels, but I did not reach the sample rate that I need.

REFERENCES – I have read some topics to try solving my problem, but I did not have success and below has some link about these topics related.

1 Sample versus N Samples Modes (myRIO Toolkit) - NI

Choosing between Express VIs and Low Level VIs (myRIO Toolkit) - NI

My block diagram has a code for 1 analog input (N samples) 20KHz and 10,000 samples configurated on the Read. Vi and this code working properly for 1 channel.

 

Best Regards,

Leandro Velozo

0 Kudos
Message 3 of 7
(1,031 Views)

Hello, Leandro.

 

     I'm currently at work, but I'll try to get back to you shortly.  You definitely do not want to use Express VIs, as you want/need to take advantage of the hardware the myRIO has to offer, which I'm pretty sure (but will try to write a little test routine to confirm this) is easily capable of sampling 2 (or more!) Analog channels at 20 kHz.

 

Bob Schor

0 Kudos
Message 4 of 7
(1,023 Views)

Hi Bob_Schor,

 

Please, did you have an opportunity to write a little test routine to confirm if the HW is capable of sampling 2 (or more!) Analog channels at 20 kHz.

 

Best Regards,

Leandro Velozo

0 Kudos
Message 5 of 7
(915 Views)

Oops -- sorry I forgot ...

 

BS

0 Kudos
Message 6 of 7
(909 Views)

OK, I've been "exercising" myRIO, and am embarrassed to admit I wat "not quite correct".  As it comes out of the myRIO Toolkit, it is definitely configured for one-channel 1-sample processing, without the "multi-channel, multi-sample" modes I was thinking that it had.  It is a lame excuse, but I was "fooled" by two experiences:

  • Almost all NI analog input devices, even the inexpensive USB-6000 series or the myDAQ, provide multi-channel, multi-sample inputs.  In fact, DAQmx is more-or-less built on that premise.
  • I've been using myRIOs to control the data acquisition from 16 analog channels at speeds between 10-20 kHz.  But there were two special circumstances that I forgot to consider:
    • We achieved these speeds using FPGA code.
    • We used the FPGA to drive 16 A/D Chips controlled by a SPI protocol to achieve this.

However, hope is not lost.  I did discover how to get the myRIO to acquire two channels at the same time (by "unlocking" the multi-channel configuration), and was able to generate 2 samples in about the same amount of time it took to generate one sample.  I clocked thing by using a Timed Loop, and counting how many "Late Finishes" I had after doing 1000 samples.  At 1 Channel, 1 kHz sampling rate, I had 1 miss (I suspect it was the first one, since I seemed to always get at least 1 miss).  At 2 kHz, still one miss.  At 5 kHz, around 50 misses, and at 10 kHz, 700-800 misses.  Curiously, replacing the 1 Channel A/D with my 2 Channel sample doesn't change these numbers much.

 

     For testing, I'm using a Stream Channel Wire to remove the data from the Timed Loop and into a parallel loop running a Chart output to convince me I actually have two A/D channels (and can touch one or the other to "make noise" and verify the A/D is doing something).  I'm attaching this as a LabVIEW 2019 Snippet.

myRIO 2 Channel Analog In.png

First, you would never use a Waveform Chart on a Real-Time Target like the myRIO, but for testing purposes, while being deployed and run from my PC, the Chart is the easiest/quickest way for me to test that I had independent A/D signals coming in (I just touched one terminal or the other and looked at the Chart).  I'm using a Stream Channel to quickly get the data out of the Timed (Producer) Loop and into a Consumer (Charting) Loop.  I use the Last Element? Stream element to stop both loops simultaneously.  The "normal" Analog Input Express VI is just there (it does nothing, just decoration) to show how I started with what is shown as "Untitled 2.vi" within the Timed Loop.

 

So how to get "Untitled 2"?  Many (all?) Express VIs allow you to right-click them and choose "Convert to subVI".    When you do that, you get what initially showed up on my screen as "Untitled 2".  If you open it, you will see that "under the hood" it has an Array of Channel Names with a single entry corresponding to the Channel you originally specified (such as B/AI0).  Simply add a second Array entry (B/AI1) to the Smart Open, and take the output of Read.vi, which already is an Array, and bring out the first two entries (I bundled them together into a Cluster, which explains the Brown color of the wire and Channel Wire "pipe" in the Snippet).

 

I forgot to mention -- to see how well the A/D performed, I brought out the "Finished Late?" outputs from the Timed Loop as an Indexed Boolean, converted the values (after the loop finished), to an Array of numbers, then summed them.

 

A fun exercise.

 

Bob Schor

 

0 Kudos
Message 7 of 7
(903 Views)