Analog Signal Measurement

Thread Starter

Vihaan@123

Joined Oct 7, 2025
251
I am trying to read an analog signal - sine wave using ADC, my requirement is after sensing i want to know how much phase shift it has introduced. How to identify this phase shift? Does DAC will help to find out or any methods available. I want to compare the input signal and ADC read signal on an oscilloscope and find the phase difference.
 
Last edited:

WBahn

Joined Mar 31, 2012
32,878
The shift should just be the sampling period of the ADC. But, in addition to that, you also have the delay associated with any additional processing you do, which would be reflected in whatever you do to feed the signal to a DAC and then you have the additional delay of the DAC's sampling period.
 

Thread Starter

Vihaan@123

Joined Oct 7, 2025
251
I wanted to know if there is any other method apart from DAC to directly measure the ADC output to avoid the DAC sampling period, this is the request from customer to show the phase delay of sine wave, any such tools are available? I have option of zero crossing detection of the sine wave given to input capture pin does it help?
 

BobTPH

Joined Jun 5, 2013
11,524
A phase locked loop might be the answer. Depends on what you are really looking for.

Phase is a comparison between two signals, you are measuring only one signal, it is not clear to me what is even meant by phase here. I think you are really talking about the delay between sampling and the availability of the measurement.
 

joeyd999

Joined Jun 6, 2011
6,309
I am trying to read an analog signal - sine wave using ADC, my requirement is after sensing i want to know how much phase shift it has introduced. How to identify this phase shift? Does DAC will help to find out or any methods available. I want to compare the input signal and ADC read signal on an oscilloscope and find the phase difference.
This is directly determined by reading the datasheets:

If it's a Sample-and-Hold, the "phase shift" is how much time transpires between the when the input hold switch opens to when the ADC data is available.

And it's not really a phase shift, which is frequency dependent. It's more like a constant group delay: a time shift irrespective of frequency.

There will be additional delays (and possible distortions) on the front end, as well as digital processing delays on the back end (how long does it take to get the data out and process it). These you will have to determine from other datasheets, analysis, and your code (if any).
 

joeyd999

Joined Jun 6, 2011
6,309
As an alternative, you could output a precise square wave (or pulsed waveform) from your MCU directly into the input of the ADC, and compare the timing between the two in code -- how much time between the pin going high and the ADC value changing to a large number.

Further, if you want to display the time difference of these two signals on a scope, you'd need to DAC both (as simultaneously as possible), and probe both DAC outputs.

You could also DAC the computed time difference: the DC output value would represent the average time shift, and the AC value would represent the jitter -- if such knowledge is important.
 
Last edited:

Futurist

Joined Apr 8, 2025
765
I am trying to read an analog signal - sine wave using ADC, my requirement is after sensing i want to know how much phase shift it has introduced. How to identify this phase shift? Does DAC will help to find out or any methods available. I want to compare the input signal and ADC read signal on an oscilloscope and find the phase difference.
What is the frequency of the analog signal? what is resolution of your ADC? What is the signal exactly?
 

Futurist

Joined Apr 8, 2025
765
How would knowing any of these help you to answer the question?
If its a 1Hz sine wave any phase shift is likely going be close to 0, if its a 1GHz signal then the phase shift will likely be more dramatic.

If the ADC introduces a fixed delay interval then the phase shift becomes an easily calculable function of the signal's frequency.
 

Thread Starter

Vihaan@123

Joined Oct 7, 2025
251
Sorry i have not provided enough information, the input signal is mains AC signal converted to 3.3V 50Hz, hardware provided by customer, i plan to use the 12 bit ADC resolution. The requirement is to measure the phase delay introduced by the ADC sensing.
 

joeyd999

Joined Jun 6, 2011
6,309
Sorry i have not provided enough information, the input signal is mains AC signal converted to 3.3V 50Hz, hardware provided by customer, i plan to use the 12 bit ADC resolution. The requirement is to measure the phase delay introduced by the ADC sensing.
1) What's the sampling rate?
2) Zero-crossing (or level) detection is easy at 50Hz. You could use that as your reference signal for the time delay computation that I suggested above (and, subsequently, phase shift).
 

joeyd999

Joined Jun 6, 2011
6,309
Further: if the 20Khz clock is close to an exact multiple of 50Hz, the jitter will show up as a slow time shift change (like a beat frequency) varying linearly (through time) from 50 to 100uS and back again -- the rate of change of the beat will be temperature (and other things) dependent.

Usually, this is not important, but when it is, I choose a conversion clock that is not a multiple of the input signal frequency.

Alternatively, if you can generate your 20khz clock from the 50Hz signal source (i.e. via a PLL), then that beat goes completely away and the time shift becomes completely determinate.

My background is precision A/D conversion and processing. These are thing my work has to consider. I suspect that the 50-100uS estimate is probably good enough for your application.
 
Last edited:

Thread Starter

Vihaan@123

Joined Oct 7, 2025
251
The below is the graphs i came up with, with 50uS delay the phase shift is
360Deg - 0.02 sec => for 50uS it is 0.9Deg is what i get. I plotted in Desmos as below.
After the replies i have come to understanding that the sampling time + conversion time is fixed irrespective of the frequency. And this delay will be fixed even if i use it for further processing.

1780839020574.png

I have other ADC measurements as well in case if i am doing in serial this will further add the delay, so i should only plan for parallel measurements. One question i have is, i need to perform the rms calculation, so i have to take 400 samples and calculate every 20ms?
 
Top