You are on page 1of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Chapter 16 Measurement of Frequency and Phase Shift (Revision 3.0, 24/5/2008) 1. Introduction The measurement of frequency and phase shift are closely linked. This Chapter examines the various methods used to measure them. Many of the methods can be used to measure both variables at the same time. 2. Frequency Measurement There are four main methods for measuring frequency. These are discussed in the four subsections below. 2.1 Digital counter-timers The most widely used method for measuring frequency is to use a digital counter that is incremented by the frequency to be measured. Figure 1 shows the block diagram of digital counter used to measure frequency. The system internally generates a pulse that is used as an enable signal to the AND gate. The AND gates allows the signal to be measured to increment an n bit counter for the duration of the enable pulse. The signal to be measured is signal conditioned into a digital logic square wave that has the same phase and frequency of the original signal. The final count on the counter represents the frequency to be measured. At the start of the enable pulse the counter is reset, and at the end of the enable pulse the output of the counter is loaded onto a buffer that displays the number on a digital display. If the counter overflows, this indicates that the frequency to be measured is too high for this range and a higher range must be selected by choosing a pulse with shorter time duration. In auto-ranging systems, this change in range is done automatically. For continuous measurement, this process is repeated so that the display is updated with a new value of the frequency of the signal every cycle. The following equation applies in this case:
tenable = 1 f max ( external ,unknown ) 2n 1

Copyright held by the author 2008: Dr. Lutfi R. Al-Sharif

Page 1 of 21

16 Measurement of Frequency and Phase Shift


tenable1

0908341 Measurements & Instrumentation

Frequency range selector switch (automatic or manual)

Digital LCD display Binary to BCD Storage buffer


An-1 A0 Load (at trailing edge)

tenable2 f2 range tenable3 f3 range

f1 range

f3>f2>f1 Internal time reference tenable

AND

tenable

External signal to be measured

n bit counter

Signal conditioning (signal converted to square wave at digital logic)

Reset counter (at leading edge)

A zero or low count indicates the need to change to a lower range

Overflow (indicates the need to change to a higher range)

For continuous measurement, the enable signal becomes periodic as shown Reset Load

Figure 1: Block diagram of the circuitry for a digital counter (suitable for the measurement of high frequencies).

The digital counter system discussed above is suitable for high frequency signals. For low frequency signals this system fails, as it will take a long time to measure the frequency of the signal (e.g., if the signal has a frequency of 0.1 Hz, it will take it 10240 seconds (2.8 hours) to fill a 10 bit counter!). When the frequency of the signal is low, the digital timer method is more suitable. Figure 2 shows a block diagram of a digital timer used to measure low frequency signals. Notice that the roles of counting and time enable have now been reversed: whereby the signal to be measured provides the time enable pulse, and the counting frequency signal is generated internally.

Copyright held by the author 2008: Dr. Lutfi R. Al-Sharif

Page 2 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Frequency range selector switch (automatic or manual) f1 range f2 range

Binary to BCD Value inversion* Storage buffer


An-1 A0

Digital LCD display


*Digital processing to convert from period to frequency

f3 range f3>f2>f1 Internal frequency reference

Load (at trailing edge)

AND

tenable

External signal to be measured fx

n bit counter
tenable=1/fx

Signal conditioning (signal converted to square wave at digital logic) Width of pulse equals period of signal

Reset counter (at leading edge)

A zero or low count indicates the need to change to a higher range

Overflow (indicates the need to change to a lower range)

For continuous measurement, the enable signal becomes periodic as shown Measurement takes place every other period Reset Load

Figure 2: Block diagram of the circuitry for a digital timer (suitable for the measurement of low frequencies).

