LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Streaming and recording data

I made this VI so that I could read the voltage from a hot-wire anemometer and a thermistor. The hot-wire I am using a ADC and the thermistor I am using an arduino. I am able to read the data but I am having trouble saving the data to a file I want to be able to take "snapshot" data, stream data, and take data samples. I can't figure out how to set this whole thing up with the timing and iterations. When snapshot is selected then the delay disappears and when the stream is selected then the samples disappears. Please put me in the right direction. Thanks

0 Kudos
Message 1 of 18
(6,918 Views)

Rymanvw,

You'll need to post some more details about the different modes you you want to create and how you want to use them.

Off the top of my head I would say you should use a producer consumer architecture where the producer selectivle passes data to the appropriate sinks (file, buffer, graph, etc).

-Sam K

LIFA Developer

0 Kudos
Message 2 of 18
(3,559 Views)

Here are the different modes.

Stream:

The "Samples" control will dissappear and when take data is pressed with will take one data point for each measurement every 500ms or whatever the delay is set to.

Sample:

The "Sample" control indicates how many samples are taken and the "Delay" control is the time between each sample.

Snapshot:

only one data point for each measurement is take when the take data button is pressed. (I know I can do this with the "Sample" option selected and choose 1 for the samples, but I would rather have another option)

As the vi stands now I can do the snapshot method except the graphs and numeric indicators don't update continuously, they only update when I press take data and when i start the application. How do I fix this?

I'm not that good at labVIEW so I am not to sure what that producer consumer thing is all about. I will read more about it. Thanks.

0 Kudos
Message 3 of 18
(3,559 Views)

Rymanvw,

Can you clarify a couple of points.

1.  When you press a button to start one of your modes you want to grab a some data an log it to a file right?

2.  Should this data show up on the graph?

3.  Should the graph always show the the current data and always update regardless of the sample mode?

Let us know and we can provide some suggestions for you.

-Sam K

LIFA Developer

0 Kudos
Message 4 of 18
(3,559 Views)

Yes to #1. When the record/take data button is pressed it will log the current data to a file.

No to #2.

Yes to #3. The graphs will only show live data as it is coming in.

Here is an updated vi with some more inputs and buttons. I want to get rid of the file path and make it so when the save data button is pressed after all the data has been aquired then it will ask you where you want to save it. Sould I delete the file path and it will automatically do that for me?

Thank you very much.

Hum I don't know how to upload new files... I can e-mail if anyone wants. Thanks

0 Kudos
Message 5 of 18
(3,559 Views)

Okay, I figured out how to update my attachments. The new vi is at the top called anemometer signal data logger. Thanks

0 Kudos
Message 6 of 18
(3,559 Views)

Rymanvw,

Yes, if you remove the file path input from the Write to Spreadsheet File VI it will prompt you for a save location.

From what you described it sounds like producer consumer is exaclty what you need. 

You can use one while loop (the producer) to acquire data, display it on the graph, and insert it into a queue.

The consumer loop will discard the data until you hit a button and then will perform the appropriate action with the incomming data.

Read up on producer consumer and check out some of teh producer consumer examples online and in Help>>Find Examples in LabVIEW.

Let us know if you have more questions.

-Sam K

LIFA Developer

0 Kudos
Message 7 of 18
(3,559 Views)

Okay well maybe I didn't make myself clear before but I suck at LabVIEW.... So if I could get a little more direction that would be very helpful.

First should the obtain queue be in my while loop or outside of it. Then I am very confused as to how my data should be handled. Should I put the data into an array before anything happens? Should I ever put my data into an array?

Please tell me if I am on the right track.Data_aquisition.png

0 Kudos
Message 8 of 18
(3,559 Views)

Hey Rymanw,

You will want your obtain queue to be outside both of your loops.  The idea is that you enqueue data in your top (producer loop) and dequeue data in your consumer loop.  This makes it so your data aquisition does not slow down while waiting on a write to file.  From the screenshot you attached you are going to want to put your DAQ code actually inside the top loop where it is being added to the queue.  I would take a look at this article:http://zone.ni.com/devzone/cda/tut/p/id/3023 if you have not already.  Its a great place to get started on the concept of how this structure can be implemented.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 9 of 18
(3,559 Views)

Okay so I am going to take baby steps. I am starting with a very basic vi and I will go from there. Everything about this new VI works except it takes data on startup and stops when I press take data button and does not take data again until I restart the vi. I want it to ask me where to save to upon first pressing the take data button then take data and append to that data file as I wish with the use of the take data button.

0 Kudos
Message 10 of 18
(3,559 Views)