01-03-2012 01:40 PM
Hi All,
I'm trying to read speed of a drill and was hoping that I could use the information extracted from Extract Single Tone Information to get to the speed. However, when I run the attached code while the drill is still off I get Inf for frequency and 0 for amplitude (the waveform chart shows numbers in the 0.21 range - see attached picture). When I turn on the drill the signal amplitude as viewed on the waveform chart jumps to ~4 range, but the frequency continues to read Inf and the amplitude 0. Am I missing something, or using the Extract Single Tone Information incorrectly?
Thanks!
01-03-2012 02:21 PM
A couple of comments.
1. You are sending in an array instead of a waveform like the VI is expecting. Thus your timing information is lost.
2. Both of your graphs show very few data points, and they are far from being sinusoidal. I don't know if you have enough valid data there for it to detect a tone.
01-03-2012 03:52 PM
Hi,
Thanks so much for your quick response.
As to point 1, I actually see data come in, over time. I could only capture a snapshot of it, hence the photo, but if I continue the run data continues to come in over time. I believe I've fixed the array vs waveform issue (see my modified code). I ended up with that because I was trying (out of desperation) different Analog Wave form function. I'm seeing lots of data, but no actual numberical values for frequency of amplitude.
Thanks again!
01-03-2012 04:25 PM
The problem is that you have no timing to your while loop. It is going to run as fast as possible. And your DAQmx read is set to read all available samples, whihc may not be very many on any given iteration of the loop. The extract tone subVI only operates on the samples that are acquired during that loop iteration. It may look like you have a lot of samples on your chart, but that is only because it is a chart that has history and shows the data that was collected in the past.
Try putting a wait function in your while loop. Or wire up a value to your DAQmx Read that tells it how many samples to read at once. Also, what kind of frequency are you expecting to see? You are only sampling at 100 Hz, which means you are only going to be able to detect frequencies up to about 50 Hz, if that high.
01-05-2012 11:46 AM
Thank you very much. Your advice helped!