Go Down

Topic: mesure phase shift (Read 908 times) previous topic - next topic

dwightthinker

I think I forgot a square root in there.
Before doing an arc tan you need to do a square root.
Using off chip zero cross detectors is not as good as
doing a correlation of the two signals. Still, for
most things, it is probably good enough. It works good
for nice things like motors but not so good for things
like switcher power supplies.
Dwight

jremington

Is it that difficult?
So I reckon its the same problem as implementing a software PLL.
For a beginner, yes, it is very difficult.

MarkT

But maybe a question in "science and measurement" isn't a beginner question?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

jremington

Can't you judge for yourself?
I'm a new Arduino new learner.can Anyone give me the arduino code to measure phase shift of two signal?

allanhurst

An old trick for finding an accurate zero crosssing on a signal ( +ve or -ve ) it to invert the signal and put a comparator beween the inverted and non-inverted signal.

Given fast devices, this works up to quite a high frequency - MHz.

Do this for each of your signals, and time between the two resultant square waves

this comparison even takes out the delay of the invertors and comparators ( which should be pretty small).

regards

Allan

dwightthinker

Zero cross seems to assume a sine wave. Current wave
forms of current day devices are not sign waves.
The only real way is to integrate the instantaneous current
times the instantaneous voltage and compare that to the
integration of the current squared.
This is more complicated than zero cross.
of course if all one is looking at is sine waves then there is
no reason to do more.
Dwight

allanhurst

Quote
Zero cross seems to assume a sine wave.
By no means! I was told this trick by an old video mixer design engineer for finding the start and end of a sync pulse of in  good 'ole PAL

regards

Allan



dwightthinker

The original problem was power factor, not phase delay.
The phase delay is not useful if the current is not a matching
delayed sine wave.
Dwight

dwightthinker

I'd given this more thought.
I believe it would be the integral of V*I divided by the integral of |V*I|
ove one cycle of either voltage or current. This is where a zero cross
would be useful.
Just doing as many samples of the current and the voltage might
be close enough.
If these were equally spaced, for each measurement, say voltage,
one could use the average of the current before and the next current after
( interpolating between the two ).
Dwight

vishnu91

Is it that difficult?  You can determine the phase of each signal relative to the sample time for each,
then correct for the sample time difference since delta phase = frequency x delta time.  Indeed
you can run two software phase-locked-loops in tandem referenced to micros() and get the phase
difference directly.

So I reckon its the same problem as implementing a software PLL.
how can we measure the time difference between two analog signals. i am facing the same problem here.

jremington

Quote
how can we measure the time difference between two analog signals
First, define "time difference".

dwightthinker

If both signal are the same, one can measure the time
of zero crossing.
What I mean by the same is that they are sine/cosine,square, triangular or such,
of the same frequency.
You can not measure the phase difference between two signals such as a sine
and a triangular unless the zero crossings have some meaning.
For measuring power factor, see my post 23 ( corrections on earlier posts ).
This works with any shape of wave form.
Real life power does not have current that follows a sine or cosine wave.
That only works with things that have a fixed impedance, regardless of voltage.
If you just need phase angle, you use two zero cross detectors and one of the
timer modes.
One can do a search for zero cross detection on the forum. I'm sure you'll find
examples.
If you are making a power factor meter, for real world applications, it is not
just a phase difference.
Dwight



Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy