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: 

DAQ Speed of Sound Measurement

This question is probably 50% labVIEW and 50% physics related.

 

I’ve been asked to create a labVIEW program to measure speed of sound in different materials using a DAQ  operating at ultrasonic frequencies (20-60kHz).  I’m initially conducting the test in a small tank of water using two hydrophones; one as transmitter, one as receiver. The signal flow is as follows:

 

DAQ -> Power Amplifier -> Transmitting Hydrophone -> Receiving Hydrophone -> Pre-Amp -> DAQ

 

I’m generating a burst of between 5 and 10 cycles of a sinewave for use as my input signal. This is to prevent reflections etc becoming a source of interference with the results. I then listen for the received waveform, filter it, and perform ‘peak detection’ on both signals to compare the time delay between respective cycles.

What I’ve discovered however, is that depending on the sample rate chosen, the speed of sound calculation I carry out seems to vary. Likewise with increasing frequency my speed of sound value increases also. This makes very little sense to me as I thought that speed of sound was independent of frequency. Is there a simple explanation for why this might be?

 

I also loop the program so that it carries out the test 10 times and takes an average reading. On each iteration of the loop though, the output signal doesn’t reset to its ‘zero’ position so that it starts the burst from zero with a rising edge sinewave. I’d like it to do this. Messing around with the number of sample and the sample rate so that it completes full cycles depending on the frequency being used helps somewhat with this, but it’s difficult to do accurately because when using a sample rate of 1.8MHz say, the DAQ actually runs at 1.818181MHz. Are there suggestions for addressing this?

 

I’ve tried to be as concise as possible. If anyone needs further info just say so. I’ve also attached the code. Many thanks in advance.

 

0 Kudos
Message 1 of 2
(2,621 Views)

Just as you open and close the file outside your for loop, you should do the same thing with the DAQ VIs. Do the Writes and Reads inside the loop and the configuration and shutdown outside.

 

Rather than using the function generator VI I think I would use Sine Pattern.vi with some calculations to determine how many samples are required to generate a burst of 10 cycles at the frequency of interest, given the actual sample rate used by the DAQ device. Then I would pad the array of samples with zeros to the number of samples you want to write on each pass. This will give you uniform bursts which always begin and end at zero.

 

{ I was planning to post an image here but the Forum is not cooperating }

 

It is not as convenient but it gives you complete control over the signal you are transmitting.

 

Now, to the detection.

 

The filter will introduce a phase shift and a delay - and they will vary with frequency.  You can measure that and try to compensate, but it might be complicated.

 

I would suggest triggering both the AO and the AI from the same signal, probably a digital signal. I would also record (an attenuated version) of the electrical signal out of the Power Amplifier on an additional AI channel. That way you know exactly (with an uncertainty of one sample dt) the time when the output signal was generated and when the received signal returns. 

 

Some systems I have seen use the time the second or third cycle of the received signal crosses a threshold as a detection that the signal has been received. That way if the signal rises slowly because of the response of the hydrophones, you do not have to try to determine exactly when the signal appears.  Once you have detected the signal, look at the zero crossing of some middle cycle for calculating the speed. Using hte zero crossing avoids any amplitude variation issues due to attenuation in the fluid. Obviously you need to process the transmitted signal the same way.  This kind of processing avoids the phase shifts of filters and amplitude variations. If the received signal is noisy, other processing may be necessary to eliminate false zero crossings.

 

Lynn

0 Kudos
Message 2 of 2
(2,596 Views)