← About PHYS 351

PHYS 351 · Advanced Instrumentation

Lecture 02 · Mixers & the AD633 multiplier

1 Where Lab 2 Sits

Lab 1 converted between voltage, current and light, and every op-amp stage in it was linear. Lab 2 adds the first nonlinear operation: multiplication. The AD633 takes two voltages and returns their product, and that single operation does three very different jobs. It moves a signal to a new frequency (a mixer), it squares a voltage, and, placed inside a feedback loop, it takes a square root.

Mixer block diagram: the RF signal at f1 and the local oscillator at f2 enter a multiplier; its output passes an IF filter to give f_out. A general nonlinear circuit produces f = |m f1 ± n f2|; an ideal multiplier produces only f1 − f2 and f1 + f2.
Figure 1. A mixer. The RF signal at f1f_1 and a local oscillator (LO) at f2f_2 are multiplied, and a filter selects the output at foutf_{out}. A general nonlinear circuit produces every ∣mf1±nf2∣|mf_1 \pm nf_2|; an ideal multiplier produces only f1−f2f_1-f_2 and f1+f2f_1+f_2.
The one idea to carry out of this lecture

Multiplication moves information in frequency: the product of two tones is a pair of tones at their sum and difference. The same multiplier, with both inputs tied together, squares. And put a function in the feedback path of a high-gain amplifier, and the loop computes its inverse, provided the function only rises (or only falls) over the range you use. Lab 2 uses all three facts.

1.1 Task map

Lab 2 taskWhat you doConcept & section
1Wire the AD633 with 0.1 µF decoupling; square an input; measure many points; quadratic fit in PythonThe AD633; decoupling; squaring; fitting (§6, §7)
2Consider offset, scale-factor and nonlinearity errors; design and build an offset trim from the datasheetError signatures; the trim network (§8)
3Offsets under ±50 mV; squarer in a feedback loop for a square root; measure; square-root fitInverting a function with feedback (§9)

Sections 2–5 explain mixing, the best-known use of a multiplier and the "mixing" in the lab's title. The lab itself uses the AD633 at low frequency, as a squarer and then as a square-rooter.

2 What a Multiplier Does

2.1 One line of algebra

Multiply two cosines, θ1=ω1t+ϕ1\theta_1 = \omega_1 t + \phi_1 and θ2=ω2t+ϕ2\theta_2 = \omega_2 t + \phi_2. Write each with Euler's formula, cos⁡θ=12(eiθ+e−iθ)\cos\theta = \tfrac12\left(e^{i\theta}+e^{-i\theta}\right), multiply out the four exponentials, and pair them back into cosines:

cos⁡θ1cos⁡θ2=14(eiθ1+e−iθ1)(eiθ2+e−iθ2)\cos\theta_1\cos\theta_2 = \tfrac14\left(e^{i\theta_1}+e^{-i\theta_1}\right)\left(e^{i\theta_2}+e^{-i\theta_2}\right)(1)

The four products are e±i(θ1+θ2)e^{\pm i(\theta_1+\theta_2)} and e±i(θ1−θ2)e^{\pm i(\theta_1-\theta_2)}, and each ± pair is twice a cosine:

cos⁡θ1cos⁡θ2=12cos⁡(θ1−θ2)+12cos⁡(θ1+θ2)\cos\theta_1\cos\theta_2 = \tfrac12\cos(\theta_1-\theta_2)+\tfrac12\cos(\theta_1+\theta_2)(2)

with θ1∓θ2=(ω1∓ω2)t+(ϕ1∓ϕ2)\theta_1\mp\theta_2 = (\omega_1\mp\omega_2)t + (\phi_1\mp\phi_2). A difference tone at f1−f2f_1-f_2 and a sum tone at f1+f2f_1+f_2. The input frequencies themselves are gone. The phases subtract and add too, which matters in §2.3.

2.2 In time and in frequency

Top: two unit cosines at 6 kHz and 5 kHz over 2 ms. Bottom: their product oscillates rapidly inside an envelope, with the dashed difference term, one half cos 2π(1 kHz)t, tracing its slow 1 kHz component.
Figure 2. Top: unit cosines at 6 kHz and 5 kHz over 2 ms. Bottom: their product is a fast 11 kHz wiggle (the sum term) riding on the slow difference term, the dashed curve 12cos⁡(2π⋅1 kHz t)\tfrac12\cos(2\pi\cdot1\ \text{kHz}\,t).
Top: input spectrum with lines of amplitude 1 at f2 = 5 kHz and f1 = 6 kHz. Bottom: the product has lines of amplitude 0.5 at f1 − f2 = 1 kHz and f1 + f2 = 11 kHz, with the inputs gone; each tone has half the amplitude and a quarter of the power, 6 dB below a tone of amplitude AB.
Figure 3. Top: input lines of amplitude 1 at 5 and 6 kHz. Bottom: the product has lines of amplitude 0.5 at 1 kHz and 11 kHz, and nothing at the input frequencies.

A filter after the multiplier keeps whichever term is wanted: a low-pass keeps 1 kHz, a band-pass at 11 kHz keeps the sum. The two products are 2f22f_2 apart (10 kHz here, with f2f_2 the lower input frequency), far more than the 1 kHz between the inputs, so the filter is easy to build.

2.3 Amplitude, power and the 6 dB

For inputs Acos⁡θ1A\cos\theta_1 and Bcos⁡θ2B\cos\theta_2, each output tone has amplitude AB/2AB/2. Power in a resistor goes as V2/RV^2/R, so each tone carries (1/2)2=1/4(1/2)^2 = 1/4 of the power of a tone of amplitude ABAB: 6 dB down. With the LO amplitude normalized to one, the kept tone has half the RF amplitude. That is the 6 dB conversion loss of an ideal multiplying mixer, and it is why a mixer is normally followed by gain.

