Tuesday, December 11, 2007

How does a Class D amplifier work?


Fig. 1 shows a simplified block diagram of a full-bridge Class D amplifier. In the operation of the circuit Q1 – Q4 mosfets act as switches driven by an IC, U1, that provides pulse-width modulated signals (PWM ) to the switches. (See
Only one-half of the control circuit is shown. The switches Q1 and Q4 are turned on at the same time, and Q2 and Q3 are turned on at the same time, but not when Q1 and Q4 are on. The switching action alternately applies a pulse to one end of each inductor. The inductors and capacitors filter out the high frequency harmonic components of the square pulses that are applied. The audio signal is not filtered out because audio is in the pass band of the LC filters. The remaining audio signal is applied to the speaker to produce relatively noise free and low distortion sound, if the circuitry is properly designed.

A so-called half-bridge class D amplifier is similar, except that the right side filter with Q3 and Q4 are not used and the free terminal of the speaker is tied to power supply common. Note that a half-bridge amplifier will require the positive and negative power supplies to operate. The full-bridge circuit can be operated with only one supply voltage.

The mean signal value can be computed for a class d amplifier from the pulse duty cycle as

Vavg = Vhi * D + Vlow * (1-D)

where the duty cycle D is

D = Ton / T

Ton is the pulse on-time and T is the switching period. The switching frequency is the reciprocal of the period, or

Fsw = 1 / T

Tuesday, November 27, 2007

An Audio Preamplifier





Fig. 1 shows a typical single-ended inverting audio amplifier that might be used in low cost amplifiers for medium level inputs such as an electret microphone or as a hi-z headset amplifier. Depending on the quality of the op-amp utilized the circuit is capable of low harmonic distorsion (better than -60db) and depending on the external components and op-amp bandwidth we could obtain 20 to 20KHZ response within +/- 2 db or better flatness.

We present this amplifier to use as an example of analyzing gain and phase with a equation based method using typical math solving software, e.g., Mathcad ™ or Matlab ™.

The closed loop gain can be easily determined using our previous article on the inverting amplifier as

G = - Zf / Zin

Working in the frequency domain we can define the quantity s as

s = j *2*Pi*f

where j is the square-root of -1, Pi is 3.14159…, and f is the frequency of interest.

To simplify the equations we will define the following quantities (refer to Fig. )

Zcb = 1 / (s*Cb)

Zca = 1 / (s*Ca)

which are the impedances of the capacitors Ca and Cb. Then the net parallel impedance of the feedback loop is

Zf = Rb*Zcb / (Rb + Zcb)



and Zin = Ra + Zca

So we can now calculate the value of G versus frequency using one of the math software packages that will handle the complex number calculations.

Now in order to get a gain versus frequency response in practical numerical values that can be plotted in the traditional manner, that is voltage decibels vs. positive frequency, we first find the absolute value of the gain function (again using a software package) as

Gabs = G

Then the gain function can be calculated vs. frequency in terms of decibels as

Gdb = 20* log (Gabs)

and we can determine phase shift vs. frequency if we want to from

P = arg (G)

where arg is called the argument of the complex value of G (vs. frequency) and yields the phase vs. frequency. We will probably want to convert the phase computed above which is in the units of radians to the units of degrees and we would use the following equation:

Pdeg = 180*P / Pi

Using a software package the values computed at each frequency increment can be plotted vs. frequency and the cut-off frequencies, flatness, and phase can be determined from the plot or data generated.

An example of a typical design for a gain of ten amplifier would use a quality op-amp which is available from a number of reputable manufacturers, and a positive and negative supply voltages of at least +/- 3 volts or higher if a larger output signal is needed. The following components are suggested for the gain of ten preamp:

Ra = 1K
Ca = 22MFD
Rb = 10K
Cb = 470PF
I simulated this circuit with a Linear Technology ™ LTC6241 op-amp with excellent results, but as I mentioned a number of quality op-amps that would work are available from a number manufacturers.

Tuesday, November 20, 2007

What Does Feedback do?


How does amplifier feedback help?



Consider again our classical feedback amplifier in Fig. 1. We have the feedback amplifier equation:

Gcl = A / (1 + A * beta)

where Gcl is the closed loop gain of the amplifier with a feedback loop, A is the intrinsic gain of the amplifier (without the feedback loop), beta is the reciprocal of the external loop gain elements for example in the case of the inverting op-amp beta is

beta = Rin / Rf


One effect of feedback that we can calculate is the effect on gain accuracy. We can show that if we differentiate the gain vs. the intrinsic amplifier gain A, we have the equation

dGcl /dA = 1/ (1 + 2A*beta +A^2 * beta^2)

Let’s say that a particular op-amp had an intrinsic gain of 80db. This corresponds to a gain value of 10,000 ! And let’s say that the external gain of the amplifier is 10, or beta is 0.1. Then the above equation evaluates with this data to

dGcl/A = 1/ (1 + 2*10000*0.1 + 100000000 * 0.01) = 1/(1+ 2000 + 1000000) = 0.000001

We see two things from the above calculation. First the closed loop gain sensitivity to the amplifier intrinsic gain is only one part in a million. Second, we can approximate the result with a simple equation:

dGcl/A ~ 1 / ( A*beta)^2

So the larger we can make the product A*beta the less gain error sensitivity we will have.

For another example, in the case of the buffer amplifier with a beta of 1.0 and an intrinsic gain of 10,000, the gain error would only be 1 part in 100,000,000 ! In actual practice, this accuracy is not really achieved because of input offset voltage and bias or offset current errors. But the calculation shows that the great value of the operational amplifier is its insensitivity to amplifier intrinsic gain and that its gain is accurately determined by the external gain elements, e.g., Rin and Rf.

Another effect of feedback is the reduction of some of the distortion that may be generated by the amplifier as long as the distortion is inside the loop of the amplifier and its feedback path. Assume that there is some change in the output of the amplifier that is not the result of the input signal and is therefore an unwanted distortion product of some kind. We want to find out how much the feedback loop will do to correct this output variation, or what is the delta change applied to the input to correct or partially correct the variation? A way to answer this question is to find the derivative of Vin with respect to Vout using our gain equation from analysis of the circuit of Fig. 1. We have that

Vout = Vin * A / (1+A*beta)

or

Vin = Vout * (1+A*beta) / A

and then

dVin/dVout = (1+A*beta) / A

which we can re-write as

dVin = ((1/A) + beta) * dVo

For the large values of intrinsic gain A, we can approximate dVin as

dVin ~ beta * dVo = dVout / (1/beta) = (1/Gcl)* dVout

Here we see that if we have a closed loop gain Gcl of 10, our feedback correction will be about 10% of the output error. So if we had a distortion of 1.0% due to the intrinsic amplifier our net output distortion would be reduced to 0.9% (maybe enough to get our design to meet specifications.) If we have a unity gain buffer, we would have a correction of approximately 100% meaning that we should have almost zero distortion out of a unity gain buffer amplifier with the feedback loop.

Sunday, November 18, 2007

Inverting Amplifier Feedback





Fig. 1 shows an ideal feedback amplifier that represents the inverting amplifier circuit configuration of Fig. 2. The inverting amplifier has similar feedback calculations to the non-inverting amplifier. As a matter of fact the loop gains are identical (A*beta) and this is the quantity that is important to stability.

To calculate the loop gain we need to adjust the amplifier gain with the factor R2/(R1+R2). Ref. Intersil Application Note AN9415.3. Referring to Fig. 1, we calculate A as

A = Ai * R2 / (R1 + R2)

where Ai is the intrinsic gain of the op-amp, R1 is the inverting input resistance or impedance, and R2 is the feedback resistance or impedance. The feedback beta is R1/ R2 for the inverting amplifier so our loop gain calculation is

A*beta = Ai * (R2 / (R1+R2)) * (R1/R2)

Canceling out R2 we have

A*beta = Ai * R1/(R1+R2)

Now we have a similar equation for the inverting amplifier as:



G = Ai / (1 +A*beta)

The stability of the amplifier is governed again by the denominator 1+A*beta. When the denominator is 0, i.e., when A*beta = -1, then we have an unstable amplifier, if the signal is greater than unity (within the bandwidth) of the amplifier. Note that in this case the feedback is shifted 180 degrees in phase so that the feedback is now positive instead of negative. This is why it is necessary to “roll-off” loop gain to less than unity before the frequency is reached where the phase has naturally shifted to the positive feedback condition (as will usually happen if there is more than one pole in the amplifier response.)
Also, when there is more than one pole in the frequency response, the roll-off of loop gain to the unity gain threshold (also called the "cross-over frequency") or less, should begin before the second pole of the response of the amplifier is reached. In the Bode plot of the loop gain vs. frequency this is evidenced by a slope of -20db per decade of frequency at the unity gain cross-over frequency. If this is achieved the amplifier is usually stable.

The closed loop gain for the inverting amplifier is different from the non-inverting amplifier as we noted before. The closed loop gain is

Gcl = -R2/R1























Friday, November 16, 2007

How does op-amp feedback work?


Fig. 1 shows an ideal linear time invariant feedback amplifier where the basic amplifier A (an amplifier with intrinsic or basic gain A) is in a circuit with an ideal negative feedback block B = beta. The circuit is ideal with no time delays and the feedback signal received at the summing node is exactly180 degrees out of phase with the input signal Vin. The feedback therefore subtracts from the input signal Vin --instead of in-phase with the input which would add to the signal strength and be an unstable condition (if A is unity or greater.) In-phase feedback is called positive feedback and is generally not found in op-amp or amplifier circuits but is commonly employed in comparator circuits to provide hysteresis. Vs is the voltage sum of the input signal and the signal A* B = A(beta).

We can now do some simple algebra to find the overall amplifier gain including the feedback.

Vout = Vs *A

Vs = Vin – B*Vout

Vin = Vs + B*Vout

The gain G can be written as

G = Vout / Vin = A*Vs/(Vs + B*Vs*A)

Canceling out Vs from the numerator and denominator (Vs not = 0) we have

G = A / (1 + B *A)

The last equation is the classical ideal feedback amplifier gain equation.

We can use the same equation for op-amps when we equate B with beta. Recall that beta for a simple op-amp circuit is

beta = Rin / (Rin + Rf)

So then we can write from the above that


G = A/ (1+A*(Rin / (Rin+Rf))

Dividing the numerator and denominator be A (A not = 0), we have


G =1/ ((1/A)+Rin/(Rin+Rf))

Now since A is usually a very large value we have an amplifier for which gain is not dependent on A but the external components Rin and Rf:

G = (Rf + Rin) / Rin = 1 / beta

where beta is the quantity for op-amps we discussed in the previous article.

Tuesday, November 13, 2007

What Affects Bandwidth of an Op-amp Cicuit?


How do we relate the various quantities we talked about in the previous article? Fig. 1 above relates the quantities on a gain vs. frequency plot – sometimes called a Bode plot.
The graph shows an example of what a typical plot would look like for any given voltage op-amp. As you note, the maximum gain vs. frequency for the op-amp intrinsic gain is a strong function of frequency, usually falling off at a rate of 20DB per decade with increase in frequency, starting at approximately 10 to 100 HZ. We can extend the bandwidth of our op-amp circuit by actually attenuating the maximum amplifier intrinsic gain using the beta factor to multiply it by a number less than 1. For example if we reduced the gain by the factor beta (A *beta or 60DB reduction), we achieve the target gain of 20DB out to approximately 5KHZ. So larger values of beta reduce gain but increase the flat bandwidth.

Monday, November 12, 2007

What is Op-amp Noise Gain?


The attenuation factor of the output signal at the summing point of the amplifier (the negative input terminal of the op-amp) is called beta (a Greek letter) and is given by the ordinary divider equation as

beta = Rin / (Rin + Rfb)

The so-called “loop gain” (more precisely the open loop gain) is the gain around the loop as the product of the intrinsic open-loop gain of the op-amp itself and the attenuation factor beta, as

Go = A * beta = A * Rin / (Rin + Rf)

For the inverting circuit, the signal gain is given more exactly with a correction factor for the finite gain of the op-amp itself and we can write the corrected signal gain as

Gs = - (Rfb / Rin ) * (1/ (1 + (1/Go))

Looking at the equation above the last one we can see that the quantity Go takes into account the finite gain of the op-amp and the beta factor.

Let the gain correction factor be written as gcf, then we can write Gs as

Gs = - (Rfb / Rin) * gcf

where gcf is approximately 1.0 or a little less than 1.0.
For the non-inverting amplifier, we still have the same value for beta or the attenuation factor from the output to the summing point as

beta = Rin / (Rfb + Rin)

and we will have the same correction factor for signal gain as we had above. Therefore the non-inverting signal gain is given by


Gs_ni = ((Rin + Rfb) / Rin) * gcf


So what is noise gain? Noise gain is defined as the inverse of the beta factor or

NG = 1 / beta

In the case of unity gain amplifier circuits, if we consider the non-inverting unit gain circuit, the noise gain is

NGni = (Rin + Rfb) / Rin = 1 / beta

and Rfb is zero or Rin is infinite, so

NGni = 1 /1 = 1

So the noise gain for the non-inverting amp is 1.0.

For the unity gain inverting amplifier we have

NGi = (Rin + Rfb) / Rin

and Rin = Rfb , so

NGi = (Rin + Rin ) / Rin = 2.0

Therefore the noise gain of the non-inverting amplifier is lower than the inverting amplifier in the unity gain configuration. Why is this important? Because the noise gain will act on the voltage and current off-set errors of the op-amp as well as other op-amp noise sources. For a sensitive low level amplifier circuit we should therefore prefer the non-inverting configuration.

Friday, November 9, 2007

The op-amp summing circuit


The summer circuit of Fig. 1 has a number of applications. We can sum DC signals, AC signals, logic signals, to any arbitrary waveform that is within the dynamic range of the output of the operational amplifier. We can write a simple formula for the action of the summer circuit:

Vo = - RF * ( (V1 / R1 ) + (V2 / R2) + (V3 / R3) + …)

where the Vi’s can be functions of time as well as Vo. We could also generalize the Ri’s into general impedances Zi’s which could be inductors, capacitors, resistors, or combinations thereof. Discussing all of these possibilities is beyond the scope of our discussion.

We should mention however, that the circuit has a number of possible applications such as mixing different signal frequencies, adding or subtracting bits to a logic sequence, reconstruction of time multiplexed frequencies (frequencies must be within the bandwidth of the op-amp), and other applications that may be imagined.

One interesting application is the mixing of two or more frequencies to form a composite signal. For example if we added 1000 HZ, 2000 HZ, and 3000 HZ sine waves we would get a composite signal whose shape would depend not only on the frequencies but also the amplitudes and phases of the individual signals. If the composite signal is analyzed with a fast Fourier transform (FFT), we would find spectral lines for the different frequencies with the spectral amplitudes relative to each signal strength.
The following equation

Vo = -RF * ( (A1*sin(w1*t+p1) / R1) + (A2*sin(w2*t+p2) / R2 + …)

where the w1, w2, … are the radian frequencies and p1, p2, … are the phases.

One interesting case is when all the frequencies to be added are the same but the phases are different. The sum will be a sine wave with a single frequency equal to the original input frequency, but its phase will be the average of the phases of the original input frequencies if the phase differences are small. But the output signal will of course be inverted. Note however, if two signals of the same frequency but have 180 degrees difference in phase, we will have a cancellation effect for the two signals. Relative signal amplitudes of course will have an effect on the sum.

Monday, November 5, 2007

The Integrator and how you can use it


The op-amp integrator is a handy circuit that can be used to produce a linear voltage ramp or measure a capacitance value.

In the circuit of Fig. 1, if we put in a pulse of known time and peak value we can compute some things. First the input current is given by

Iin = Vp / R

If we also know the width of our input pulse, say Tc seconds, then we can compute the value of the capacitance by measuring Vo (if Tc is short enough to avoid pushing the op-amp output to its maximum output.) C is determined from the equation:

C = - (Vp / R) * Tc / (-Vo)

An Ocilloscope could be used to observe the input pulse height and time and the output pulse voltage output to determine the value of C.

In some unusual instances we may wish to measure an unknown resistor value such as a very high value. R can be determined from the equation

R = -(Vp / C) * Tc / (-Vo)

Notice that the output ramp is inverted so we have to use the negative signs to have R and/ or C be positive real values. The time to integrate, Tintg in Fig. 1, is determined by the energy contained in the input pulse and the time constant of the circuit RC.

Saturday, November 3, 2007

The differential amplifier


The differential amplifier is a very useful circuit where it is necessary to amplify either an AC or audio signal that is a differential input-- that is two input lines, neither one of which is ground or common. It can also be used to amplify small DC signals that are of a differential nature such as a strain gage or bridge measurement. Looking at Fig. 1, a circuit is shown that would be suitable for AC signals in the range of 20 HZ to 200KHZ with the component values listed below.
In Fig. 1, assume that R1 and R3 are matched in value and R2 and R4 are matched. Then the gain of the amplifier is

Vo = Vdiff * R2 / R1

where Vdiff is the differential voltage of the signal source. In terms of the two input lines from the differential source, with voltage values of V1 (high side input) and V2 (low side input) relative to ground, the output voltage will be

Vo = (V2 – V1) * R2 /R1

If the resistors are not matched the output will be in error according to the amount of miss-match. The output voltage due to the non-inverting input will be

Vo+ = V2 * ( R3 / ( R3 + R4 )) * (R1 + R2) / R1

and the output due to the inverting input will be

Vo- = - V1 * R4 /R3

The net output will then be

Vo = (Vo+) + (Vo-)

The error in gain can now be computed in terms of the individual resistor values. The action of the differential amplifier is to combine the non-inverting signal with the inverting signal inputs and produce an output that reflects the difference (or sum) of the two inputs multiplied by the effective gain.
If the signal is DC only then the capacitors in Fig. 1 should be removed. Otherwise, the capacitors can be used to couple an AC signal with isolation of the amplifier from the location of the source. High voltage capacitors can be used to provide the required amount of isolation.
For you brave souls out there, below is a list of component values needed to build an experimental amplifier with a gain of ten. The V+ and V- voltages for the CMOS type amplifier should be + or – 5 volts DC maximum. The amplifier circuit should have a pass band from 20HZ to 200KHZ with harmonic distortion of -70DB or lower, according to SPICE simulations. Traces should be kept very short and the power supply rails should be very well filtered to block power supply noise.

List of components:

Op-amp IC LTC6241HV
C1, C2 0.22 MFD
C3 10 PF
R1, R3 10K
R3, R4 100K


The load resistance should be greater than 100 ohms to avoid over heating of the amplifier or excessive output current and likely distortion. Also, although the amplifier is a “rail-to-rail” amplifier, it is wise not to overload the input with large input voltages to avoid “clipping” and distortion.

Thursday, November 1, 2007

What is a Voltage Follower?

The voltage follower is another handy type of amplifier that has a gain of 1.0 (or very close to 1.0 .) This is also called a unity gain amplifier. Why do we need an amplifier that does not increase or decrease the signal level? The reason is that we can buffer a weak current source signal to obtain the same signal level out, but with a strong source that reproduces the original source voltage signal within the bandwidth capability of the amplifier with very good accuracy.
How does it work? Remember the non-inverting amplifier discussed in the previous two articles posted here? If you look back at the previous article and at fig. 1 in this article, you will note that R1 has been removed from the circuit and R2 has been replaced with a short circuit (or sometimes with a relatively low value such as 1000 ohms.) The gain of the non-inverting amplifier was given as

G = ( R1 + R2 ) / R1

In the case of our voltage follower amplifier you can think of R1 as being a very high value and R2 as a very small value. So the gain of the voltage follower is, for example with R2 = 1000:

Gvf = (N + 1000 ) /N

where N is a very large value. In the limit as N approaches an infinite value, the value of R2 at even 1000 ohms is not very significant, so Gvf approaches 1.0 as N becomes larger and larger. Or if we just set R2 = 0 , then we have Gvf = N / N = 1.0.

Note also that we don't have to worry about common mode noise with this circuit unless the external traces are long.

So now we know about the voltage follower. The supply voltage connections are not shown but will be discussed in later articles.

Wednesday, October 31, 2007

More on the Non-inverting Amplifier

The circuit of Fig.1 has resistors R3 and R4. The amplifier would still work if R4 was removed and R3 is set to zero, but the amplifier will be more susceptible to what is known as common mode noise when the circuit is simplied to this extent. Common mode noise is defined as noise that appears in equal phase and amplitude on both inputs. This can happen if we have long traces, high impedance components, improper grounding and decoupling. Care should be taken to use short traces, the lowest practical values for resistors, proper grounding and capacitors connected to and placed close to the op-amp power pins to de-couple noise to ground. Resistor noise is proportional to the square-root of the resistance value. More on the subject of noise later.

Tuesday, October 30, 2007

The Non-inverting Amplifier


The non-inverting amplifier is another type of signal conditioner that instead of turning the signal upside-down simply and ideally only changes the signal amplitude and possibly shifts the DC average level of the signal (but we will not discuss level shifting at this point.)

Looking at Figure 1 you note that instead of putting the input signal into R1 as we did for the inverting amplifier, we insert it into R3 and the positive input of the amplifier (A) so the signal does not invert as it is “passed through” the amplifier. But the amplifier gain is still determined by the resistors connected to the negative terminal as before. This time the gain is positive and is

G = (Vout / Vin) = (R1 + R2) / R1

R3 and R4 are optional resistors. R3 can be zero and R4 can be open (or infinite value – not in the circuit.) R4 can also be leakage resistance to ground. If R3 and R4 are used then there is a voltage divider effect on the signal so that the actual positive terminal input signal is

Vin’ = Vin * R4 / (R3 + R4)

Then we have an additional gain factor of

G’ = R4 / (R3 + R4)

and the overall gain will be

Gtotal = G’*G

If R3 and R4 are used they can be any convenient values but if you set R3 = R1 and R4 = R2, then you have a balanced impedance input on each terminal of the op-amp. We will discuss this further later. The power supply connections are not shown for the sake of simplicity.

As with the inverting op-amp circuit, the current into the summing point (the negative input) is again zero by definition. Also the current into the positive terminal is zero by definition of the ideal op-amp. This requires the following equations to be true:

Vout = I * (R1 + R2)

where

I = Iin = Ifb

and Iin is the “input current” through R1 and Ifb is the “feedback current” through R2, and

Iin = Vin / R1

So we now have the formula for the output voltage of the op-amp as


Vout = (Vin / R1 ) * (R1 + R2)

which is the same as

Vout = G * Vin

Monday, October 29, 2007


The inverting amplifier can be thought of as some type of signal conditioner that turns the input signal up-side down or inverts the signal. An easy way to build one is with an IC called an op-amp, short for operational amplifier. Op-amps have some seemingly peculiar characteristics which we will mention later. Fig. 1 shows a simple schematic of a basic op-amp inverting amplifier.

The power supply connections are not shown in Fig. 1 for the sake of simplicity. Some basic facts about the op-amp are as follows (some of the pecularities):

1. The negative input of the op-amp (the – terminal of A) is a virtual ground or zero potential relative to Vref (virtually ground if Vref is ground) and is sometimes referred to as the “summing point” as we shall later. This means that the current from V in through the resistor R1 is

I in = V in / R1

and

2.
I_f = -V out / R2

where I_f is the “feedback current” through R2. The feedback current has to be the negative of the input current so that the sum is zero and the current into the negative terminal of A is zero by definition. The negative sign indicates the inversion of the signal.

By doing a little algebra we can combine the above two equations and arrive at the basic equation for gain of the inverting amplifier:

G = (Vout / Vin) = - R2 / R1

again the negative sign in the gain equation (sometimes referred to as the “transfer function”) indicates the inversion.

Sunday, October 28, 2007

What is this blog about?

This blog will cover various topics in analog electronics including circuits, parts, and theory from elementary to medium difficulty. The purpose will be to educate, provide information on design, techniques, tricks, simulation, and maybe a little entertainment thrown in.

Reader's comments are welcome. Good postings will be accepted as time permits.

Ed Boeckmann 10-28-2007