LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to achieve high sampling frequency with low write data frequency

Solved!
Go to solution

Hi, I am using 9205 module to acquire voltage signal. The noise of the module is high. So I want to use high sampling frequency (2k Hz) to read a realistic signal and use filter to reduce the measuring noise. But I only need to write a data every 5 sec.

 

I try to use a write function with a case loop so that every 5 sec the write function operates. But it turns out I got 2000 samples evey 5 sec.  

0 Kudos
Message 1 of 4
(1,074 Views)
0 Kudos
Message 2 of 4
(1,072 Views)
Solution
Accepted by topic author Roy19

Good morning, Roy.

 

     Thank you for attaching your code.  I'm guessing that you are not a student of engineering, nor very experienced with LabVIEW (neither is a "bad thing", the same can be said of me before I started learning LabVIEW after several years of programming in other languages).

 

     I strongly recommend learning how to use DAQmx, and avoid the Dreaded DAQ Assistant.  An excellent White Paper is Learn 10 Functions in NI DAQmx and handle 80 Percent of your Data Acquisition Applications.  There are also the Examples that ship with LabVIEW.

 

     You say you are "writing a data every 5 seconds" -- by "a data", do you mean "one sample", so you are sampling your signal at 0.2 Hz?  If that is the case, then a simple thing to do is to take 2000 samples for 5 seconds (or 10,000 samples, in total), average them, and save the average (a single point)!  Averaging, as I'm sure you know, is a simple filter that gives the "mean" (or "average") value of a signal over the interval.  It is a reasonable thing to do, especially when the signal seems to have a "mean" and "noise that varies around the mean in a symmetric way".

 

     On the other hand, if you want to get a finer time resolution on your "cleaned-up" signal, you can take, say, 200 samples at 2 kHz, so every 0.1 sec you'll have 200 points to average and report out, now getting 10 "averaged samples" per second, which gives you a signal whose highest frequency is 5 Hz.

 

     The way DAQmx works is you tell it "Start sampling at 2 kHz, taking 200 samples at a time".  When it has the 200 samples, you average them (if they are in an array, you sum the Array (that's the Array function with the large Sigma) and divide by the Array Size (another Array function).  You are doing this inside a While Loop, and you have only 0.1 sec to do it before the next sample is ready, but it takes probably a few microsecond, so you have plenty of time to save the data).

 

     Do you have a colleague or fellow student or friendly Professor whom you could ask for help/mentoring?

 

Bob Schor

Message 3 of 4
(1,021 Views)

Hi Bob,

 

Thank you for your detailed yet easy to understand answer. Problem solved.

 

Have a nice day!

0 Kudos
Message 4 of 4
(914 Views)