11-09-2012 05:25 PM
I am trying to take a measurement of the frequency that a sensor is putting out. I have an analog input being read which is than being converted to a frequency. For some reason my VI wont run due to something with the Timing and Transitions Measurements sub-VI and I cant figure out why. All the wires and nodes look "happily" attached, so I am stuck in a hole. I might be going about this wrong as well so any help would be great. Thanks. Attached is my VI.
11-10-2012 06:23 PM
I am confused too. Like you I get the error message. "You must fix all errors in the sub VI." Next I took Labview's advice and ran the sub vi to find the error. However, the sub VI dosn't show any errors.
Next I added the Express Tone VI to the Analog Read Pin.VI example. Amazingly this VI ran. The Express Tone VI can make frequency measurements. like the Timing and Transistions Express VI. Attached is my version of rthe Analog Read Pin.VI Maybe you can get some clues from it to fix your VI. or use it as a starting point.
hrh1818
11-30-2012 05:24 PM
Thank you. I have the same set up as you now with the express tone VI, and my VI does run finally. The problem now is that it is not producing a frequency reading.
11-30-2012 08:17 PM
I recently came across a gotcha with the Express VIs. Many require timing information to be included with the signal. I suspect that is the problem . I will look into this problem more as time permits. But in the meantime I suggest you try one of the "Spectral" functions in the Signal Procesing palette: Functions Palette > Signal processing >Point by Point > Spectral. Or if your data is stored in an array: Functions Palette > Signal Processing > Spectral.
hrh1818
12-11-2012 10:46 PM
After trying several things the only thing I could get to work was to run an analysis on a block of data. Attach is an AutoPowerSpectrumTest.VI demo which performs a spectrum analysis on 1024 data points. To use it:
Set Analog Pin to your analog input pin number.
Set VISA Resource to the COM port your Arduino board is using.
Set dt to sample period, which is the reciprocal of sample rate. On my computer when sampling one analog input channel the sample rate is 125 readings per second which is a 0.008 second sample period.
Attach is AutoPowerSpectrumTest Demo.PDF which shows the results obtained when measuring the spectrum of a 3 Hz sine wave. The X axis scaling on the Waveform Graph is in df units. 25 df units = 3 Hz.
What frequency do you expect to find in your data? I see in the Temp Humid Sensor.VI you are sampling at 2 samples per second. Hence the maximum frequency you can detect when using a brick wall anti aliasing filter is 1 Hz. You may need to use an anti aliasing filter because frequencies higher than 1 Hz will produce misleading results.
hrh1818