Author Topic: circuit that measures phase precisely?  (Read 5248 times)

0 Members and 1 Guest are viewing this topic.

Offline CopperConeTopic starter

  • Super Contributor
  • ***
  • Posts: 1415
  • Country: us
  • *knock knock*
circuit that measures phase precisely?
« on: November 30, 2017, 11:35:14 pm »
What is a precise phase measurement circuit? This is for comparing a square and sine wave at 40KHz.

I can do it empirically but comparing voltage and phase to tune something is a pain.

I wold like something that is like a window comparator for phase.  TO put on the circuit for the MCU to look at. I also want it temperature stable. I know ALD makes compactors with low offset voltage.
« Last Edit: November 30, 2017, 11:38:21 pm by CopperCone »
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23102
  • Country: gb
Re: circuit that measures phase precisely?
« Reply #1 on: November 30, 2017, 11:38:19 pm »
How accurate?

Scope will do a pretty good job. Some techniques here: http://eeshop.unl.edu/pdf/OscilloscopeTutorial--PhaseMeasurement.pdf

Otherwise, the other thing to do is build a zero crossing detector, connect that to the sine, then plug the output of that and the square wave one into each channel of a universal counter and measure period. Reciprocal counting may be required. HP 5315A would do the job nicely.

If you want it in circuit, microcontroller + timer.
 

Offline CopperConeTopic starter

  • Super Contributor
  • ***
  • Posts: 1415
  • Country: us
  • *knock knock*
Re: circuit that measures phase precisely?
« Reply #2 on: November 30, 2017, 11:39:06 pm »
I wanted an on board circuit though. I know that solution, I just wanted to make the autocal code for something I am building to be implemented easily.

A zero cross detector would make two square waves. 

Can you sum (with one inverted to negative voltage) them and rectify to a zero cross detector with a voltage set point based on the rectified voltage then use the ADC?
Would be possibly with chopper amplifiers since the frequency is low enough and your not doing gain.
« Last Edit: November 30, 2017, 11:46:41 pm by CopperCone »
 

Offline bd139

  • Super Contributor
  • ***
  • Posts: 23102
  • Country: gb
Re: circuit that measures phase precisely?
« Reply #3 on: November 30, 2017, 11:46:19 pm »
Possibly - haven't tried or seen that myself.

Some solutions from my notes:

If you want to measure precisely, you will need to count it to some resolution.

You can use a phase comparator (typical 4046 PLL application) if you want to just compare.

If they were both sines you could subtract them and then peak detect the output. That would rise if there was a phase difference.

If there are any better solutions, someone please let me know because I actually need this in a design I'm working on.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22435
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: circuit that measures phase precisely?
« Reply #4 on: November 30, 2017, 11:47:30 pm »
Use the square to chop the sine, using an analog switch.  Measure the average voltage resulting.

This resembles an XOR (type 1) phase detector, but with a sinusoidal rather than triangle-wave transfer function.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline CopperConeTopic starter

  • Super Contributor
  • ***
  • Posts: 1415
  • Country: us
  • *knock knock*
Re: circuit that measures phase precisely?
« Reply #5 on: November 30, 2017, 11:49:20 pm »
I think if your rails are bipolar, you could shift one down to 1/2 of the negative voltage of the output waveform (mine will be dead steady), and make sure your square waves are at the same amplitude.

in phase would be zero volts, so you make it trigger to a really small voltage. This could be measured with a ADC, or a comparator with low offset voltage can be used to flag. 

Only problem is that this would require opamps with no offset but high frequencies, I guess 10x the fundamental, in my case 400KHz... or I guess a slew rate calculation should be done.
« Last Edit: November 30, 2017, 11:51:01 pm by CopperCone »
 

Offline German_EE

  • Super Contributor
  • ***
  • Posts: 2399
  • Country: de
Re: circuit that measures phase precisely?
« Reply #6 on: December 01, 2017, 07:25:56 pm »
1) Ensure both inputs are square waves, or at least something that can drive logic.

2) Divide both signals by two using a 74xx74, this will give two waveforms with a 50:50 mark space ratio but a phase difference between them

3) Feed one divided signal to the set input of a third FF and the second signal to the reset input

4) The phase difference is the pulse width on the flipflop output, measure this using your instrument of choice from a scope to a 12-digit frequency counter. If you know the frequency of the input you should be able to convert pulse width to degrees.

Component count, 2 x 74xx74 plus maybe some signal conditioning on the input. Don't forget to ground the inputs of the spare FF on the second chip.
Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.

Warren Buffett
 
The following users thanked this post: nugglix, ahbushnell

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: circuit that measures phase precisely?
« Reply #7 on: December 02, 2017, 12:35:05 am »
A PSOC has comparators, opamps, Vref, ADC (SAR), and general
logic and counters and.....


For me what stands out is -

1) Routability
2) Fast 12 bit SAR A/D and slow 20 bit DelSig
3) DFB (Digital Filter Block) that is dual channel, handle FIR or IIR filters, or DFB
can be used as a GP fast processor block, similar to RISC block
4) MSI logic elements GUI based and/or the UDB Verilog capability. Eg. the FPGA
like capability
5) Onboard Vref
6) IDAC, VDAC, OpAmps (up to 4), comparator, mixer, switch cap, analog mux....
7) LCD,  COM, UART, I2C, I2S, One Wire, SPI, Parallel, LIN, CAN, BLE, USB
9) Custom components capability, create with schematic capture or Verilog
10) DMA to offload processes like filters, COM, Display
11) ARM M0 (PSOC 4) or M3 (PSOC  5LP) or 8051 core(PSOC 3) or M0+/M4 dual core PSOC 6
12) Extensive clock generation capabilities
13) All components supported by extensive prewritten APIs

https://www.element14.com/community/thread/23736/l/100-projects-in-100-days?displayFullThread=true

http://www.cypress.com/documentation/code-examples/psoc-345-code-examples

Great video library

Attached component list.  A component is an on chip HW resource.

Free GUI design tool with schematic capture, "Creator". Components have rich API library attached
to each component. Compilers free as well.

PSOC 4 is low end of family, consider 5LP parts as well. PSOC 4 also has arduino footprint boards (pioneer) as well. PSOC 6 dual core M0+/M4.

https://www.elektormagazine.com/labs/robot-build-with-cypress-psoc

http://www.cypress.com/products/32-bit-arm-cortex-m-psoc


https://brightcove.hs.llnwd.net/e1/uds/pd/1362235890001/1362235890001_5241352463001_2606504288001.mp4?pubId=1362235890001&videoId=2606504288001



Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 10289
  • Country: gb
Re: circuit that measures phase precisely?
« Reply #8 on: December 02, 2017, 01:57:32 am »
You still haven't specified the problem. How accurately do you need to estimate or align the phases? Simple approaches will work fine for a rough measurement, but if you want to estimate the phase difference between two sine waves to a small fraction of a degree you may need to use something like a correlation approach, especially if the sine waves have significant noise.
 

Offline scuzzyTerminator

  • Regular Contributor
  • *
  • Posts: 66
  • Country: us
Re: circuit that measures phase precisely?
« Reply #9 on: December 02, 2017, 06:45:48 am »
The AD8302 LF–2.7 GHz RF/IF Gain and Phase Detector looks nice and pretty simple to use but not cheap.

Digi-Key AD8302: ]https://www.digikey.com/products/en/rf-if-and-rfid/rf-detectors/862?k=AD8302]
Datasheet: http://www.analog.com/media/en/technical-documentation/data-sheets/AD8302.pdf
 

Offline CopperConeTopic starter

  • Super Contributor
  • ***
  • Posts: 1415
  • Country: us
  • *knock knock*
Re: circuit that measures phase precisely?
« Reply #10 on: December 02, 2017, 02:33:27 pm »
What is the correlation approach?
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 17260
  • Country: de
Re: circuit that measures phase precisely?
« Reply #11 on: December 02, 2017, 05:31:08 pm »
The correlation approach is about what Tim ( T3sl4co1l) suggested. This is measuring the cross correlation function of the two signals. Ideally one would need two channels, with a phase shift of about 90 degree for the square wave signal. This would one would get something like sine and cosine of the phase angle times a common amplitude value. So it would help if for the square wave signal, there would be a version with twice the frequency too.

It usually helps to know a little more about the application and the signals, as there can be other options two. For example it would make a big difference if the square wave signal is something like a divided µC clock. Also the noise level for the sine wave can make a big difference. Finally it also helps to know if you need ps resolution or µs would be good enough, and how stable the frequency is.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 10289
  • Country: gb
Re: circuit that measures phase precisely?
« Reply #12 on: December 02, 2017, 10:05:08 pm »
The correlation approach is about what Tim ( T3sl4co1l) suggested. This is measuring the cross correlation function of the two signals. Ideally one would need two channels, with a phase shift of about 90 degree for the square wave signal. This would one would get something like sine and cosine of the phase angle times a common amplitude value. So it would help if for the square wave signal, there would be a version with twice the frequency too.

It usually helps to know a little more about the application and the signals, as there can be other options two. For example it would make a big difference if the square wave signal is something like a divided µC clock. Also the noise level for the sine wave can make a big difference. Finally it also helps to know if you need ps resolution or µs would be good enough, and how stable the frequency is.
There are several approaches which fit under the general umbrella of a correlation approach, but they all use the basic property that two signals perfectly in phase hit their maximum correlation, and two signals exactly 90 degrees out of phase they hit their minimum correlation. Used well, this approach can be made very sensitive, and will detect tiny differences in phase. If you want to work out a phase difference to a tiny fraction of a degree, especially if the signals are noisy, you probably want to use some sort of scheme based on correlation.
 

Offline CopperConeTopic starter

  • Super Contributor
  • ***
  • Posts: 1415
  • Country: us
  • *knock knock*
Re: circuit that measures phase precisely?
« Reply #13 on: December 02, 2017, 10:52:06 pm »
YEA, That was my first choice, to tell the DDS chip to shift phase, hold, measure once stable, and repeat to scan the entire span for the lowest value.

Once the lowest value is found, the amplitude will be varied for cancellation (action cancellation).

I was going to use a precision diode to rectify the summed signals, and use resistor networks for all the summing etc so its stable.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->