# Calculating Phase angle from instantaneous voltage

For background info I am an EE/CE that is 10 years out of school and has since worked writing firmware and dealt mostly with digital communications and signals, so now I am having to reach back to my (very) atrophied analog knowledge.

I am working with a 4 channel ADC, and I am trying to get a rough estimate of the input skew between channels when a 'simultaneous' capture is performed.

So I got the device with all 4 channels hooked up to a single sine wave from my function generator, performed the capture, and am now trying to analyze the data.

I know the max amplitude of the sine wave, as well as the frequency. I remember calculating instantaneous voltage for known phase angles, but I can't seem to figure out how the get phase angle from voltage (I am aware that there will be two possible angles for a given voltage).

my overall game plan is to determine the angle of each reading, then using the known frequency get skew time by $$\sk = (Ch2\angle - Ch1\angle) * (360 \div hz) \$$

so I guess the short question is, how a can I get phase angle for a point on a known sine wave, or the long question is; is there a better way to go about what I am doing?

• If you have the derivative of the signal also (or an equivalent) you can get the phase angle uniquely; the sine passes the same value once when going up and once when going down. One stand-in for derivative is to take the difference with the previous sample.
– AJN
Jun 17, 2020 at 15:41
• Are two signals guaranteed to be pure sine waves of same frequency ? Will there be significant noise ? There may be better methods of calculating skew. You may want to search for phase detection schemes. Phase detectors are part of phase-locked loops and are well researched topic. Alternately, why not just subtract once channel with time delayed version of the other channel and search for the delay which results in minimum difference signal. that delay is the time delay between the signals.
– AJN
Jun 17, 2020 at 15:43
• +1 to what @AJN said- It's easy if you have 2 noiseless perfectly sinusoidal waveforms of known amplitude and frequency. If anything is non-ideal or noisy it becomes a much bigger challenge. Jun 17, 2020 at 15:48
• Phase is relative. To get absolute values you must choose stable reference at same identical frequency.. Consider a PLL. But more import why do you want to measure this? Jun 17, 2020 at 15:51
• I guess I need to elaborate on my setup. I bent component leg into a L shape, then soldered it in between the two adjacent inputs pins on the ic, then clipped my coaxial probe from my function generator to that. The skew I think I am getting is large enough, and the frequency ranges are low enough, that I any error I get will be fine. I just looking to run several trials to compare different capture methods and I thought comparing relative time would be more useful than measuring relative difference in voltage, since that wouldn't be linear. Jun 17, 2020 at 15:57

You need to know the exact time difference between the instants when each of the waveform peaks.

If V1 peaks at t1 and V2 peaks at t2, or you somehow measure the time interval delta_t between their peaks, you can calculate the phase difference between them by using the following formula. T is the time period of the wave-forms.

phase difference (in degrees) = delta_t * 360 / T = (t1 - t2) * 360 / T

There are some other methods like zero crossing detection or more sophisticated techniques using FFT but I think the peak detection, like I described above, will give you a good estimate with minimal effort.

See the figure "normal measurement" for what I am trying to say. But sometimes your signal is noisy (see figure "noisy measurement"), and in that case, peak detection algorithm will have some innaccuracy depending on SNR.

Assuming you have some calculation hw (computer or micro) you can use FFT or sine-wave fitting.

1. with FFT you calculate the angle of the fundamental you have applied for each of the four channels; for accurate results sampling must be synchronous, otherwise the real frequency will occur in between two bins (picket fence effect); in this latter case you should use interpolation e.g. by using 3-point DFT interpolation.
2. sine wave fitting will remove most of the distortion and noise, so that you can then apply simplified calculations (e.g. zero crossings) knowing that the signal you use is really sinusoidal.