Note on the figure above: enable signal is symmetrical, as it is based on the signal to be measured and is not under our control. For various ranges, different internal frequencies are used as shown on the three ranges (f1, f2 and f3). An overflow in the counter indicates the need to move to a lower range, while a zero or low counter indicates the need to move to a higher range. In auto-ranging systems this is done automatically. There is one important difference in this case with the digital counter method. The final count in this case is inversely proportional to frequency measured (in fact it is proportional to the period of the signal). For this reason inversion processing is need on the final count to make it representative of the frequency. This is shown in the figure as a value inversion block. For continuous measurement, the process is repeated every other cycle of the signal to be measured, whereby the counter is reset at the leading edge of the time enable signal and the count is loaded at the trailing edge of the time enable signal. The following equation applies to the digital timer mode: Copyright held by the author 2008: Dr. Lutfi R. Al-Sharif Page 3 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

t enable =

1 f min( external ,unknown )

1 f internal

2n

Figure 3 below shows a multi-function 3.5 GHz Counter that can measure frequency, period and total number of events.

Figure 3: 3.5 GHz Mutli-function Counter (Frequency, Period, Totalise) Model # 1856D (courtesy of: B+K Precision Instrument, CA, USA).

2.2 Oscilloscope Another method of measuring frequency is to use an oscilloscope in the socalled X-Y mode. If a signal with an unknown frequency is entered on the X channel and another signal from a function generator is entered on the Y channel, and the frequency of the signal from the function generator is continuously changed until we get a stable pattern, it is possible to deduce the frequency of the unknown signal from the resultant pattern. The resultant pattern is called a Lissajous Pattern, examples of which are shown in Figure 4. Note that the shape of a Lissajous Pattern depends on the ratio of the two frequencies as well as the phase shift between them. Some basic examples of Lissajous patterns are: 1. A straight line indicates that the frequencies of the two signals are equal and that the phase shift between them is zero degrees.

Copyright held by the author 2008: Dr. Lutfi R. Al-Sharif

Page 4 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

2. A circle indicates that the frequencies of the two signals are equal and that the phase shift between them is 90 degrees. 3. An ellipse the major axis of which is pointing towards the top right hand corner, means that the frequencies of the two signals are equal and that the phase shift is somewhere between zero and 90 degrees1. Figure 4 shows six graphs for the cases where the x and y signals have equal frequency but are out of phase by a certain angle (0, 30, 45, 90, 135 and 180). Note that the x signal is applied to the left and right hand side plates (i.e., horizontal deflection plates) and that the y signal is applied to the top and bottom plates (i.e., vertical deflection plates) of the oscilloscope.

Circular and elliptical wave polarisation has applications in finding the resultant electrical field of two or more electromagnetic waves. For waves that are travelling in the z direction, the resultant the electrical fileds in the x and y directions depends on the magnitude and phase shift of the components of the electrical components in the x and y directions. This results in a rotating electrical field component. The magnitude of this rotating electrical filed follows a circular or ellipticall path.

Copyright held by the author 2008: Dr. Lutfi R. Al-Sharif

Page 5 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Figure 4: Lissajous patterns for two sinusoidal signals with equal frequencies and various phase shift angles.

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 6 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

In case where the frequencies of the two signals are not equal, the figures get more complicated than just a line, ellipse or circle. Figure 5 shows the Lissajous pattern that would result from two sinusoidal signals applied to the x and y axes, with the frequency of the y-axis signal twice that of the x-axis and the phase shift between them of 90 degrees.

Figure 5: Lissajous pattern caused by two sinusoidal signals with a frequency ratio of 1:2 (x:y) and 90 degrees phase shift.

In general it is meaningless to talk about a phase shift between two signals of different frequencies. However, it does become possible to do this for frequencies that are whole multiples of each other. In this example the 90 degrees phase shift represents 90 degrees phase shift for the lower frequency signal and 180 degrees for the higher frequency signal that has twice the frequency. This is shown in Figure 6.

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 7 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Figure 6: Phase shift between two signals that do not have the same frequency.

The Lissajous pattern can also be generated for signal that have more complicated ratios of frequencies (e.g., 2:3, 3:4). An example of this for two signals that have a ratio of 3 to 2 and phase shift of 90 is shown in Figure 7 below. Note that a simple way of finding out the ratio of the frequencies of the two signals is to count the number of edge-crossings that the pattern makes with the x boundary and the y boundary as shown in Figure 7.

