LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Faster sampling (software controlled)

Solved!
Go to solution

Hi,

 

I'm trying to read datafrom a Codemercs JoyWarrior 24F14 accelerometer. Connecting it to LabVIEW was easy as can be and reading from it as well.

 

I want to use the sensor to measure the vibrations in one of our machines, so- as a test- I placed it on top of my iphone and called it. When I let the loop run uncontrolled I get more than enough samples. So many in fact, that I can't see any vibration at all within 100 samples.

If I run the loop with a 1 ms timer, I get too few samples to acquire the vibration clearly.

 

Is there any way increase the sample rate a little e.g. by a µs timer? Any other way? 



Remember Cunningham's Law
0 Kudos
Message 1 of 8
(4,021 Views)

Zero ms wait?

(not the same as not having a wait at all)

0 Kudos
Message 2 of 8
(4,016 Views)

Well, that wouldn't leave me any chance to control the rate would it? (To be precise neither does not having a wait at all)

 

I thought about changing the samplerate on the sensor (not sure if that's possible, though). In the end that would only mean reading the same value multiple times, if LabVIEW still reads the values more often than a sample is made. So I believe that the problem must be solved in LabVIEW.

 

In the end: the Vibration I want to measure is of about 9 Hz at Max, so 1kS/s would suffice. I'd still like to know if faster while controlled sampling was possible.



Remember Cunningham's Law
0 Kudos
Message 3 of 8
(4,011 Views)

Have you tried a producer consumer architecture with a timed loop for the readout?

 

For better software timing you should run two independend loops, and the read loop shouldn't contain any frontpanel items.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 4 of 8
(4,007 Views)

If you are sampling, using a loop rate in Windows, there will be jitter in the samples, as you can't predict the actual loop time for each loop. You also need to sample at least twice as fast as your signal, faster usually is better. Yes, you may sample the same event more than once, but that is better than missing events. How do you get the data from your sensor into LabVIEW, how is it connected to your computer?

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 5 of 8
(3,995 Views)

The Sensor (btw: Hail to the codemercs) is connected via USB, whereas the sensor is recognized as a Joystick.

 

 

My Code looks a little like in the VI I added.

 

I didn't quite get the part about the producer consumer structure. Could you please be more specific about that.



Remember Cunningham's Law
0 Kudos
Message 6 of 8
(3,983 Views)
Solution
Accepted by topic author PeterFoerster

You are already using the Producer-Consumer-Structure.

The "upper" loop writes the data to the queue = producer.

The "lower" loop reads the data out of the queue = consumer.

 

Timing the loop faster than milliseconds is impossible in LabVIEW as LV is using the Windows Timebase (smallest value = 1ms).

 

I replaced the while loop with a timed loop and you try running this loop with different periods.

The timed loop runs with higher priority than the while loop.

I hope you have LV 2009 Smiley Happy

 

Regards

Christian

Message 7 of 8
(3,955 Views)

Well, as I said, a samplerate of 1 kS/s should suffice. So it doesn't really bother me, that faster sampling won't work.

 

Thanks for all the input.



Remember Cunningham's Law
0 Kudos
Message 8 of 8
(3,933 Views)