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: 

Measure frequency with ni usb 6002

I was wondering if it is possible to measure the frequency of a waveform signal with a ni usb 6002? I have been reading through the forums and looking for examples on how to measure the frequency, but haven't been able to figure it out. I have tried the tone measurement vi, the extract a tone from waveform function, fft power spectrum, and the spectral measurement vi, but I haven't been able to get any of them to read the frequency of my signal.

 

I am sampling continuous reading 1 sample at 10kHz and I am striking my force plate with a hammer to determine the natural frequency of the force plate. I am able to record the voltage of the waveform signal, but when I try to use the functions to read the frequency I get 0.

 

I have read about using the counter to measure the frequency, but I haven't had any sucess at that either...

 

Any help would be greatly appreciated! Thanks!

 

Download All
0 Kudos
Message 1 of 6
(3,404 Views)

Why are you only reading 1 sample?  This forces your Queue to run at 1KHz, doing a lot of "heavy lifting" to move a single point.  Both your Producer and Consumer loop must also run at 1KHz, more wasteful cycles.

 

Why not take 1000 samples at 1KHz?  Now your Producer (and Consumer) loops run at 1 Hz and your Queue holds 1000 points, not 1.  Also, your Waveform has 1000 data points in it instead of 1, also more efficient.  

 

Where are you (in the code you posted) trying to determine frequency?

 

Bob Schor

0 Kudos
Message 2 of 6
(3,349 Views)

Thanks for your reply, I was looking back at the article that I am using to calculate the natural frequency of my force plate and I need to write 10,000 samples/sec, so are you saying that I should set the number of samples to 10,000 and the sample rate to 10kHz?

 

I would like to determine the frequency in the consumer loop so that I can write it to tdms as "set property", but I would like to have the frequency for each data point. I'm not sure which would be the best to do that, if I should use the pulse measurement vi to get the period then take the inverse for the frequency or if I should use the extract tone detect frequency.

0 Kudos
Message 3 of 6
(3,326 Views)

I am able to measure the frequency of my signal if I write the signal to file then read the file, build waveform, extract single tone, and write to file. But, I was wondering if there was a way to record the frequency for each data point in the signal?

0 Kudos
Message 4 of 6
(3,315 Views)
two point that I could indicate
1 do not forget respect nyquist for your frequency
2 most of vi that use for frequency need array of data so one sample will not help you you have to increase your sample to read in number that it could possible measurement of desired frequency based on time elapsed for related data for acquisition
Message 5 of 6
(3,308 Views)

It appears you do not understand how to understand sampling of a signal and analyzing the frequency content of that signal.  Suppose you sample at frequency F (in Hz) and sample for a total time T.

  • N (number of data points) = F * T 
  • Lowest frequency = 1/T
  • Highest frequency = F/2
  • Number of frequencies in analysis = N/2

The idea is that if you have N data points sampled at equal time intervals (of length T/N, of course), you can represent it by a sum of pure sines and cosines of frequency of the form k/T, where k goes from 0 to (N/2 - 1).

 

There's one other consideration -- this represents N points over a time interval of T, so you can consider it as an "average" frequency spectrum taken at time T/2.  That is, it represents a spectrum at a single point in time.  If you want to know how the spectrum varies as a function of time, you need to measure it with multiple sets of points.  You can use either overlapping sets of points or non-overlapping sets -- if you choose non-overlapping sets of N points, you'll get estimates of the spectrum at times T/2, 3T/2, 5T/2, etc.

 

Note, in particular, you cannot estimate the frequency at the first point.

 

Bob Schor 

0 Kudos
Message 6 of 6
(3,300 Views)