Where do the 6 dB go? Half of it, 3 dB, goes in the multiplication itself: the LO cosine spends much of each cycle near zero, and its mean square is only ½. The other 3 dB goes at the filter: what is left is shared equally between the sum and the difference tones, and you keep only one of them.

Scale factors and phase

A real multiplier has a scale factor KK in V⁻¹ (the AD633's is 1/10 V), so each tone is KAB/2KAB/2 volts. The phase term is useful as well: with equal frequencies, the difference term is a DC voltage 12KABcos⁡(ϕ1−ϕ2)\tfrac12 KAB\cos(\phi_1-\phi_2), so a multiplier followed by a low-pass filter measures phase. That is the phase detector at the heart of lock-in amplifiers and phase-locked loops.

Practice 2

(a) Find the output frequencies when 12.0 kHz and 10.7 kHz are multiplied. Which circuit element selects the one you want?

(b) Both inputs are 3 V amplitude into an AD633. What is the amplitude of each output tone?

(c) Set f1=f2f_1 = f_2 in Equation (2). What are the two output terms, and what does the first one represent? (This is the squaring case, §7.)

3 Any Nonlinear Circuit Mixes

A multiplier is the cleanest mixer, but any nonlinearity mixes. Expand a diode's exponential law in a Taylor series about its bias point,

i∝ev/VT=1+vVT+v22VT2+v36VT3+⋯i \propto e^{v/V_T} = 1 + \dfrac{v}{V_T} + \dfrac{v^2}{2V_T^2} + \dfrac{v^3}{6V_T^3} + \cdots(3)

and put in two tones, v=acos⁡ω1t+bcos⁡ω2tv = a\cos\omega_1t + b\cos\omega_2t. The v2v^2 term contains 2abcos⁡ω1tcos⁡ω2t2ab\cos\omega_1t\cos\omega_2t: exactly the product of §2, with its sum and difference tones, plus DC and 2f12f_1, 2f22f_2. The v3v^3 term adds 2f1±f22f_1\pm f_2, f1±2f2f_1\pm2f_2 and 3f3f terms, and so on. In general a nonlinear circuit produces every

f=∣mf1±nf2∣,m,n=0,1,2,…f = |mf_1 \pm nf_2|,\qquad m, n = 0, 1, 2, \ldots(4)
Simulated spectrum of a diode-law nonlinearity driven by 20 mV tones at f1 = 10 kHz and f2 = 3 kHz: besides the inputs, many products appear at 2f2, f1 − f2, f1 + f2, f1 + 2f2, 2f1, 2f1 + f2 and others; the two lines an ideal multiplier would make, 7 and 13 kHz, are highlighted.
Figure 4. Simulated spectrum of a diode law driven by 20 mV tones at 10 and 3 kHz. Besides the inputs, lines appear at 2f22f_2, f1−f2f_1-f_2, f1+f2f_1+f_2, f1+2f2f_1+2f_2, 2f12f_1, 2f1+f22f_1+f_2 and more. The two an ideal multiplier would make, 7 and 13 kHz, are highlighted.

A practical mixer therefore depends on its frequency plan and output filter to keep one product and reject the rest. The AD633's advantage is that it is built to multiply and nothing else, so its unwanted products are small (§6.4).

4 The Radio Receiver

4.1 The superheterodyne

Most radio receivers are superheterodynes. A superhet shifts the station you tune to down to one fixed intermediate frequency (IF), and does most of its filtering and amplification there.

Superheterodyne receiver: antenna, RF band-pass, RF amplifier, mixer driven by a tunable local oscillator, IF band-pass, IF amplifier, demodulator, audio amplifier, speaker. Example: all stations near 1000 kHz, times 1455 kHz from the oscillator, give 455 kHz at the IF, always.
Figure 5. The superheterodyne receiver: antenna, RF band-pass and amplifier, a mixer driven by a tunable local oscillator, IF band-pass and amplifier, demodulator, audio amplifier and speaker. A station at 1000 kHz mixed with a 1455 kHz oscillator lands at 455 kHz. Tune to another station and the oscillator moves with it, so that station lands at 455 kHz too.
  1. Antenna. Every station arrives at once, at the microvolt level.
  2. RF filter and amplifier. A broad band-pass around the wanted band, plus gain; it also rejects the image (§4.3).
  3. Local oscillator. A tunable sine wave. Tuning the radio is setting fLOf_{LO}.
  4. Mixer. Multiplies RF by the LO; the difference is kept.
  5. IF filter and amplifier. A sharp band-pass at the fixed IF does almost all of the selectivity and gain, because a sharp filter is easy to build well at one frequency. Broadcast AM uses 455 kHz; broadcast FM uses 10.7 MHz.
  6. Demodulator and audio amplifier. Recover the message and drive the speaker.

4.2 Choosing the local oscillator

The kept difference must equal the IF:

∣fRF−fLO∣=fIF|f_{RF} - f_{LO}| = f_{IF}(5)

For a wanted station there are two solutions: fLO=fRF+fIFf_{LO} = f_{RF} + f_{IF} (high-side injection) or fLO=fRF−fIFf_{LO} = f_{RF} - f_{IF} (low-side). Broadcast AM receivers use high-side injection because the oscillator then tunes over a much smaller frequency ratio. For the 540–1700 kHz band, a high-side LO runs from 995 to 2155 kHz, a ratio of about 2.2. A low-side LO would have to run from 85 to 1245 kHz, a ratio of almost 15, which is much harder to build.

4.3 The image frequency

The mixer sees only ∣f−fLO∣|f - f_{LO}|, so it cannot tell a signal above the oscillator from one the same distance below it. A second input, the image, also lands on the IF, on the opposite side of the LO from the wanted station and 2fIF2f_{IF} away from it.

Frequency axis from 0 to 2400 kHz: the wanted station at 1000 kHz inside the RF preselector's passband, the LO at 1455 kHz 455 kHz above it, and the image at 1910 kHz a further 455 kHz above; station and image are 2 f_IF = 910 kHz apart, and the preselector is far down at the image.
Figure 6. A station at 1000 kHz, the LO at 1455 kHz and the image at 1910 kHz, each 455 kHz from the LO; station and image are 2fIF2f_{IF} = 910 kHz apart. The RF preselector passes the station and is far down at the image.
Worked example: f_IF = 455 kHz, station at 1000 kHz
  • High-side: fLOf_{LO} = 1000 + 455 = 1455 kHz. The image is at fLO+fIFf_{LO}+f_{IF} = 1910 kHz, since |1910 − 1455| = 455.
  • Low-side: fLOf_{LO} = 1000 − 455 = 545 kHz. The image is at fLO−fIFf_{LO}-f_{IF} = 90 kHz, since |90 − 545| = 455.

Either way the image is 2fIF2f_{IF} = 910 kHz from the station. A higher IF moves the image further away and makes the preselector's job easier, one reason FM uses 10.7 MHz.

4.4 AM and FM ride along

A slow sine message; an AM signal whose envelope follows the message; an FM signal of constant amplitude whose cycles bunch and spread with the message.
Figure 7. A slow message; an AM carrier whose envelope follows it; an FM carrier of constant amplitude whose cycle spacing follows it.

Mixing does not care whether the signal is AM or FM. Shifting a carrier in frequency keeps its envelope (the AM) and its frequency swings (the FM), so the RF, LO, mixer and IF stages are the same for both. They part ways only at the demodulator: an envelope detector for AM, a frequency discriminator or phase-locked loop for FM. Because an FM signal's amplitude carries no information, the receiver can clip it flat with a limiter, which strips off most amplitude noise. That is a large part of why FM sounds cleaner than AM.

Practice 4

(a) A receiver with fIFf_{IF} = 455 kHz is tuned to 1200 kHz with high-side injection. Find fLOf_{LO} and the image frequency.

(b) Repeat for an FM receiver with fIFf_{IF} = 10.7 MHz tuned to 99.3 MHz. Is the image inside the 88–108 MHz band, and why does that matter?

(c) A designer proposes a 100 kHz IF for sharper filtering. What does it cost, quantitatively, in image separation?

5 The NE602: a Mixer on a Chip

The NE602, now sold as the NXP SA602A, packages an oscillator and a double-balanced mixer in one 8-pin IC. It is the front end of countless shortwave, amateur and communications receivers.

NXP SA602A datasheet Fig. 1, block diagram: a voltage regulator on pin 8 VCC; an oscillator on pins 7 (emitter) and 6 (base) whose buffered output drives a multiplier; an input amplifier from pins 1 and 2 (IN_A, IN_B) feeding the multiplier; mixer outputs on pins 4 and 5; ground on pin 3.
Figure 8. SA602A block diagram: a voltage regulator on VCCV_{CC} (pin 8); an oscillator on pins 6 and 7 whose buffered output drives the multiplier; an input amplifier from pins 1 and 2; mixer outputs on pins 4 and 5; ground on pin 3. Source: NXP SA602A datasheet, Rev. 3, Fig. 1.
NXP SA602A datasheet Table 3, pin description: IN_A pin 1 RF input A; IN_B pin 2 RF input B; GND pin 3 ground; OUT_A pin 4 mixer output A; OUT_B pin 5 mixer output B; OSC_B pin 6 oscillator input (base); OSC_E pin 7 oscillator output (emitter); VCC pin 8 supply voltage.
Figure 9. SA602A pin description: IN_A and IN_B (1, 2) RF inputs; GND (3); OUT_A and OUT_B (4, 5) mixer outputs; OSC_B (6) oscillator input, base; OSC_E (7) oscillator output, emitter; VCCV_{CC} (8). Source: SA602A datasheet, Table 3.

5.1 Inside: a Gilbert cell

NXP SA602A datasheet Fig. 3, equivalent circuit: a Gilbert cell. A lower differential transistor pair driven from pins 1 and 2 with 1.5 kΩ emitter resistors feeds two cross-coupled upper pairs switched by the buffered oscillator from pins 6 and 7; 1.5 kΩ collector loads connect to outputs 4 and 5; bias blocks set the operating currents.
Figure 10. SA602A equivalent circuit. A lower differential pair, driven by the RF inputs on pins 1 and 2, feeds two cross-coupled upper pairs switched by the buffered oscillator; 1.5 kΩ loads connect to outputs 4 and 5. Source: SA602A datasheet, Fig. 3.

The lower pair turns the RF voltage into a pair of currents whose difference is proportional to the RF signal. The oscillator switches the upper pairs so that this difference current is routed to one output or the other on alternate half cycles: the output current is the RF signal times ±1 at the LO rate. A square wave at fLOf_{LO} contains fLOf_{LO}, 3fLO3f_{LO}, 5fLO5f_{LO}…, so the output contains fRF±fLOf_{RF}\pm f_{LO} plus weaker products at the odd harmonics. Because the cell is balanced, the RF and LO themselves largely cancel at the output: "double-balanced".

NXP SA602A datasheet Table 7, dynamic characteristics at 25 °C and 6 V: input frequency 500 MHz, oscillator frequency 200 MHz, noise figure 5.0 dB at 45 MHz, input third-order intercept −13 dBm, conversion gain 14 dB minimum and 17 dB typical at 45 MHz, RF input resistance 1.5 kΩ and capacitance 3 pF, mixer output resistance 1.5 kΩ.
Figure 11. SA602A dynamic characteristics at 6 V: inputs to 500 MHz, oscillator to 200 MHz, 5.0 dB noise figure and 17 dB conversion gain at 45 MHz, 1.5 kΩ input and output resistance. Source: SA602A datasheet, Table 7.

Its blocks are worth knowing, because they reappear in every receiver front end:

  1. Local oscillator. An internal oscillator transistor on pins 6 and 7, with an external crystal or tuned circuit, or an external LO signal.
  2. Differential signal ports. The RF inputs and mixer outputs are differential, so coupling, biasing and the termination of unused inputs all matter; the inputs are biased internally, so couple signals in through a capacitor or transformer and never apply a DC bias from outside.
  3. Nonlinear mixer core. The Gilbert cell. It has 17 dB of conversion gain, where the ideal multiplier of §2.3 loses 6 dB.
  4. Output network. External tuned circuits select the wanted IF.
  5. Supply decoupling. A bypass capacitor at pin 8 keeps supply noise and oscillator currents out of the signal path.

6 The AD633 Analog Multiplier

6.1 Inside and transfer equation

AD633 datasheet Rev. K Fig. 1, functional block diagram: inputs X1 and X2 feed one unity-gain differential amplifier and Y1 and Y2 another; their outputs are multiplied and scaled by 1/10 V, summed with the Z input, and buffered by amplifier A to output W.
Figure 12. AD633 functional block diagram: X1–X2 and Y1–Y2 each feed a unity-gain differential amplifier; their outputs are multiplied and divided by 10 V, then summed with the Z input and buffered to the output W. Source: Analog Devices AD633 datasheet, Rev. K, Fig. 1.
W=(X1−X2)(Y1−Y2)10 V+ZW = \dfrac{(X_1-X_2)(Y_1-Y_2)}{10\ \text{V}} + Z(6)

The AD633 is a four-quadrant multiplier: both inputs may take either polarity and the output sign comes out right in all four combinations. Inside, the X and Y voltages are converted to currents and multiplied in a translinear core; a buried Zener reference sets the 10 V scale; the output amplifier adds ZZ after the product. Two features of Equation (6) matter for every Lab 2 measurement. The inputs are differential, so the unused input of each pair must be tied to a defined potential, normally ground, and never left floating. And the 10 V divisor keeps the output within its ±11 V range for inputs up to ±10 V.

6.2 Pinout and wiring

AD633 datasheet Rev. K Fig. 2 and Table 4, 8-lead PDIP AD633JN/AN: pin 1 X1, 2 X2, 3 Y1, 4 Y2, 5 minus VS, 6 Z summing input, 7 W product output, 8 plus VS, with W = (X1 − X2)(Y1 − Y2)/10 V + Z.
Figure 13. AD633JN/AN 8-lead PDIP: pin 1 X1, 2 X2, 3 Y1, 4 Y2, 5 −VS, 6 Z, 7 W, 8 +VS. Source: AD633 datasheet, Rev. K, Fig. 2 and Table 4.

The SOIC package (AD633JR/AR) uses a different arrangement: pin 1 is Y1 there. Check the part number against the datasheet before wiring; putting a supply on a signal pin can destroy the chip.

AD633 datasheet Rev. K Fig. 12, basic multiplier connections: X input across pins 1 and 2, Y input across pins 3 and 4, pin 8 to +15 V and pin 5 to −15 V each with a 0.1 µF capacitor to ground, pin 6 as the optional summing input Z, and output W = (X1 − X2)(Y1 − Y2)/10 V + Z on pin 7.
Figure 14. Basic multiplier connections: X across pins 1 and 2, Y across pins 3 and 4, ±15 V on pins 8 and 5 each with 0.1 µF to ground, optional summing input Z on pin 6, output W on pin 7. Source: AD633 datasheet, Rev. K, Fig. 12.

6.3 Decoupling

Illustration of impedance to ground against frequency for a 0.1 µF capacitor: at the pin with about 3 nH it stays low to about 10 MHz, dipping at its resonance; 15 cm away with about 150 nH it resonates near 1.3 MHz and rises along the wire's own reactance above that; a line marks the AD633's 1 MHz bandwidth.
Figure 15. An illustration of the impedance to ground of a 0.1 µF capacitor. At the pin, with about 3 nH of lead, it stays low to about 10 MHz. Fifteen centimetres away, with about 150 nH, it resonates near 1.3 MHz and above that is no better than the wire.

A capacitor is a short to ground only below its self-resonance, 1/(2πLC)1/(2\pi\sqrt{LC}), where LL includes every millimetre of lead and breadboard strip (roughly 1 nH per mm). A long connection moves the resonance down into the AD633's 1 MHz bandwidth, exactly where the chip still has gain.

Supply decoupling is a graded requirement

Task 1 asks for about 0.1 µF on each supply rail. Place each capacitor at its supply pin, not across the breadboard. Without it the multiplier can oscillate, which shows up as a fuzzy output trace and ruins the accuracy measurements that follow.

6.4 What the datasheet promises

AD633 datasheet Rev. K Table 1, multiplier performance at 25 °C and ±15 V: total error ±1 % typical, ±2 % maximum of full scale for inputs within ±10 V; scale voltage error ±0.25 %; supply rejection ±0.01 %; nonlinearity X ±0.4 % typical, ±1 % maximum, Y ±0.1 % typical, ±0.4 % maximum; X and Y feedthrough; output offset voltage ±5 mV typical, ±50 mV maximum.
Figure 16. AD633 multiplier performance at ±15 V: total error ±1 % typ and ±2 % max of full scale; scale-voltage error ±0.25 %; nonlinearity ±0.4 % (X) and ±0.1 % (Y) typ; feedthrough; output offset ±5 mV typ and ±50 mV max. Source: AD633 datasheet, Rev. K, Table 1.

"Full scale" is 10 V, so ±2 % is ±200 mV at worst. The same table gives the input offset, ±5 mV typ and ±30 mV max, a 1 MHz small-signal bandwidth and a 20 V/µs slew rate.

6.5 Bandwidth: mix at audio frequencies

AD633 datasheet Rev. K Fig. 4, frequency response: output flat at 0 dB from 10 kHz to about 300 kHz, then falling, about −3 dB near 1 MHz and −20 dB near 3 MHz, with curves for 0.01 µF and 1000 pF loads.
Figure 17. AD633 frequency response: flat to about 300 kHz, −3 dB near 1 MHz, −20 dB near 3 MHz. Source: AD633 datasheet, Rev. K, Fig. 4.
Worked example: mixing on the AD633

XX = 1 V at 6 kHz, YY = 1 V at 5 kHz, ZZ = 0. Equations (2) and (6) give

W=0.05cos⁡(2π⋅1 kHz t)+0.05cos⁡(2π⋅11 kHz t) VW = 0.05\cos(2\pi\cdot1\ \text{kHz}\,t) + 0.05\cos(2\pi\cdot11\ \text{kHz}\,t)\ \text{V}

Each line is only 50 mV, because of the 10 V divisor, and both lie far inside the bandwidth. Radio-frequency examples such as 10.7 MHz and 10.0 MHz are fine for an ideal mixer but past the AD633's corner; that is a job for the NE602.

7 Squaring

7.1 Tie X to Y

AD633 datasheet Rev. K Fig. 13, connections for squaring: input E drives both X1 and Y1, X2, Y2 and Z are grounded, supplies ±15 V with 0.1 µF bypass capacitors, and the output is W = E²/10 V.
Figure 18. Connections for squaring: input E drives X1 and Y1; X2, Y2 and Z are grounded; the output is W=E2/10W=E^2/10 V. Source: AD633 datasheet, Rev. K, Fig. 13.

With X1=Y1=VinX_1 = Y_1 = V_{in} and X2=Y2=Z=0X_2 = Y_2 = Z = 0, Equation (6) becomes

W=Vin210 V,∣Vin∣=10 V⋅WW = \dfrac{V_{in}^2}{10\ \text{V}},\qquad |V_{in}| = \sqrt{10\ \text{V}\cdot W}(7)

The output is positive whichever sign the input has, so the squarer throws the sign away. That makes a quick first test of your wiring: +4 V and −4 V in should both give about +1.6 V out.

7.2 Predict before you measure

Left: squarer output W = V_in²/10 V against V_in from −10 to 10 V, a parabola through 2.50 V at ±5 V and 10.00 V at ±10 V. Right: an output offset as a percentage of the ideal output against V_in on log axes: 20 mV is 20 % at 1 V and 0.2 % at 10 V; the 50 mV datasheet maximum is 2.5 times worse.
Figure 19. Left: W=Vin2/10W = V_{in}^2/10 V, a parabola through 2.50 V at ±5 V and 10.0 V at ±10 V. Right: an output offset as a percentage of the ideal output: 20 mV is 20 % at 1 V and 0.2 % at 10 V; the 50 mV datasheet maximum is 2.5 times worse.
VinV_{in}±1 V±2 V±5 V±10 V
WW0.10 V0.40 V2.50 V10.0 V

Note how small the output is near zero: 100 mV at 1 V in. A 20 mV offset is then a 20 % error. This is why the offset work in Task 2 matters, and why Task 3 insists on offsets under ±50 mV before the square root. Take points on both sides of zero and more of them near zero, where the curve is flat and the errors are proportionally largest.

7.3 A sine in, twice the frequency out

With Vin=Esin⁡ωtV_{in} = E\sin\omega t, Equation (2) with equal frequencies gives

W=(Esin⁡ωt)210 V=E220 V(1−cos⁡2ωt)W = \dfrac{(E\sin\omega t)^2}{10\ \text{V}} = \dfrac{E^2}{20\ \text{V}}\left(1-\cos2\omega t\right)(8)
A 5 V, 1 kHz sine input and the squarer output W = E²/20 (1 − cos 2ωt) over 2 ms: the output stays between 0 and 2.5 V around a dashed dc level of 1.25 V and peaks twice per input cycle, at 2 kHz.
Figure 20. A 5 V, 1 kHz sine and the squarer output over 2 ms: the output stays between 0 and 2.5 V about a DC level of 1.25 V and peaks twice per input cycle, at 2 kHz.

On the scope, a doubled frequency and a trace that never goes negative confirm the squarer works. The datasheet shows the same idea as a SPICE simulation (drawn in Multisim):

AD633 datasheet Rev. K Figs. 26 and 27: a Multisim schematic of the AD633 frequency doubler with a 1 V, 10 kHz source, and its transient response showing an output sine at twice the input frequency.
Figure 21. The datasheet's Multisim frequency doubler, which uses an RC network to remove the DC term, and its transient output at twice the input frequency. Source: AD633 datasheet, Rev. K, Figs. 26 and 27.

7.4 Fitting the data

Task 1 asks for a quadratic fit with your Python code and plot. Fit the general form rather than forcing it through the origin:

W=aVin2+bVin+cW = aV_{in}^2 + bV_{in} + c(9)
Simulated squarer data from −10 to 10 V with the ideal V²/10 curve and a quadratic fit, a = 0.0985 per volt, b = 0.0047 and c = −17 mV. Below, the residuals, measured minus fit, scatter within about ±15 mV: scatter means noise, a pattern would mean nonlinearity.
Figure 22. Simulated squarer data from −10 to 10 V with the ideal V2/10V^2/10 and a quadratic fit, aa = 0.0985 V⁻¹, bb = 0.0047, cc = −17 mV. Below, the residuals scatter within about ±15 mV: scatter means noise, a pattern would mean nonlinearity.
CallWhat it gives you
numpy.polyfit(v, w, 2)The coefficients aa, bb, cc of a least-squares quadratic, highest power first
numpy.polyval(p, v)The fitted curve at the points v, for plotting and for residuals
scipy.optimize.curve_fit(f, v, w)A fit of any model function f, with a covariance matrix for uncertainties

Each coefficient means something physical, and explaining what each one tells you about the chip is the heart of the task (§8.2).

8 Error Sources and Offset Trimming

8.1 Four errors, four signatures

Four exaggerated squarer errors against the dashed ideal parabola: an input offset moves the minimum sideways, giving a linear fit term; an output offset lifts the whole curve, a constant; a scale-factor error makes the curve steeper; nonlinearity leaves a wiggle that shows in the residuals.
Figure 23. Four squarer errors, exaggerated, against the dashed ideal: an input offset moves the minimum sideways (a linear fit term); an output offset lifts the curve (a constant); a scale-factor error makes it steeper or flatter (a≠0.1a\ne0.1 V⁻¹); nonlinearity leaves a wiggle that shows only in the residuals.
ErrorWhat it isSignature in a squaring measurementFix
Input offsetA small unwanted voltage added at X or YLinear term bb; the minimum sits away from VinV_{in} = 0Trim network on X2X_2 or Y2Y_2
Output offsetA fixed voltage added to WWConstant cc; the output is not zero for zero inputTrim network on ZZ
Scale-factor errorThe divisor is not exactly 10 Vaa differs from 0.100 V⁻¹; error grows with the outputCannot be trimmed with the offset network; measure and report it
NonlinearityWhat remains after the above are removedA pattern in the fit residuals, not scatterNone; it is the device's floor (0.1–0.4 % of full scale)

8.2 What the fit coefficients mean

Model the squarer with a single input offset ε\varepsilon and an output offset c0c_0. (Strictly, X and Y each have their own offset, εx\varepsilon_x and εy\varepsilon_y; tying the inputs together does not make those equal. The fit measures their average, ε=(εx+εy)/2\varepsilon = (\varepsilon_x+\varepsilon_y)/2, and the difference changes the constant term by a negligible a(εx−εy)2/4a(\varepsilon_x-\varepsilon_y)^2/4.)

W=a(V+ε)2+c0=aV2+2aεV+(aε2+c0)W = a(V+\varepsilon)^2 + c_0 = aV^2 + 2a\varepsilon V + \left(a\varepsilon^2 + c_0\right)(10)

Matching Equation (9) term by term gives

ε=b2a,c0=c−aε2,scale error=a−0.1 V−10.1 V−1\varepsilon = \dfrac{b}{2a},\qquad c_0 = c - a\varepsilon^2,\qquad \text{scale error} = \dfrac{a - 0.1\ \text{V}^{-1}}{0.1\ \text{V}^{-1}}(11)
Zoom near zero of the simulated squarer fit: the fitted parabola sits below and slightly left of the dashed ideal V squared over 10, with data points at −2, −1, 0, 1 and 2 V. Its vertex is marked at minus epsilon and c0, about −24 mV and −17 mV.
Figure 24. The simulated fit of Figure 22 near zero. The fitted parabola's vertex sits at (−ε, c0c_0) = (−24 mV, −17 mV), just left of and below the ideal curve's vertex at the origin.
Worked example: reading the simulated fit

aa = 0.0985 V⁻¹, bb = 0.0047, cc = −17.0 mV.

  • Scale error: (0.0985−0.1)/0.1=−1.5(0.0985-0.1)/0.1 = -1.5 %.
  • Input offset: ε=0.0047/(2×0.0985)=24\varepsilon = 0.0047/(2\times0.0985) = 24 mV. That is inside the datasheet's ±30 mV maximum and the ±50 mV Task 3 allows, but it is still worth trimming. At 1 V in, the linear term bVinbV_{in} adds 4.7 mV to an output of only 98.5 mV, an error of about 5 %.
  • Output offset: c0=−17.0−0.0985×(0.024)2×1000=−17.1c_0 = -17.0 - 0.0985\times(0.024)^2\times1000 = -17.1 mV.

Report all three with units and say what each one tells you about the device. If a fit ever gives an offset beyond the datasheet maximum, suspect the setup before the chip: a supply or signal generator that is not really at 0 V, or an input left floating.

8.3 Plot the residuals

On a plot of the raw data a good fit and a mediocre one look identical, because the quadratic dominates. Plot the residuals, measured minus fitted. A free quadratic fit absorbs offsets into bb and cc, so its residuals test only what a quadratic cannot describe: noise and nonlinearity. Compare with the ideal V2/10V^2/10 separately when you want to show the scale and offset errors.

8.4 The datasheet trim network

AD633 datasheet Rev. K Fig. 11, optional offset trim: a 50 kΩ potentiometer between plus VS and minus VS; its wiper feeds a 300 kΩ resistor to a node with 1 kΩ to ground, giving ±50 mV to the input terminal being trimmed, for example X2, Y2 or Z.
Figure 25. Optional offset trim: a 50 kΩ pot between +VS and −VS; its wiper drives 300 kΩ into a node with 1 kΩ to ground, which supplies ±50 mV to the terminal being trimmed, such as X2, Y2 or Z. Source: AD633 datasheet, Rev. K, Fig. 11.

The pot swings its wiper anywhere from −15 to +15 V. The 300 kΩ and 1 kΩ divide that by 301, so the trim node covers

±15 V×1 kΩ301 kΩ=±49.8 mV\pm15\ \text{V}\times\dfrac{1\ \text{k}\Omega}{301\ \text{k}\Omega} = \pm49.8\ \text{mV}(12)

At the two ends of the pot's travel that range is exact. In between, the pot's own source resistance (at most 12.5 kΩ, at mid travel) adds to the 300 kΩ and bends the knob-to-voltage relation by a few percent, which does not matter for a trim. The 1 kΩ keeps the trimmed input close to ground, so the network adds only a small, adjustable voltage where the grounded return would otherwise be. The datasheet: "the input and output offsets can be eliminated by using the optional trim"; scale-factor error and nonlinearity remain.

8.5 Trim in order

Illustration of a typical trim order, output W in millivolts over 2 ms before and after: 1, with X = 0 and a 10 V sine on Y, trim X2 until W stops following Y; 2, with Y = 0 and a sine on X, trim Y2; 3, with X = Y = 0, trim Z until W = 0.
Figure 26. An illustration of a typical trim order. (1) With X = 0 and a 10 V sine on Y, trim X2 until W stops following Y. (2) With Y = 0 and a sine on X, trim Y2. (3) With X = Y = 0, trim Z until W = 0.

The order follows from Equation (6) with offsets included: W=(X+εx)(Y+εy)/10+c0W = (X+\varepsilon_x)(Y+\varepsilon_y)/10 + c_0. With XX = 0 the output contains εxY/10\varepsilon_x Y/10, which follows YY; nulling that removes εx\varepsilon_x alone. Swapping the roles removes εy\varepsilon_y. Only then does the zero-input output equal c0c_0, which the ZZ trim cancels. If you trim ZZ first, the output reads zero at zero input while the input offsets are still there, and the error comes back as soon as you apply a signal.

AD633 datasheet Rev. K Fig. 10: typical output offset voltage against time for five minutes after power-up, a flat trace at 0 mV within a fraction of a millivolt on a ±3 mV scale.
Figure 27. Typical output offset for five minutes after power-up: steady within a fraction of a millivolt. Source: AD633 datasheet, Rev. K, Fig. 10.
How to present Task 2

Draw the trim circuit with values and say which pin each network drives. Report the offsets numerically before and after trimming, and confirm they are within ±50 mV before starting Task 3. Then show the residual plot and quote the scale-factor error, which trimming cannot remove.

Practice 8

(a) A quadratic fit returns aa = 0.1030 V⁻¹, bb = −0.0082, cc = 24 mV. Find the scale-factor error, ε\varepsilon and c0c_0.

(b) With those coefficients, what output would you measure at VinV_{in} = 0, and what is the percentage error at VinV_{in} = 2 V?

(c) Redesign the trim network for a ±20 mV range from the same ±15 V pot. Which resistor changes?

9 The Square Root by Feedback

9.1 Feedback inverts a function

Feedback inverts a function

Place a block that computes f(⋅)f(\cdot) in the feedback path of a high-gain amplifier, and the closed loop computes f−1(⋅)f^{-1}(\cdot). The loop drives its output to whatever value makes the fed-back quantity match the input. This works over any range where ff only rises (or only falls); elsewhere the inverse is not unique, and the loop needs help, like the diode in §9.2. If the feedback block squares, the loop must be delivering a square root. The same idea makes a logarithmic amplifier from a diode's exponential law.

Square root by feedback: a negative input E feeds the op-amp's inverting summing node through R; the op-amp output passes a diode to V_out, which drives an AD633 squarer giving W = V_out²/10; W returns through a second R to the summing node. The loop forces W = −E, so V_out = √(−10E).
Figure 28. The square-root loop. A negative input EE feeds the op-amp's summing node through RR; the op-amp output passes a diode to VoutV_{out}, which drives an AD633 squarer, W=Vout2/10W = V_{out}^2/10; WW returns to the summing node through a second RR. The loop forces W=−EW=-E, so Vout=−10EV_{out} = \sqrt{-10E}.

The summing node is a virtual ground, so the two currents into it must cancel: E/R+W/R=0E/R + W/R = 0, or W=−EW = -E. The squarer sets W=Vout2/10W = V_{out}^2/10, so

Vout=−10 V⋅E,E<0V_{out} = \sqrt{-10\ \text{V}\cdot E},\qquad E < 0(13)

9.2 The datasheet circuit

AD633 datasheet Rev. K Fig. 15, connections for square rooting: a negative input E drives the inverting input of an AD711 op-amp through 10 kΩ; the op-amp output passes through a 1N4148 diode to both X1 and Y1 of the AD633; the AD633 output W returns through 10 kΩ to the op-amp input; the output is W = square root of −(10 V)E.
Figure 29. Connections for square rooting: a negative input E drives an AD711 through 10 kΩ; its output passes a 1N4148 to X1 and Y1 of the AD633; W (pin 7) returns through 10 kΩ. The circuit's output is taken after the diode, at X1 and Y1, and equals −(10 V)E\sqrt{-(10\ \text{V})E}; W itself sits at −E-E. Source: AD633 datasheet, Rev. K, Fig. 15.

The datasheet uses an AD711 op-amp; a general-purpose op-amp such as the LM741 should serve at the slow, near-DC inputs of Task 3. The 1N4148 matters: "the diode is required to prevent latchup, which can occur … if the input were to change polarity, even momentarily." If EE goes positive, no real VoutV_{out} satisfies Equation (13). Without the diode, the op-amp then drives its output toward the negative rail. But the square of a large negative voltage is large and positive, so the fed-back current pushes the op-amp further the same way, and the loop can stay stuck there even after EE goes negative again. That is latchup. The diode blocks negative outputs, so the loop can only run with Vout≥0V_{out} \ge 0.

9.3 Where the square root struggles

Left: V_out = √(−10E) against E from −10 to 0 V, through 10.00 V at −10 V, 3.16 V at −1 V and 1.00 V at −0.1 V; for E above 0 there is no real root and the loop latches. Right: output error against |E| for 50 mV and 10 mV input offsets, rising as E approaches zero; a 50 mV offset gives 22 % error at |E| = 0.1 V.
Figure 30. Left: Vout=−10EV_{out}=\sqrt{-10E} from EE = −10 to 0 V, through 10.00 V, 3.16 V and 1.00 V at −10, −1 and −0.1 V; for E>0E>0 there is no real root. Right: the output error from an input offset of 50 or 10 mV, which grows as E→0E\to0: 50 mV gives 22 % at ∣E∣|E| = 0.1 V.

Two effects spoil the low end. First, the loop gain: a small change δVout\delta V_{out} changes WW by (Vout/5 V) δVout(V_{out}/5\ \text{V})\,\delta V_{out}, so the feedback fraction, and with it the loop's ability to correct errors, is proportional to VoutV_{out} and vanishes at zero. Second, offsets: an offset of size ε\varepsilon at the input shifts ∣E∣|E| by ε\varepsilon, up or down depending on its sign. In the bad direction, 10(∣E∣+ε)/10∣E∣=1+ε/∣E∣\sqrt{10(|E|+\varepsilon)}/\sqrt{10|E|} = \sqrt{1+\varepsilon/|E|}, which is 1.5\sqrt{1.5}, 22 % high, for ε\varepsilon = 50 mV and ∣E∣|E| = 0.1 V. Expect the square-root fit to be worst at the low end, and say so.

For the Task 3 fit, fit Vout=k−E+dV_{out} = k\sqrt{-E} + d (or k−(E−E0)k\sqrt{-(E-E_0)}) rather than forcing k=10k = \sqrt{10}, and compare the fitted kk with the ideal 10 V=3.16 V1/2\sqrt{10\ \text{V}} = 3.16\ \text{V}^{1/2}.

Practice 9

(a) Predict VoutV_{out} for EE = −0.4, −2.5 and −6.4 V.

(b) Your offsets are trimmed to ±10 mV. Below what ∣E∣|E| does the offset alone cause more than 5 % error?

(c) Explain why swapping the X inputs (so that W=−Vout2/10W = -V_{out}^2/10) lets the circuit accept positive EE instead. What else must change, and what is the sign of VoutV_{out}?

10 Common Mistakes and Bench Safety

  1. Floating inputs. An unconnected X2, Y2 or Z has no path for its bias current and picks up noise, so the output wanders. Ground every unused input.
  2. Decoupling across the board. A capacitor 15 cm from the pin does little (§6.3). Put it at the pin.
  3. Wrong package map. The SOIC and PDIP pinouts differ. Check the marking.
  4. Trimming in the wrong order. Trimming Z first hides the input offsets (§8.5).
  5. Positive input to the square-root loop. It latches without the diode, and has no answer with it. Keep EE negative, and start from a few volts, not from zero.
  6. Reading near zero only. Offsets dominate there. Take points across the whole ±10 V range, with extra points near zero.

11 Self-Check

  1. What frequencies result when 5.0 kHz and 4.3 kHz are multiplied, and which circuit element selects one of them?
  2. Why does a single diode produce many more frequencies than a multiplier does?
  3. A receiver has fIFf_{IF} = 455 kHz and fLOf_{LO} = 1355 kHz with high-side injection. Which station is received, and where is the image?
  4. What does the Gilbert cell in the NE602 do with its oscillator input?
  5. For the AD633 with ZZ = 0 and both inputs tied to 3.0 V, what is WW? What if both are tied to −3.0 V?
  6. Why must each 0.1 µF decoupling capacitor sit at its supply pin?
  7. In a quadratic fit to squaring data, what does a non-zero linear coefficient tell you, and how do you correct it in hardware?
  8. How does the datasheet trim network produce ±50 mV from a ±15 V pot?
  9. Why does a squarer in a feedback loop produce a square root, and what is the diode for?
  10. Why is the square root least accurate near zero input?

12 Practical Engineering Connections

  1. Frequency mixers. Radio receivers and transmitters, software-defined radios, radar and spectrum analyzers all mix signals to move information to a frequency that is easier to filter and amplify.
  2. Integrated mixers. NE602/SA602-style ICs combine an oscillator and a Gilbert-cell mixer in low-power receiver front ends for shortwave, amateur and communications equipment.
  3. Analog multipliers. The AD633 supports amplitude modulation, synchronous and phase-sensitive detection (the lock-in amplifier), voltage-controlled gain and filters, and true-RMS and power measurement: power is the product of voltage and current.
  4. Function inversion by feedback. The square-root loop is the same principle behind log and antilog amplifiers, dividers, automatic gain control and the linearization of nonlinear sensors.
  5. Calibration. Offset, scale and nonlinearity, measured by a fit and removed by a trim, are the error model of almost every sensor and converter in this course, including the ADC of Lab 8.

← All course materials