LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PHASE DELAY BETWEEN TWO WAVEFORMS

In my experiment I get a reference signal from a beam chopper and a voltage signal from a photodiode detector. The signals are acquired via a DAQPad-6015 USB board.

When I first get the signals waveforms from the channel they have the same timestamp, same frequency and they are in phase. Then I pass the photodiode (PD) signal through a Bandpass filter ("Butterworth.vi") and multiply the filtered waveform with the reference one. Because after the filter the PD signals waveform has change, it's not in phase with the reference and cannot multiply then and keep writing the program.

I've used "WDT Align Waveform Timestamps.vi" and there is no change in the waveforms.

I've sent the reference signal through a Lowpass filter with a higher cut off frequency than the actual frequency to check if I could create the same phase delay than in the PD signal. But I keep having a phase difference between waveforms.

I've tried to get the value of the phase difference using "Extract single Tone Information.vi" and even if the most of the time is between 110 and 125 degrees (sometimes 80 degrees or so), it keeps changing each time I run the program.

I've been trying to solve this phase difference for so long and try many many different VIs but I cannot get rid of this problem. I also tried "Align Waveforms (single shot).vi" but didn't work. This last one I'm not sure if I define it properly.


Does anybody know about any other VI I could try?

Thanks,
Untzi.
0 Kudos
Message 1 of 9
(4,952 Views)
There are several issues here, so let's take them one by one.
  1. The 6015 is not a simultaneous sampling device. If you take two channels of data with it “simultaneously,” there will always be at least a 5µs delay channel-to-channel due to the maximum ADC sample rate of 200kS/s. If you fetch using the waveform datatype, this time difference should be present in the t0 of each waveform.

  2. Digital filters are repeatable. Given the same input parameters, they give the same phase delay. Said phase delay is frequency dependent. The fact that you are getting large phase changes using Extract Single Tone Information.vi leads me to believe you have a data variability that is not being accounted for (frequency?). Extract Single Tone Information.vi requires about 10 cycles for accurate readings. Even then, if you want really accurate information, you should use line fits around zero crossings to get time difference information.

  3. Do you need to filter the data before you multiply by your reference, or can you do it afterwards? Filtering makes makes data look good to humans, but unless you are specifically getting rid of something that will mess up your analysis, you are better off leaving the data untouched until your analysis is complete. Check your analysis to make sure you are using robust methods.

  4. As with most analysis, there probably is not a single VI which will take care of your problem. However, there is probably a combination which will. Also, while LabVIEW has an enormous array of analysis, it does not have everything. If you hit a wall, don't be afraid to check out a book like Numerical Recipes in C and implement something yourself. It is easy in LabVIEW because all the basics are there.
If this doesn't help any, post more information on the goal of your project and we can probably help you more. There may be a much easier way to get the info you want than the way you have chosen.
Message 2 of 9
(4,937 Views)
Here are a couple of other suggestions:
1. Do you really need to filter at all? If the goal is to measure the delay, then I would think the fundamental frequency should do. Instead of trying to clean up the second signal, you could extract the fundamental frequency from both signals and compare the single tone phase (using Extract Single Tone Information on both signals). The extraction VI is not a filter, but can be easily used to return the extracted signal (using the "export signals" control and the "exported signals" output cluster). In this way you have the option of interpreting the measured phase or in working with the extracted single-frequency signal.
2. If you must filter and phase delay is an issue (as in your case), you should always consider linear phase FIR filtering, which delays all frequencies equally. The delay introduced, in samples, is (M-1)/2, where M is the filter size (number of coefficients or "taps"). For M odd, the delay is a whole number of samples and may be easier to handle. As you are working with Waveforms, you can use the Digital FIR Filter VI located in the Analyze >> Waveform Conditioning palette.
0 Kudos
Message 3 of 9
(4,914 Views)
Thanks!

But yes, I need to filter the signal first of all, but only the PD signal and not the reference signal. I am trying to build a basic Lock-in amplifier, and so I seems my problem is the phase delay between waveforms. This phase is very small so that the multiplication of signal is nearly positive. But the output after the lowpass filter is not nice and smooth, so I don't get a good DC value.

Even if in this experiment the signal does not look noisy, i will be moving to a much noisier set up. This one is just to build the Labview program and check.

Cheers,
Untzi.
0 Kudos
Message 4 of 9
(4,893 Views)
In this program the signal is taken directly from an external lock-in amplifier, so this is actually how my waveform and curve should look like.

Untzi
0 Kudos
Message 5 of 9
(4,891 Views)
If phase delay between the waveforms is much of the issue perhaps a USB-6015 is not the best card to handle the problem. Have you considered alternate products such as the USB-9215? Its a 4 channel simultaneous-sampling product (and low cost as well). Since the inputs are all clocked at the exact same time perhaps its a better solution...
0 Kudos
Message 6 of 9
(4,886 Views)
So there is no way to get the signal simultaneously with the USB-6015? And with an external trigger or something?

Untzi
0 Kudos
Message 7 of 9
(4,888 Views)
You don't need to filter your input to remove noise, the lock-in will do that for you. You also don't need to roll your own code, unless this is for a class and you are learning how to create lock-ins. Check out the following tutorial - How to Measure Small Signals Buried in Noise Using LabVIEW and Lock-In Amplifier Techniques.

You have another problem in that your signals are NOT simultaneously sampled. The USB-6015 is incapable of simultaneous sampling. It has one ADC and no sample/hold amplifer front end. You can either go to other hardware (as mentioned above), or resample your data to "change" the acquisition time. The Align and Resample Express VI will do this for you. I would recommend the different hardware route, if you can afford it.
0 Kudos
Message 8 of 9
(4,863 Views)
Hi Untzi, I'm also trying to develop a lock-in amplifier using LabVIEW, so I thought you might be interested to know what I'm doing even though I haven't made very much progress yet 😞 I'm using a diode laser which I can modulate the current of at a BNC connector on the control electronics front panel. So, my idea was to generate a sinusoidal signal in LabVIEW, modulate the current using this (instead of chopping the beam) and then carry out the phase sensitive detection in LabVIEW - maybe this would help with your simultaneous detection issue - you'd only need to detect the photodiode signal. Do you have analog output? I don't think the recommended LabVIEW LIA (using chopper) is suitable for my board (PCI-6035E), so I'm trying to modify one I found on the web - UTiLIA (University of Texas LIA). See http://mrflip.com/papers/LIA/. Let me know how you get on...
0 Kudos
Message 9 of 9
(4,738 Views)