Figure 7: Lissajous pattern caused by two sinusoidal signals having a 3:2 (x:y) frequency ratio and a 90 degrees phase shift.

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 8 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Problem 2 at the end of this Chapter contains more details on the information contained in a Lissajous pattern and how to interpret the data, especially to find out which of the signals leads the other in case of a phase shift between them. All the discussions so far have assumed the following: 1. The two signals have equal amplitude. 2. The oscilloscope sensitivities for both channels are equal. This has resulted in a square type of display where the x deviation and the y deviations are equal. If the two signals do not have equal amplitudes, or the oscilloscope sensitivities are not set to equal settings, the display will be rectangular rather than square. When this is the case, two signal of equal frequency and 0 phase shift would show a line that is NOT at 45 to the horizontal (e.g., as shown in Figure 8 where the amplitude of one signal is 1.5 times the other). This causes the line to be inclined at 33.7 rather than 45. It is very important to note that this angle of incline has nothing to do with the phase shift between the two signals and is solely caused by the difference in amplitude.

Figure 8: The inclination of the Lissajous figure when the amplitudes of the two signals are unequal.

Another method of measuring the frequency with the oscilloscope (but that is crude and inaccurate) is to display the signal on the oscilloscope in the Y-t mode against the oscilloscopes time-base, and to measure the duration of one period. 2.3 Phase Locked Loop (PLL) This is a method of measuring the frequency of signal that is submerged in noise to an extent that it is difficult to distinguish the signal from the noise. Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif Page 9 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Using a PLL allows regeneration of a new signal that is the same phase and frequency as the original signal. PLL was discussed in the Noise Chapter. The 4046 is a phase-locked loop circuit (of the 4000 CMOS logic family) that consists of a linear voltage controlled oscillator (VCO) and two different phase comparators with a common signal input amplifier and a common comparator input [4]. 2.4 Wien Bridge The fourth method is to use an AC bridge, called the Wien Bridge. This was discussed in detail in the Chapter on AC Bridges. 3. Phase Shift Measurement There are four methods to measure the phase shift between two signals. These are discussed below. It is important to remember that in order to compare the phase shift of any two signals, their frequencies must first be equal; it is meaningless to compare the phase of two signals if there frequencies are different. 3.1 Digital Timer The same device discussed earlier (digital counter-timer) can be used to measure the time elapsed between the zero crossing of one signal and the zero crossing of another. An example of a digital timer based system that measures phase angle is shown in Figure 9.

Figure 9: A digital timer based, phase angle metre that can be used to synchronise generators (Courtesy of Laureate Electronics, Inc., USA).

3.2 Oscilloscope This has been discussed in detail earlier in this Chapter. 3.3 XY Plotter Lissajous Patterns discussed earlier can be used in the same way on an XY plotter. The main limitation of an XY plotter is the limited frequency response (around 10 Hz maximum). 3.4 Phase sensitive Detector Another method of finding the phase shift between two signals is to multiply them by each other and then retrieve the DC content of the resultant signal. Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif Page 10 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

It can be shown that the DC content is proportional to the cosine of the phase shift angle between the two signals, and hence achieves its peak when the phase shift is zero. References & Bibliography [1] Measurement & Instrumentation Principles, Alan S. Morris, Elsevier, 2001. [2] Modern Electronic Instrumentation and Measurement Techniques, Albert D. Helfrick and William D. Cooper, Prentice Hall International Editions, 1990. [3] Elements of Electronic Instrumentation and Measurement, Joseph J. Carr, Third Edition, Prentice Hall, 1996. [4] HEF4046B, MSI, Phase-locked loop, Philips Semiconductors, January 1995. Problems 1. We want to measure the frequency of a signal that varies between 20 kHz and 200 kHz. We shall use a 16 bit binary counter. The signal to be measured is converted to a square wave and directed to the 16 bit binary counter for a period of 100 ms (i.e., 0.1 second), as shown in the figure below. Output to digital display 16 bit counter External signal to be measured AND Gate

