Saturday, December 26, 2020

Audio Amplifier Feedback - Dominant Pole ("Miller") Compensation

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

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:

    1. 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;
    2. 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;
    3. 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.

    Saturday, December 19, 2020

    Audio Amplifier Feedback - A Realistic Power Amplifier and its Phase Margin

    This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

    In the last post on this topic, I mentioned that any real amplifier has multiple poles, which cause phase lag at the amplifier's output. The lag increases with frequency, and it affects the behavior of the amplifier placed in a feedback loop. As the phase shift at the intercept frequency (where the amplifier's open loop gain equals to the closed loop gain, and thus the loop gain is unity) approaches 180 degrees, the signal at the output of the starts exhibiting overshoot and ringing:

    If the phase lag at the intercept frequency reaches 180 degrees , the amplifier becomes unstable - this is called the Barkhausen stability criterion. 

    The difference between 180 degrees and the actual phase lag at that frequency is called the phase margin and is an indicator of how close the amplifier to instability. A practical requirement is to have at least 30 degrees of phase margin - that is, the phase lag at $180 - 30 = 150$ degrees or less - at the frequencies where the loop gain is between 10db and -10dB.

    Let me look at a realistic example of a conventional three-stage audio power amplifier with the desired closed loop gain of 10 (=20dB):

    It has multiple poles, and at the crossover 0dB frequency (about 6MHz), when its open-loon gain (green line) reaches the desired closed-loop gain set by the feedback network (blue line), the phase at the output lags that at the input by over 240 degrees, indicating the negative phase margin of about -60 degrees:

    With a negative phase margin, the amplifier is unstable and will oscillate:

    To make it stable, one needs to compensate it - to make somehow the phase lag at the intercept frequency less than 180 degrees. The simplest way is to increase the closed loop gain by modifying the feedback network. If we, for example, set the closed loop gain at 3,000 (or 70dB), the intercept frequency moves from 6MHz to 300kHz, and the gain margin becomes positive 50 degrees, making the amplifier stable:
    The problem with this approach is, of course, that no one needs an audio power amplifier with the gain of 3,000. 

    Thankfully, there are more practical ways to compensate this amplifier, and I will look at them in the next posts.

    Sunday, December 13, 2020

    Velleman K4040, take three

    This is the last of three posts on Velleman K4040. Here are the links to the first and second posts.

    Over 10 years ago, I built a Velleman K4040 power amplifier from an (expensive) kit. The amplifier still looks quite impressive:

    Not satisfied with the out-of-the-box performance, I modified the amplifier (see my previous post for details). The result was a dramatic improvement in sound. However, without its global feedback, the amplifier had higher measured distortion, higher input sensitivity and more hum.

    Ten years later, I (slightly) revised the amplifier. I replaced the resistors in the signal path with mil-spec metal film from Vishay, tidied up the wiring of the phase splitter and added a global feedback loop that encloses the input stage. With it, the amplifier has 0.015% distortion at 1W (that is, one-sixth of its original specification), the hum is much reduced, and the input sensitivity is in line with the output voltage of today's signal sources.

    The final schematic:

    Measurement results compare well to those of tube power amplifiers made by major brands and priced at up to $10,000, as measured by Stereophile. The modified Vellemn K4040 offers respectable measured performance typical of a classic tube design.

    More photos (click for higher resolution):

    Saturday, December 12, 2020

    Audio Amplifier Feedback - Amplifier with Multiple Poles Inside Feedback Loop

    This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

    In the last post, I mentioned that any real amplifier's gain sooner or later goes down as the frequency goes up. As the gain declines, the phase at the output starts lagging that at the input (the amplifier has a pole):

    Declining gain and lagging phase as the frequency grows are the characteristics of a low-pass filter:

    Screen Shot 2020-11-20 at 3.00.05 PM.png

    With some simplification, one can say that every capacitance in a circuit can form a low pass filter and can create a pole. Even in a very simple circuit, there are many capacitances, intended and parasitic:
    so there are many poles.
    Let's say an amplifier has three poles, at 2kHz, 1MHz and 20MHz, and is placed inside a feedback loop with B=-1/10 (say a resistive divider made of a 9kOhm and a 1kOhm resistors from the output of the amplifier to its inverting input):
    The Bode plot of the amplifier's open loop gain and the ideal closed loop gain:

    If we apply a square wave to the input of such an amplifier, at the output we will observe the following:

    which is not what was intended. The signal transfer function has a pronounced peak and is not the flat 20dB line that the feedback network demands:

    Turns out that at about 4.5MHz, where the open goop gain $Aol$ approaches $1/B$and the loop gain $Aol \times B$ approaches unity, the amplifier's multiple poles together create a phase lag of almost 180 degrees. Together with the 180 degrees created by applying the feedback to the inverting input, the phase shift is close to zero at the point where the loop gain is unity. As a result, the signal transfer function $STF={LG \over {1 - LG}}{1 \over B}$ and the error transfer function $ETF={1 \over {1 - LG}}$ can become very large, leading to instability.
    To avoid instability and make $STF$ and $ETF$ what they should be, the amplifier needs to be compensated, which will be the topic of my future posts.

    Saturday, December 5, 2020

    Audio Amplifier Feedback - Amp with Frequency Dependent Gain

    This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

    In the last posts, I looked at the feedback theory basics and at how it applies to an opamp in both inverting and non-inverting configuration.

    No amplifier can have a constant gain over an infinite bandwidth, as that would require infinite power. Any real amplifier's gain sooner or later goes down as the frequency goes up. For example, for most opamps designed in the past 50 years, their open loop gain (that without any feedback applied) starts going down at 100Hz or less:

    The open loop gain Aol keeps going all the way down to unity (0dB) at a rate 20 dB/decade. At the same time, the phase (dashed line) at the output starts lagging that at the input (the opamp has a pole):

    Eventually, the lag reaches (almost) 90 degrees. (Should there be more poles, each would add its own 20 dB/decade decline to the gain and up to 90 degrees phase shift. For now, I am going to look at just one pole.)

    If such an opamp is connected to a feedback network (a resistor voltage divider) with gain 1/10:

    setting the closed loop gain Acl=1/B at x10, or 20 dB, the error transfer function ETF and signal transfer function STF become frequency dependent:

    At low frequencies, the magnitude of STF is 20dB, and the phase is constant - feedback stabilizes the gain of the opamp. The magnitude of ETF is -80dB (in this example), that is, any distortion that the opamp may generate will be reduced by a factor of 10,000. As frequency goes up, however, the open-loop gain Acl falls, and ETF grows. At 20kHz, ETF is only -27dB, so the distortion is reduced by only 20 times.

    Loop gain LG is the product of open loop gain Acl and feedback network gain B, which is the same at the ratio of Acl and 1/B and, on the log plot, is simply the vertical distance between Acl and 1/B curves. The point where Acl meets 1/B is the crossover point - the loop gain become unity (0 dB), and feedback ceases to stabilize the STF and correct any distortion:

    For large loop gains, ETF is approximately equal to loop gain, so commonly, it is the loop gain and not the ETF that is considered the measure of feedback's power to correct distortion. The more loop gain, the more distortion is reduced by feedback.

    Loop gain falling with frequency shifts the spectrum of uncorrected distortion to higher frequencies, which creates a peculiar sonic signature - the bass, largely unaffected by distortion, become incredibly powerful and "tight", which is frequently attributed to the low damping factor or massive power supply of the audio amplifier.

    There is an opinion, not scientific but useful, that, in case an amplifier has insufficient loop gain to correct distortion, it is sonically better to have loop gain, and thus distortion, approximately equal across audio range of frequencies, rather than allow loop gain to fall, and distortion to grow, with frequency as above.

    Next week, I will look into what happens when the amplifier has multiple poles.