LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Streaming and recording data

Hey Rymanvw,

To only take write data when take data is pressed I would make it so that both loops stop when the stop button is pressed (http://digital.ni.com/public.nsf/allkb/267704CDE91156D186256F6D00711AAE).  Then I would put a case structure around your enqueue data with the case selector wired to the take data button. In the true case you enqueue data.  In the false case you would do nothing. 

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 11 of 18
(1,084 Views)

Thanks a lot Kenvin_F that was simple and now works great. I have another question though I want to be able to change the sample rate of my DAQ Assistant. I read in the help about DAQ Assistant and it said that only the initial value of the DAQ is used and any change to the sample rate after that is not used. Is there a way around this, but only if it isn't to complicated. I can live with out this functionality. Also I was wondering if it is possible to make initial value is my numeric controls. So when the program starts it isn't always zero I can set some other initial value. Thanks again.

0 Kudos
Message 12 of 18
(1,084 Views)

Ohh one more thing too. So I have updated my vi at the top again. I was wondering how I would go about making a moving average output? So what I have been doing is only taking one sample per second and logging that which works but what I want to do is take like 512 samples per second or 500 ms and log the average of those samples in the data file and display that on the front panel. I found this http://zone.ni.com/devzone/cda/epd/p/id/82 vi, it is a little confusing. should I follow this template to accomplish this and where should I put the compenents? Thanks.

0 Kudos
Message 13 of 18
(1,084 Views)

Hey Rymanvw,

There is no way around the sample rate limitation using a Daq Assistant. You can change the sample rate if you set up your data aquisition using the lower level Daqmx commands but you will still need to stop and restart the Daqmx task to do this. So in short you probably do not want to be changing the sample rate on the fly.

As far as a moving average is concerned I think you could use that template.  You could also probably just use an array to keep track of the last 500 points (keeping track of which point is the oldest and replacing it. Let me know if you have any questions with this.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 14 of 18
(1,084 Views)

Okay so i think I am really close to getting this thing to take data how I want. I am having some trouble with the stream data at a certain rate. I can't get it to wait until next ms multiple. It either samples at the same rate as the DAQ Sample Rate or not at all. Please helpUntitled.png

0 Kudos
Message 15 of 18
(1,084 Views)

Hey Rymanvw,

I am a little confused as to why you would want to stream data at a different rate than the sample rate.  If you want to keep all the data you either need to stream at the same rate or group multiple waveforms into an array and send the data as chunks (which in this case I don't think provides any advantage).  If you want to send less data I think you should set up logic to only send every third point (or something similar) instead of trying to make that distinction based on the timing VI's.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 16 of 18
(1,084 Views)

Less data is what I want, for the most part. How can I send less data, Such as every 10th point or something?

0 Kudos
Message 17 of 18
(1,084 Views)

Hey Rymanvw,

You could make a case structure that looks at a numeric cound and when the count is in the range 0-8 it just increments the count and when it is 9 you write the current data to the queue and set the count back to 0.

I attached a sample VI with that case structure setup.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 18 of 18
(1,084 Views)