In the last post, I tried to compensate a typical three stage audio power amplifier by raising its gain from the original 20dB to 70dB. It worked, but an audio power amplifier with a gain of 3,000 clearly is not a practical solution.

A better way to compensate is to add a small "Miller" capacitor between the output and the input of the second stage of the amplifier:

With the compensation capacitor, the open loop gain (**red line**) uniformly falls at 20dB/decade and meets the desired closed loop gain of 20dB (**blue line**) at 800kHz, the new intercept frequency. The phase lag at that frequency is now 100 degrees, which gives us $180 - 100 = 80$ degrees of phase margin - the amplifier is stable.

The compensation capacitor plays several important roles in this elegant and efficient compensation scheme:

- It reduces the output impedance of the second stage of the amplifier, thus moving to a higher frequency the pole (that is, gain roll-off and phase shift) that that impedance creates together with the input capacitance of the last (output) stage;
- It reduces the input impedance of the second stage, so that the voltage at the collectors of the input stage transistors does not change as much with the signal, reducing the effect of parasitic capacitances and making the input stage more linear;
- It makes the loop gain fall below unity before the other poles introduce too much phase shift.

All three effects are achieved by enclosing the second stage of the amplifier in a local feedback loop formed by the compensation capacitor:

It looks like, and it is, an I/V converter - a transimpedance stage which inputs current and outputs voltage. (Never ever call it a Voltage Amplification Stage, or VAS.)

The input current is provided by the first stage (a differential pair), and for small signals the current is proportional to the differential input voltage: $$i=v_{diff} \times g_m$$ where $v_{diff}$ is the difference between the input signal and the portion of the output signal supplied by the feedback network, and $g_m$ is the transconductance of the differential pair, which is determined by the tail current $I_{tail}$ and the emitter degeneration resistors $R_e$ of the differential pair:

$$g_m \approx {1 \over {r_e + R_e}} = {1 \over {{V_T \over I_c} + R_e}} \approx {1 \over {{2 V_T \over I_{tail}} + R_e}}, V_T \approx 26mV$$

In the schematic above $I_{tail} = 1mA, R_e = R_5 = R_6 = 470 ohm$, so $g_m=1.9{mA \over V}$. (Note that without the current mirror, the transconductance $g_m$ would be half of that.)

If we ignore the input current of the second stage, then the output current of the differential pair $i=v_{diff} \times g_m$ flows through the compensation capacitor, and the resulting voltage drop becomes the output voltage of the second stage. It depends on the capacitor's impedance $Z_c={1 \over {2 \pi f C}}$: $$v_{out}={i \times Z_c}={i \over {2 \pi f C}}={v_{diff} \times g_m \over {2 \pi f C}}$$ Since the output stage of our amplifier is an emitter follower with approximately unity gain, the output voltage of the second stage becomes the output voltage of the whole amplifier. The open loop gain of the whole amplifier is then: $$A_{OL}={v_{out} \over v_{diff}}={g_m \over {2 \pi f C}}$$ **This is a remarkable result. By choosing the parameters of the input differential pair (and thus its transconductance $g_m$) and the compensation capacitor $C$, we completely define the gain of the whole amplifier.**

The open loop gain is inversely proportional to frequency (hence the straight red line in the log-log Bode plot above), and their product (**gain-bandwidth product** or $GBW$) is a constant: $$GBW={A_{OL} \times f}={g_m \over {2 \pi C}}$$ If we want a closed loop gain ${1 \over B} = {A_{CL}}$ from this amplifier, the zero-dB-loop-gain (intercept) frequency becomes $$f_0={GBW \over A_{CL}}={g_m \over {2 \pi C A_{CL}}}$$ In the case of the schematic above, $A_{CL}=10$, giving the intercept frequency of $f_0=916kHz$ (to match the 800kHz from the simulation, we need to add a couple picofarads of parasitic capacitance to the nominal value of the compensation capacitor).

The ratio (=difference in dB) between the open loop gain and the closed loop gain becomes the loop gain: $$LG={A_{OL} \over A_{CL}}={g_m \over {2 \pi f C A_{CL}}}$$

The design procedure for this type of compensation should ideally be based on the $f_0$ required to ensure stability, but this is usually not known. Instead, the design starts from the desired loop gain at the top of the audio band (20kHz), and the stability of the amplifier is confirmed experimentally. For example, if you want $LG=30dB$ of loop gain at $f=20kHz$ in the above amplifier with closed loop gain $A_{CL}=10$, you calculate $$C={g_m \over {2 \pi f A_{CL}LG}} \approx 50pF$$Part of the capacitance will be strays and parasitics, so the actual compensation capacitor should be a bit lower, say 47pF or 33pF.

In this post, I covered the benefits of Miller compensation, but it comes with some costs, such as the decreased loop gain and the interdependence of the loop gain and the amplifier's bandwidth. These will be covered in future posts.