Precision Phase angle measurement

Hi, I am trying to measure phase angle difference between nearly identical sinusoidal waveforms. I am presently trying with comparators as zero crossing detectors. Then run a counter with 2Mhz clock with either rising or falling edge. However results are very poor : accuracy of only 30minutes and result (stability)varying from 30minutes at 20% nominal voltage to

- 10 minutes at 120% voltage. Results are better for rising edge and poor for falling edge. Comparators are LM339. Nominal voltage is 1.42V rms or 2.048Volts peak. Can anyone suggest a method to achieve atleast 5minutes of stability for varying input volages? Thanks in advance, purushottam

Reply to
psdayama
Loading thread data ...

You don't menntion what the frequencies are so we can't tell what 5 minutes equates to in terms of time....particularly in relation to your use of 2MHz sampling. Further errors might be caused by hysteresis in the zero crossing detector used to eliminate noise.

Do you need to know the phase error cycle by cycle or averaged over 100 years?

How about putting one sin into a variable delay line and summing the output with the other sine on a sample by sample basis. Then adjust the delay until the output is a minimum.

Reply to
CWatters

The LM339 is a rather slow comparator, with a response time in the range of 1 to

1.5 usec, which is eating into your counter clock period quite fiercely. Get a faster comparator and your accuracy should improve dramatically.
--
Dave M
MasonDG44 at comcast dot net  (Just substitute the appropriate characters in the 
address)

Some days you're the dog, some days the hydrant.
Reply to
DaveM

Thanks for message. I am measuring our power frequency that is 50Hz

+/- 2.5Hz. It may be that I will need to measure at 60Hz. 2. I don't need to measure cycle by cycle but averaged over some cycles. At present I am measuring 10times per second and averaging every result to previous one. 3. I have no experience of using analog variable delay line. However it means that the delay line should have resolution of 1 in 360*60*2 for half minutes I am able to resolve presently with 2Mhz counter( It is in uC and hard-wired counter) Also I could use other circuits like Maxwell Bridge but they are frequency dependent.

Hope to to hear about this.

Reply to
psdayama

50Hz is 20mS If one cycle is 360 degrees = 20mS then 5 mins is around 4.6uS 5uS is around 10 ticks of a 2MHz clock so that should be ok.

So the problem is probably with the zero crossing detector. See the post by DaveM and use a faster comparator.

If you still have a problem check that any voltage hysterisis in the comparator isn't giving an error. This size of this error would depend on the source voltage, noise and the comparator thresholds.

Reply to
CWatters

Are you low-pass filtering these waveforms before the zero-crossing comparator? It wouldn't take a lot of noise to move the comparator's trigger a few us. To get an accurate phase angle comparison, the two low-pass filters would have to have matched phase delay at the frequency of interest, especially since you are measuring phase angle to very sub-degree precision.

Also, keeping the 2 MHz clock and other counter digital noise out of the comparators will be essential.

Jon

Reply to
Jon Elson

I am using simple R-C filter in the voltage devider as filter.& voltage follower. I have put exactly identical resistors in comparator ckts. Supply to LM339 is different from digital supply to uC which I am using as counter for phase difference and whole cycle count. I programmed the uC to show both counts on LCD I am using as display. There is are few counts variation in whole cycle count but abt 15-30 counts in phase difference. Obivously the whole cycle counts increases by 100s of counts from 20% to 120% of nominal voltage. I am also measuring peak amplitude of both signals but they are accurate to

+/- 0.25% . It is only the zero crossing detector problem. I have seen many fast (less than 0.2uS) and very low offset types (less than 100uV) but these are all useful for 5volts or less supply. As I want to measure 200% of nominal voltage so I have 4.096V as max ampltude for ADC. the same signal then has 8volts pk to pk amplitude. Therefore request anybody knows suitable fast comparator with atleast 12volts supply range. Thanks, purushottam
Reply to
psdayama

LM319 LM311 LM397 LM6511

--
Dave M
MasonDG44 at comcast dot net  (Just substitute the appropriate characters in the 
address)

Some days you're the dog, some days the hydrant.
Reply to
DaveM

For 50Hz, if you can digitise the two waveforms that you are interested in, using an ADC, then this should give you the best accuracy. You can calculate the phase of each waveform digitally, e.g. using a discrete fourier transform. This will allow you to reject the effects of harmonics in your input signal, which would upset any method that only uses the zero-crossings. If you do not use two ADCs sampling simultaneously but instead use one ADC which has an input multiplexer, then you will need to correct for the difference in the time at which the two inputs are sampled. It would be wise to sample at a sample rate much higher than 2*50Hz, I suggest several kHz at least, maybe several tens of kHz. You may also need quite a high resolution ADC to get the best accuracy, but you'll have to do some analysis to work out how good it needs to be.

Chris

Reply to
Chris Jones

Thanks Cris. I have already considered this as last resort. However I am not aware how I can get simultaneous reading of 2 ADC in in uC as they are to be accessed serially. I think I will have to use parallel ADCs and strobe their readings at say 100Khz and get their data in uC and process same. If U have any material on this kindly send the links. purushottam

Reply to
psdayama

You can use serial-interface ADCs if you connect the serial lines to some port pins on the microcontroller. If you want to get simultaneous sampling, you can do this by wiring both ADCs to separate pins of the same port of the microcontroller, and sending the same digital signals to the. Usually you only need to use separate wires for the data line of each ADC, the clock and enable or strobe lines can be shared. You can also get a single chip that can sample several signals simultaneously, e.g.:

formatting link

In fact there is not really any reason why you need to sample the two waveforms simultaneously, as long as you correct for the different sampling time in software.

Chris

Reply to
Chris Jones

If you feed your signal to a phase sensitive rectifier you get zero volts out when the reference is at 90deg. If you use your micro to generate the reference (square wave is fine) and feedback the psr output (error voltage) back to the micros ADC you can lock the reference to the signal. Repeat for the other signal. Since your micro is now producing both reference waves it knows what the phase shift is.

Reply to
cbarn24050

Main problem again is to get squared output for PSD(not my initials ! )- Phase sensitive detector requires squarewave to switch the signal's + &

- ve So same problem roundabout! I think that now only solution is to take

40K samples per cycle that is 2M samples/second. Then detect the zeros of ADC and use it as zerocrossing signal. After that micro will decide the difference and cycle time and give phase angle down to 0.5 minutes. Also then micro will find the peak amplitude of signal at checking abt 90 degrees.
Reply to
psdayama

Well thats easy as the micro is generating it.

Reply to
cbarn24050

if you're dealing with micros, have you thought about doing FFT to measure the differences ? using the same Micro to compare both ref and source would be perfect also, the variant levels of input would not effect the results. Just a thought. I did find at one time 8 bit Asm source code for doing FFT in a micro..

--
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
Reply to
Jamie

Thanks Jamie. I have never done FFT. So please send me the link for 8bit ASM code. I am just thinking to use parallel output ADC 12bit with bipolar signal. This will anyway required for FFT. Thanks in advance. purushottam

Reply to
psdayama

If you just detect the zeros in the waveform, it is no better than using an analogue comparator. If you are sampling the waveform with an ADC, then it is much better to measure the phase by multiplying the samples by a sine wave and averaging, and multiplying the samples by a cosine wave and averageing, and finding arctan of the ratio of these two averages. You could also use a FFT, though in this case I am not sure that it would be the quickest to run.

Chris

Reply to
Chris Jones

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.