07-13-2011 05:06 AM
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?
Solved! Go to Solution.
07-13-2011 05:50 AM
Zero ms wait?
(not the same as not having a wait at all)
07-13-2011 06:14 AM
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.
07-13-2011 06:28 AM
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.
07-13-2011 07:23 AM - edited 07-13-2011 07:24 AM
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?
07-13-2011 08:27 AM
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.
07-14-2011 09:27 AM
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
Regards
Christian
07-18-2011 12:23 AM
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.