# Measure the phase difference between the current and voltage

Discussion in 'Circuit Simulation & PCB Design' started by KamalS, Jul 18, 2010.

1. ### KamalSNew Member

Joined:
Jun 24, 2006
Messages:
51
Likes:
0
Location:
Orange, CA
To begin with, I want to measure the phase difference between the current and voltage of a signal having a freq. between 10Hz to 100Khz ( I would not mind measuring the same for freq. going up to 1Mhz, if possible using simple "junk box" type components )

To give an idea about my "junk box", I do have a few 74HC4046, XTALs, PICs ( 16F and 18F ).

What I don't have are >30Mhz PLLs, CPLDs, prescalers etc.

1. How do I go about extracting the voltage and current "parts" of a signal?

My end target would be to measure L and C, separately, without worrying too much about their Q ( which you have to take into account when using the LC oscillator type meters )

2. Would the phase difference, caused due to the L/C, between the current and voltage "parts" be, in any way, dependent on the Q of the L/C?

3. From what I saw on the internet, I can carry out some good simualtions to test my queries in LTSpice - but I am just starting to learn it.
Would anyone mind setting up a quick simulation for me guiding me how to extract the V and I and measure the phase difference between them?

2. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,049
Likes:
961
Location:
NJ
Hello there,

When you measure current you can use a sense resistor and measure the voltage across it and then use Ohms Law to calculate the current level.
This wont tell you the phase however, to get that you could use an op amp in a special circuit but i dont know if you have any op amps around.
The phase will be affected by the resistance of the inductor, the inductor, and the capacitor.

I would bet we could write equations to solve for all three elements, but solving might involve some measurements which im not sure you want to do. What kind of test equipment do you have around?

Last edited: Jul 18, 2010
• Like x 1
3. ### misterTWell-Known MemberMost Helpful Member

Joined:
Apr 19, 2010
Messages:
2,697
Likes:
368
Location:
Finland
Use two comparators to detect zero crossings in the voltage and current. You'll get two square waves with same phase difference and frequency as in the original signal (assuming the original signal is a sine wave). Feed these two square waves to XOR gate and you will get a PWM signal proportional to the phase difference. 50% duty means 90 degrees of phase difference.

You can read the duty cycle with a microcontroller using a timer/counter or an ADC (with low-pass filter).

My understanding is that you can measure the Q factor by measuring the phase difference. In fact this method is very good in high frequencies.

Last edited: Jul 19, 2010
• Like x 1

Joined:
Jan 12, 1997
Messages:
-
Likes:
0

5. ### bluesamNew Member

Joined:
May 26, 2010
Messages:
59
Likes:
0
Location:
Indonesia

hi
i'm just adding an info here (maybe you'll find it useful somehow)
for measuring some kind of it, u can use National Intruments "Labview", it'll create virtual instrument and can do virtual measurement
i found this related link: Power Quality Monitoring and Power Metering Tutorial - Developer Zone - National Instruments

gud luck
bluesam

6. ### KamalSNew Member

Joined:
Jun 24, 2006
Messages:
51
Likes:
0
Location:
Orange, CA
That is exactly what I want to do, but can't figure out how to do!

Could you help me out with some schematics ( preferably in LTSpice so that I can simulate it ) please?

7. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,049
Likes:
961
Location:
NJ
Hello again,

Do you know how to use a comparator in general? For detecting the zero crossing you would connect one terminal to ground and the other to the input signal if the voltage levels allow, or scale the voltage with some resistors first. As misterT said, you can then use a microcontroller to measure the duty cycle, or if you dont need super perfect accuracy you can do the following:

1. Take the output from the XOR gate and run it into an inverter (first inverter), then take that one's output and run it into a second inverter.
2. Take the output from each inverter and run it into an RC low pass filter with time constant to match frequency roughly, one filter per inverter. The first filter goes on the output of the first inverter, the second filter on the output of the second inverter.
3. Measure the average output voltage of the second filter, that gives us a voltage call it Va.
4. Measure the average output voltage of the first filter, that gives us another voltage call it Vb.
5. Add both voltages, that gives us V=Va+Vb.
6. The duty cycle is now calculated from D=Va/V (the ratio of Va to V).

To improve accuracy, use open collector inverters but also use a separate one for the first inverter (that's 3 inverters).
Note that the comparators are set up with the inverting terminal to 0v and the non inverting as the inputs.

Last edited: Jul 21, 2010