Author Topic: phase extractor question  (Read 3151 times)

0 Members and 1 Guest are viewing this topic.

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
phase extractor question
« on: June 22, 2019, 06:06:20 pm »
Hi,
How can you convert a signal into in phase and quadrature components?
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: phase extractor question
« Reply #1 on: June 22, 2019, 07:36:33 pm »
two mixers in quadrature with IF outputs (low-passed) driving two modulators ?
« Last Edit: June 22, 2019, 07:39:46 pm by pwlps »
 

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #2 on: June 23, 2019, 02:10:25 am »
Yeah but how does one implement it physically?
 

Online coppercone2

  • Super Contributor
  • ***
  • Posts: 11344
  • Country: us
  • $
Re: phase extractor question
« Reply #3 on: June 23, 2019, 04:55:20 am »
 

Offline bob91343

  • Super Contributor
  • ***
  • Posts: 2675
  • Country: us
Re: phase extractor question
« Reply #4 on: June 23, 2019, 05:40:31 am »
I presume you have a reference signal?

Use a balanced modulator to get the two outputs.
 

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #5 on: June 23, 2019, 07:50:14 am »



Hey!

I'm a total noob. So why not show some cooperation man. >:(
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Re: phase extractor question
« Reply #6 on: June 23, 2019, 09:10:16 am »
What signal are you trying to seperate? And what is your reference signal? Digital or Analog?
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: phase extractor question
« Reply #7 on: June 23, 2019, 09:25:56 am »
Yeah but how does one implement it physically?

You buy mixers and implement them physically on a PCB  ;D

More seriously (and more friendly) we would need more information about the signals (frequency range, analog vs digital etc.). Also knowing the purpose of the whole circuit might help: it may happen that you actually don't need what you want because there is a better/simpler solution to your problem.
 
The following users thanked this post: ebastler

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #8 on: June 23, 2019, 03:48:23 pm »
I am trying to find a way to find the resistive and reactive part of an impedence.
Also I would like to know how such setup woks.
So the signal is analog and of frequency range less than few KiloHertz.
 

Offline bob91343

  • Super Contributor
  • ***
  • Posts: 2675
  • Country: us
Re: phase extractor question
« Reply #9 on: June 23, 2019, 05:09:20 pm »
With such a low frequency you can simply display the impedance on an oscilloscope and measure the trace.  Apply a voltage to the impedance and to one axis; display the current on the other axis.

A resistor will show a diagonal line.  A pure capacitance or inductance will display a diagonal line in the other direction.  A complex impedance will display an ellipse.

You display the current with a shunt, a small sampling resistor.

And of course you drive the whole thing with an audio oscillator.
 
The following users thanked this post: Achu

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #10 on: June 24, 2019, 03:31:52 am »
Yeah I have given that a thought, in fact I have done that in my college lab.But I was thinking one day I could use the idea to make an RLC meter.
 

Offline bob91343

  • Super Contributor
  • ***
  • Posts: 2675
  • Country: us
Re: phase extractor question
« Reply #11 on: June 24, 2019, 04:04:42 am »
There are almost as many ways to make an LRC meter as there are people trying to make them.  A couple of innovative ways are implemented in two instruments I have.

One is the very cheap Chinese 'magic' Mega 328 box that identifies components and measures them.  Very clever and a genuine bargain.  I use mine frequently.

Another, at the other end of the scale, is my GR 1658 Digibridge.  This thing measures R L and C at two frequencies very accurately.  It only uses one standard, I believe a 20 Ohm resistor or similar.  It does the job with a sophisticated system of signals all spaced 45 degrees in phase.  I can't explain it too well, partly because it's a bit over my head.  But download the manual and read how they do it.
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 4034
  • Country: us
Re: phase extractor question
« Reply #12 on: June 24, 2019, 04:22:01 am »
I am trying to find a way to find the resistive and reactive part of an impedence.
Also I would like to know how such setup woks.
So the signal is analog and of frequency range less than few KiloHertz.

In that case, digitize the signal with an ADC and then do it digitally.  Multiplying and sum the digitized waveform by the (DAC generated) output waveform and a 90 degree shifted version of the output.  That gives you the in-phase and quadrature signal.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: phase extractor question
« Reply #13 on: June 24, 2019, 11:28:09 am »
I am trying to find a way to find the resistive and reactive part of an impedence.
Also I would like to know how such setup woks.
So the signal is analog and of frequency range less than few KiloHertz.

