05-08-2024 09:13 AM
Hello everyone,
I'm trying to make a VI which measures temperature with a DAQ USB TC01 and saves the measurements in a text file to be reused after. Unfortunately, I can't access to the date and time of each measurement made by the DAQ. For example, now I have a list of temperature :
26,654971
26,679116
26,679116
26,686015
And I would like to add a line corresponding to the date and time of each temperature like this (here I supposed that each measurement is made with 2 ms interval:
080524_160522,002 26,654971
080524_160522,004 26,679116
080524_160522,006 26,679116
080524_160522,008 26,686015
Please find attached the VI.
Thank you for your answer
Solved! Go to Solution.
05-09-2024 09:46 PM
There are a number of methods to do this -- it depends (a bit) on how you handle the data acquisition. Unfortunately, like many long-time LabVIEW developers who participate in the Forums, I do not have recent LabVIEW versions installed, so I can't examine your code. Could you please "Save for Previous Version" and specify LabVIEW 2019 or 2021?
If you are sampling using Continuous Samples and a fixed Sampling Frequency, you can save the data as a Waveform, which bundles a Time Stamp showing the time of the first sample and a "dt" that gives the time between successive samples. You can also use the LabVIEW Time functions to "time-stamp" the samples (again, assuming Continuous Sampling, otherwise you need to get "time" for each sample ...).
Show us your code (in a version of LabVIEW we can open) and we can make further suggestions.
Bob Schor
05-10-2024 01:24 AM
Thank you for your answer.
Here the code with a 2019 version.
Best,
Manon
05-10-2024 08:38 AM
Bon jour, Manon.
It has been many years since I studied Le Français in high school, so I will continue in English.
There is a very useful NI White Paper that I read, and finally learned and understood how to use DAQmx. Do a Web search for Learn 10 Functions in NI-DAQmx and Handle 80% of Your Data Acquisition Applications,
So I'm looking at your code, and noticing a few things that are "missing" or at least unclear to me, some related to your question about Finite vs Continuous sampling.
First, it appears that you are sampling a single channel, as your Physical Channel input has only a single Dev1/ai0 entry. You are missing a DAQmx Timing function (which should go before the Start Task function). Your DAQmx Read is 1D Wfm NChan/NSamp, but you only have a single Channel defined.
So here are some questions:
For example, suppose you say "I want to sample at 10 Hz and take 100 samples at a time". Your DAQmx Read loop (if you set Continuous Sampling at a rate of 10 with 100 samples/channel) will sample for 10 seconds, deliver a waveform (if you asked for it) with 100 data points, and loop waiting for the next sample 9.998 seconds later (actually, it's probably 9.99998 seconds, as enqueuing a Waveform takes very little time).
Set your Waveform Queue to hold a single Waveform, as you are sampling a single channel.
See how that works.
Bob Schor
05-15-2024 01:36 AM
Thank you for your answer.
I could fix the Multiple Channel to Single channel with multiple samples. But when I tried to include a Sample Clock the VI didn't work anymore. The error code associated is :
Error 200077 occurred at DAQ Assistant
Property: SampTimingType
Requested Value: Sample Clock
Possible Values: On Demand
After some research, it seems that the USB TC01 doesn't support a sample clock for that analog input (https://forums.ni.com/t5/LabVIEW/SampTimingType-Error-200077-using-myDAQ/td-p/3828578).
The DAQ must therefore be replaced. As I then want to create a PID control for the temperature via an Arduino Uno, I'll take an Arduino-compatible MAX31855 thermocouple amplifier. This solution is less expensive.
Thank you again for your advice,
Manon