100 ms

Internal time reference

Figure 10: Block diagram of the circuitry for frequency meter.

Answer the following questions: (a) (b) (c) (d) What is the more suitable method for measuring the frequency of the signal in this case: Frequency measurement or period measurement? What are the maximum and minimum possible counts based on the expected range of the input frequency? What is the maximum possible frequency that this device can measure? What is the minimum possible frequency that this device can measure?

Solution (a) As the frequency of the input signal is relatively high, the more suitable method is the frequency method. Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif Page 11 of 21

16 Measurement of Frequency and Phase Shift (b)

0908341 Measurements & Instrumentation

The maximum possible count occurs when the input signal has a frequency of 200 kHz. As the gate opens for 100 ms, the number of pulses will be: 0.1x200kHz= 20,000 pulses.

This is the maximum possible count. The minimum possible counter occurs when the input signal the frequency of 20kHz. Minimum count= 0.1x 20 kHz= 2000 pulses. (c) The maximum possible frequency is the frequency that causes the counter to overflow. The maximum count on the counter is 2^16-1= 65535. As the gate is only open for 0.1 s, the maximum signal frequency will be 10 times this number: Maximum frequency = 65535/0.1= 655350 Hz. The minimum frequency is the frequency that causes only one pulse to be counted. So the minimum frequency is 10 Hz. To be precise, it has to be slightly more than 10 Hz to cause a count.

(d)

2. The diagram below shows an elliptic figure, as would be seen on the screen of an oscilloscope with an X-Y mode setting. Assume that Channel 1 is the X signal and Channel 2 is the Y signal. The sensitivity (Volts/Division) settings of both channels on the oscilloscope are equal. Based on the diagram find the following (in terms of A, B, C and D if needed): a) b) c) d) The phase shift between the two signals. The ratio of the frequencies of the two signals. The ratio of the amplitude of the two signals. The phase lead/lag between the two signals (i.e., which is leading and which is lagging).

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 12 of 21

16 Measurement of Frequency and Phase Shift Y axis

0908341 Measurements & Instrumentation

C X axis

B Solution Based on the figure above: a) The phase shift between the two signals is equal to arcsin(A/B)=arcsin(C/D). Note that we cannot tell solely from the values of A and B (or C and D) which signal is leading which. As the shape is an ellipse then the frequencies of the two signals are equal. B represents the amplitude of Ch1 (x); D represents the amplitude of Ch2 (y). Provided that the sensitivities of both channels (i.e., volts/division) are equal, then the ratio of the amplitude of x to that of y is B:D. The relative phase of the two signals can only be decided from Lissajous Figure if we know the sense of rotation (i.e., clockwise or anticlockwise). If the rotation is clockwise, this means that Y is peaking before X and hence that Y is leading X. If the sense of rotation is anti-clockwise, this means that X is peaking before Y and hence that X is leading Y. [This assumes that positive X values lead to a deflection towards the right and the positive Y values lead to a deflection towards the top].

b) c)

d)

Sense of Rotation: In practice, when using the oscilloscope with high frequencies we cannot detect the sense of rotation and hence cannot decide from the figure which signals is leading. However, when using the oscilloscope with low frequency signals or when using an x-y plotter it is possible to detect the sense of rotation.

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 13 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

3. The output signal of a vortex flow-meter has frequency range between 5 and 50 Hz. The mean period of the signal is to be measured using an internal frequency of 10 kHz and a 16-bit binary. a) What are the maximum and minimum possible counts? b) What is the minimum possible frequency that this device can measure? Solution As the frequency of the input signal is relatively low, we will measure the period of the signal. The period of the 5 Hz signal is 0.2 seconds (or 200 ms) and the period of the 50 Hz signal is 0.02 seconds (or 20 ms). As we are using a 10 kHz signal, the total count during one period of the input signal will be: (a) For the 5 Hz signal: 10k x 0.2 = 2000 (maximum count) For the 50 Hz signal: 10k x 0.02= 200 (minimum count)