Ok, so let's first recall the principle of extracting the phase shift by frequency mixing. Say you apply a voltage current I=I0 cos(wt) to your impedance Z=X+iY,  the voltage on Z will be V=I0*|Z|*cos(wt+phi).   (you also have tan(phi)=Y/X)
If you multiply the V signal by a reference signal cos(wt) you get cos(wt+phi)*cos(wt)=1/2(cos(2wt)+cos(phi)) and after a lowpass filtering you get a DC voltage proportional to cos(phi)  (principle of "synchronous detection").  So basically you multiply the current by the voltage. To measure the current and voltage at the same time just put a shunt resistance in series with the unknown impedance Z you measure, the voltage on the resistance is proportional to the current.

 For practical implementation you can feed the R-Z series impedance via a transformer and set the ground in the middle point between R and Z. If you don't have a transformer use two opamps configured as voltage subtractors (differential amps).

In RF we use double balanced mixers for multiplication but you won't find DBMs for such low frequencies. 
For frequencies below a few MHz you can find active analog multipliers like the AD633 (it has differential inputs so you won't need any additional voltage subtracting circuit).  Note also that your reference signal does not need to be sinusoidal, it can be (and in fact is the most often) a square wave, as you can easily show applying the calculations above to the Fourier series expansion of a square wave. Multiplication by a square wave is much easier: just periodically changing the sign of the input signal, if you want a purely analog circuit (no microcontroller) it is easy to assemble such a "DBM" with a comparator, inverter and a DPST analog switch (I did it once in a similar low-frequency application, the "home made" mixer circuit was chosen mainly for pedagogical reasons but it worked very well).  This also has the big advantage that the output is independent of the amplitude of the reference signal.

Now there is a little problem with measuring small phase shifts because cos(phi) will be very close to 1 and not varying much. This is why we usually use two mixing circuits with two reference signals in quadrature, so that you get cos(phi) and sin(phi) at the same time*. Another benefit of quadrature detection is that the determination of the phase angle will not depend anymore on any signal/reference amplitudes nor on the value of the shunt resistance.  For low frequencies it can be done easily with a microcontroller and is maybe a bit more difficult with a purely analog circuit, I have seen two types of circuits:  1)  a two D flip-flop circuit to generate two square-wave reference from a 2f input, then a lowpass to get the sinusoidal excitation signal; 2) using an R-C network and two comparators to detect zero-crossing of the R and C voltages (then no need for a lowpass). 

* This also allows to determine the sign of phi, not possible with cos(phi) alone.
« Last Edit: June 24, 2019, 01:47:49 pm by pwlps »
 
The following users thanked this post: Achu

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: phase extractor question
« Reply #14 on: June 25, 2019, 03:36:43 pm »
Here is a quick and dirty trial of a "beginner grade" analog circuit to measure Z by the method I explained in the previous post. (Of course professionals are welcome to criticize it  :) ).  For the values in the schematic the theory gives tan(phi)=2*pi*1000*0.1/5000=0.1256 and the simulation gives tan(phi)=Vsin/Vcos=63/506=0.1245.

Edit: I started with a transformer but I think a version measuring current by a transimpedance would be more practical (I will make one if I have time). Anyway it was to show the principle, there are many possible variations.
« Last Edit: June 25, 2019, 04:12:38 pm by pwlps »
 

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #15 on: December 31, 2019, 01:43:52 pm »
Could you explain how the op amp section work?

Thank you
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: phase extractor question
« Reply #16 on: December 31, 2019, 06:02:58 pm »
Could you explain how the op amp section work?

Thank you

There is nothing special about the opamp section: U7 is a high impedance buffer and U1 an inverter. U3 and U6 select either a direct or inverted voltage depending on the sign of reference signals (square waves) Vrefc and Vrefs (see my explanations posted on June 24).

If you were asking about U2 and U8 these are comparators, not opamps. U2 generates a square signal following the voltage across C1 and U8 generates a square signal following the voltage across R1. Since R1 and C1 are in series the voltage across R1 is proportional to the current through C1, therefore the two generated square signals are in quadrature. The U8 signal Vrefc is in phase with the current through Z (because Z is in series with R1) and the U2 signal Vrefs is in quadrature with it.   R8 and R11 are just to provide a DC polarisation of the comparator inputs.
 
« Last Edit: December 31, 2019, 06:33:17 pm by pwlps »
 

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #17 on: January 01, 2020, 01:15:07 pm »
Ok thanks for explaining.
Now, if I were to use it as an LCR meter, when measuring a capacitor one of the output voltage will be negative and could you tell me how would I measure it using a standard Microcontroller ADC say,Arduino or PIC.?

I know I'm going off topic but I could really use the knowledge.

Thank You
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: phase extractor question
« Reply #18 on: January 01, 2020, 04:05:10 pm »
Ok thanks for explaining.
Now, if I were to use it as an LCR meter, when measuring a capacitor one of the output voltage will be negative and could you tell me how would I measure it using a standard Microcontroller ADC say,Arduino or PIC.?

I know I'm going off topic but I could really use the knowledge.

Thank You

Happy New Year!
You can map any voltage range to the 0-5V range, e.g.
https://electronics.stackexchange.com/questions/378301/circuit-for-mesure-positive-negative-voltage-vref-resolution
https://krakkus.com/measuring-negative-voltage-arduino/"

