Showing results for 
Search instead for 
Did you mean: 

How do I measure the phase difference between 2 square wave inputs

I am trying to measure the phase difference between 2 square waves but am having some problems. Using previous posts I have been able to make a circuit that works for sine waves but when I try square waves I cannot get a correct output. The inputs have slightly different frequencies and amplitudes. I m not sure if this can be done but any suggestions would be greatly appreciated.
0 Kudos
Message 1 of 4
If the two signals are not the same frequency, the phase relation between the two will be constantly changing.  You can measure it at a point in time, but if you measure it again at a different point, you will get a different answer.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 4
Try multiplying the two signals together and lowpass filtering the output .  If the  two signals are of constant, but different frequencies, you should get a triangle wave as an output the varies at the difference in frequencies.  This is a basic phase detector.
Randall Pursley
Message 3 of 4

If the frequencies are the same, but there is a phase shift, this is basically the impulse response to the filter correct?  Multiplying the waves will create a pulse train with the low time being the phase shift in milliseconds or whatever.  Any ideas how one would go from this filtered signal to an actual phase shift value?  It's been a while since DSP...

0 Kudos
Message 4 of 4