11-14-2009 09:21 AM
Hi all,
I'm a mechanical engineering student and an absolute beginner with LabView. My aim is to send a continuous sine wave signal from an ultrasonic sensor to a receiver. I plan to measure the phase shift between the received and transmitted signals. i have found a topic in the forums were a .vi was posted that measures thee phase shift btween two signals. I have done my best to edit the program (removing unnesessary elements).
I have replaced the actual signals with simulated ones until I am ready to wire up with my sensors. I have set two sine waves with a phase delay of 150 degrees and the program calculates this accordingly. The problem is the only part I understand of the program is the conversion from radians to degrees.
If at all possible could anyone please walk me through what is happening in the program (i.e. what each array and interpolation does) I understand that this is a big ask but I would greatly appreciate any help.
The program is below.
11-14-2009 10:25 AM
This is a relatively simple task:
11-14-2009 11:38 AM
Thank you very much for reply. However I failed to post the correct edit of the program (sorry) which is now attached. Im sure the information you have given still appllies. You will note in this program the dt and df section of the spectrum now is unwired and yet the program still works. Could you have a quick look to make sure I haven't comprimised the program.
"remember, the cross power spectrum operates on plain arrays and does not directly utilize the timing information of the original waveforms."
In saying this dos it mean that there would be a less complex/alternative way to calculate the phase shift utilizing the time information or is this a robust program?
follow up questions (if you, or any others, have time):
by using ultrasonic sensors as opposed to simulated signals, I would get a certain amount of noise. If doing this in something like excel i would use a best fit method to get a decent looking sine wave. Would this noise effect this program?
When the phase goes over 360 degrees (say 390)the program only displays 30 degrees of shift with no indication that a full 360 has been passed, any ideas on how to solve this?
11-14-2009 12:58 PM - edited 11-14-2009 12:59 PM
Yes, if you are only interested in the phase information of the highest peak (and not it's actual freqeuncy), you don't need df or dt.
Since the signals are periodic, you cannot measure phase shifts outside +/- 180 degrees. To measure larger shifts in time, you would need to use a lower frequency in order to keep it within the limits of detection.
If you use ultrasound of a known frequency, you know where the peak will be and you don't need to find it.
You don't need to do any fitting. The method works equally well for noisy data. You are looking at a single spectral components and ignoring all other frequencies anyway in the frequency domain processing. The noise contributes little to a specific frequency.
Attached is a quick rewrite where you can see how the noise affects the result.
11-14-2009 04:58 PM
The frequencies of 40.5kHz and 41.5kHz are what will actually be used in my experiment .The idea is derive the distance from the phase shift from a continuous wave. The best method for this is to compare the phase difference for two frequencies(or more). The idea is I send a signal from a transmitter to a receiver and compare the phase shift between the transmitted and received signal, this is repeated for a second frequency to allow for more accuracy in distance measurement (according to alogrihtm put together in my thesis).
Essentially I will connect labview using an scb-68 block with an ultrsonic sensor and receiver, run at 40.5kHz, and send these two signals (sine waves) to labview. There will obviously be a phase shift between between the two signal. I need to find this using labview and then repeat the process at 41.5kHz, compare the two phase shifts and obtain the difference between the two. I greatly appreciate the help you have given me, if you can no longer help Iwould appreciate greatly if even you could push me in the direction of online tutorials.