(b) The minimum possible frequency corresponds to the maximum possible period length. The maxim possible count of the counter is 216-1= 65535. At a pulse rate of 10 kHz, it will take a signal with the period length below to fill it before overflow: 65535/10000= 6.5535 seconds A period of 6.5535 s corresponds to a frequency of 0.1526 Hz. This is lowest frequency that this counter can measure.

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 14 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

4. The diagram below shows an elliptic figure, as would be seen on the screen of an oscilloscope. Answer the following questions:

Y axis

X axis

a. What mode do you need to set the oscilloscope to in order to see this screen? b. What is the relationship between the frequency of the two signals X and Y? c. What is the purpose of this test? d. If the value of A is 5 divisions and B 6 divisions, what can you say about X and Y signals. Solved Advanced Problem 5. Figure 11 below shows an RC circuit fed from a function generator. The outputs V1 and V2 are connected to an oscilloscope. The resultant screen of the oscilloscope can be seen in Figure 12. Answer the following questions a) to e).

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 15 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation V1 x-axis C V2 y-axis

FG

1 kHz Sinusoidal

R = 100

COM
Figure 11: RC circuit fed from a function generator.

y axis

x axis

B
Figure 12: Figure seen on the screen of the oscilloscope.

a) What mode do you need to set the oscilloscope to in order to see this screen? Answer XY mode. b) If the value of A is 3.5 divisions and the value of B is 4.95 divisions, what is the value of the capacitor C.

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 16 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Answer The ratio of A to B is the arcsin of the phase shaft angle between the two signals. So the angle is equal to arcsin 0.707=45. The voltage V2 is proportional to the current throught he RC network. The fact that the angle is 45 means that the phase angle of the combination of R and C has a phase angle of 45. This means that at this frequency, the impedance of the capacitor it equal to 100 . Thus: 1/(C)=100, or C=1.59 F c) If the value of the frequency from the function generator is changed to 500 Hz, draw what you would see on the screen? (Show your answer in Error! Reference source not found.). -What are the relative values of A and B in this case? -Explain your answer. Answer The impedance of the capacitor at this frequency will be (1/C)=1/(25001.59 F)=200 So the new phase angle between V1 and V2 will now become equal to arctan (200/100)= arctan (2)= 63.5 So the relative values of A and B in the Lissajous pattern will become = sin(63.5)=0.894 (A:B = 0.894:1).

Figure 13: Answer to part c).

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 17 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

d) If the frequency of the function generator is changed to 1 MHz, draw what you would see on the oscilloscope screen? (Show your answer in Error! Reference source not found.). -Explain your answer. Answer In this case the impedance of the capacitor becomes very small (0.1 ) which is negligible compared to the resistance. So in effect the two signals V1 and V2 become identical and the Lissajous pattern becomes a straight line inclined at 45 degrees.

Figure 14: Answer to part d).

e) Based on the circuit in Error! Reference source not found. below, draw what you would see now on the screen of the oscilloscope (show your answer in figure 6 below). -Explain your answer.

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 18 of 21

16 Measurement of Frequency and Phase Shift V1

0908341 Measurements & Instrumentation

+ -

V1-V2 x-axis Subtractor

C V2 R = 100 V2 y-axis

FG

1 kHz Sinusoidal

COM
Figure 15: Setup for question e).

Answer The two signals now represent the voltage across the capacitor and the current flowing through it, which are always at 90 by definition. Their magnitude is also equal at 1 kHz, so they will show as a circle on the Lissajous pattern.

Figure 16: Answer to part e).

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 19 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Example Datasheets on Counter/Timers (Courtesy of BK Precision)

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 20 of 21

16 Measurement of Frequency and Phase Shift

0908341 Measurements & Instrumentation

Copyright held by the author 2007: Dr. Lutfi R. Al-Sharif

Page 21 of 21