This needs a careful and stable calibration, therefore to correctly measure very small phase shifts (signal close to zero) I would add here an auto-zero feature using a micro reed relay like D31A3100 or equivalent.
 
 

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #19 on: January 02, 2020, 04:22:14 am »
Happy new year to you too!!

So it is possible to use the same circuit??
I used an SPST switch ti mix non shifted input and shifted reference and sampling gave same results I think, is that wrong?
Also if I were to remove the coupling transformer, how should I modify it?
And could I use an op amp current source to drive the impedance?
One more question, don't we need two readings for current and voltage?


Thanks
« Last Edit: January 02, 2020, 04:32:04 am by Achu »
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: phase extractor question
« Reply #20 on: January 02, 2020, 01:46:12 pm »

I used an SPST switch ti mix non shifted input and shifted reference and sampling gave same results I think, is that

wrong?
I don't use arduino so I'm not aware of its possibilities and constraints but ok if you say you can shift the ADC reference to measure negative voltages.
Quote
Also if I were to remove the coupling transformer, how should I modify it?
And could I use an op amp current source to drive the impedance?
Yes, as I was saying in a previous post using a transimpedance (as a current source) is another possibility and could be simpler to implement. 
But now I'm on vacations and can't do any schematics, try to do it yourself  :)

Quote
One more question, don't we need two readings for current and voltage?
You wanted to measure the phase shift between the voltage and current, the circuit does it measuring the voltage components in and out of phase with the current  (we could do it the opposite way, measuring the current components in and out of phase with the voltage). Make sure you understand well the math I explained and the principle of this measurement.
Now, if you want to measure the module |Z| as well you will need another input to separately measure the current amplitude (here sensed by R1 or, if a current source is used, from the voltage driving the current source).
 

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #21 on: January 04, 2020, 04:29:07 pm »
Hi

I made this design. Is it good?
I used a transimpedance amplifier to measure current.
« Last Edit: January 05, 2020, 12:12:43 am by Achu »
 

Offline unitedatoms

  • Frequent Contributor
  • **
  • !
  • Posts: 324
  • Country: us
Re: phase extractor question
« Reply #22 on: January 04, 2020, 08:37:58 pm »
@Achu. There are few improvements you can do.

1. Instead of commutating voltage, commutate the current. This way: Follower opamp loaded with R->switch->Transimpedance amplifier. This will maintain switch close to zero volts, where it is most linear.
2. Use much higher current to commutate, instead 10k, go to reasonably low R, 350Ohm, if op amp can stay stable and linear with that currents. This will allow to mask switch imperfect conductance injected charge better.
3. Instead of commutating opposite polarities through same switch/low pass filter, like positive vs inverted signal, commutate zero vs signal. This will make each feeding opamp not trying competitively regulate same filter aggregating results of 2 opamps. I found this being a precision problem. When you let two loop compete instead of precision of single loop you will get may be still fairly accurate value, but it will never settle in deterministic manner. It looks like chaotic wandering value with never disappearing small value. I did modelling last month and it took a lot for me to solve the cause of puzzling low frequency noise even in perfectly noiseless LTSpice.
4. Use a dedicated part for positive/inverted pair of signals. The phase will match perfectly. The inverter in your schematic is inevitable lag, making shift slightly more than expected 180 degrees.

« Last Edit: January 04, 2020, 08:46:22 pm by unitedatoms »
Interested in all design related projects no matter how simple, or complicated, slow going or fast, failures or successes
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: phase extractor question
« Reply #23 on: January 05, 2020, 03:28:22 am »
Hi

I made this design. Is it good?
I used a transimpedance amplifier to measure current.

Just one comment (on your version, I did not study yet the modifications suggested by unitedatoms): in your design Vrefc has some arbitrary additional phase shift with respect to the V signal, depending on C1,R6,R2.  If we call this phase shift theta, and with definitions Z=|Z|exp(i*phi), V=V0cos(wt), I=I0cos(wt-phi), I0=V0/|Z| then your measured voltages are (within a factor 2/pi or something like this):
Vcosphi=V0 cos(theta)
Vsinphi=V0sin(theta)
Icosphi=I0 cos(theta-phi)
Isinphi=I0sin(theta-phi)

You might avoid some redundancy designing the quadrature generator so that Vrefc is in phase with V and theta=0 (e.g. using an active differentiator), then you could get rid of the Vsinphi channel.
« Last Edit: January 05, 2020, 04:06:05 am by pwlps »
 

Offline AchuTopic starter

  • Contributor
  • Posts: 49
  • Country: in
Re: phase extractor question
« Reply #24 on: January 05, 2020, 01:23:24 pm »
I actually simply modified the previous design you provided earlier to remove the transformer.
So does your earlier design also create an arbitrary phase shift to the voltage?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf