circuit that measures phase precisely? - Page 1
Forum section: electronics / projects

author: CopperCone
author_rank: Super Contributor
timestamp: November 30, 2017, 11:35:14 pm
content: 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.

author: bd139
author_rank: Super Contributor
timestamp: November 30, 2017, 11:38:19 pm
content: How accurate?Scope will do a pretty good job. Some techniques here:http://eeshop.unl.edu/pdf/OscilloscopeTutorial--PhaseMeasurement.pdfOtherwise, 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.

author: CopperCone
author_rank: Super Contributor
timestamp: November 30, 2017, 11:39:06 pm
content: 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.

author: bd139
author_rank: Super Contributor
timestamp: November 30, 2017, 11:46:19 pm
content: 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.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 30, 2017, 11:47:30 pm
content: 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

author: CopperCone
author_rank: Super Contributor
timestamp: November 30, 2017, 11:49:20 pm
content: 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.

author: German_EE
author_rank: Super Contributor
timestamp: December 01, 2017, 07:25:56 pm
content: 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 them3) Feed one divided signal to the set input of a third FF and the second signal to the reset input4) 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.

author: danadak
author_rank: Super Contributor
timestamp: December 02, 2017, 12:35:05 am
content: A PSOC has comparators, opamps, Vref, ADC (SAR), and generallogic and counters and.....For me what stands out is -1) Routability2) Fast 12 bit SAR A/D and slow 20 bit DelSig3) DFB (Digital Filter Block) that is dual channel, handle FIR or IIR filters, or DFBcan be used as a GP fast processor block, similar to RISC block4) MSI logic elements GUI based and/or the UDB Verilog capability. Eg. the FPGAlike capability5) Onboard Vref6) 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, USB9) Custom components capability, create with schematic capture or Verilog10) DMA to offload processes like filters, COM, Display11) ARM M0 (PSOC 4) or M3 (PSOC 5LP) or 8051 core(PSOC 3) or M0+/M4 dual core PSOC 612) Extensive clock generation capabilities13) All components supported by extensive prewritten APIshttps://www.element14.com/community/thread/23736/l/100-projects-in-100-days?displayFullThread=truehttp://www.cypress.com/documentation/code-examples/psoc-345-code-examplesGreat video libraryAttached component list. A component is an on chip HW resource.Free GUI design tool with schematic capture, "Creator". Components have rich API library attachedto 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-psochttp://www.cypress.com/products/32-bit-arm-cortex-m-psochttps://brightcove.hs.llnwd.net/e1/uds/pd/1362235890001/1362235890001_5241352463001_2606504288001.mp4?pubId=1362235890001&videoId=2606504288001Regards, Dana.

author: coppice
author_rank: Super Contributor
timestamp: December 02, 2017, 01:57:32 am
content: 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.

author: scuzzyTerminator
author_rank: Regular Contributor
timestamp: December 02, 2017, 06:45:48 am
content: TheAD8302LF–2.7 GHz RF/IF Gain and Phase Detectorlooks 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

author: CopperCone
author_rank: Super Contributor
timestamp: December 02, 2017, 02:33:27 pm
content: What is the correlation approach?

author: Kleinstein
author_rank: Super Contributor
timestamp: December 02, 2017, 05:31:08 pm
content: 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.

author: coppice
author_rank: Super Contributor
timestamp: December 02, 2017, 10:05:08 pm
content: Quote from: Kleinstein on December 02, 2017, 05:31:08 pmThere 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.

author: CopperCone
author_rank: Super Contributor
timestamp: December 02, 2017, 10:52:06 pm
content: 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.