Wednesday, June 30, 2010

WHAT IS A FIRST ORDER ACTIVE FILTER?



What is an active low pass filter? Fig. 1 shows a simple first order low pass filter. Since it is a linear time invariant amplifier, we can write the transfer function in the frequency domain as

G = Vo / Vi = K * Wo / (s + Wo)

where K is the basic DC gain (see the link below for more information on op-amps), and we define s and Wo as

s = j * 2 * Pi * f, (j is the square-root of minus one, Pi = 3.14159…, and f is the frequency of computation.)

Wo = 2 * Pi * fo . fo = 1 / (2*Pi*R2*C)

K = - R2 /R1

where fo is the “cut-off frequency” of the filter. Since the filter is a first order filter, a Bode plot of gain vs. frequency would show that at the cut-off frequency, fo, the gain will decline at the rate of -20db per decade of increase of frequency.

A more useful and practical way to compute gain of this filter is to compute its absolute (non-complex) value as

Gabs = K * Wo / (W^2 + Wo^2)^1/2

In words, the above equation would read absolute gain is the product of K, and Wo, divided by the square root of the sum of the squares of W and Wo.

We can intuitively see that if W >> Wo the impedance of C will be a lot less than R2 and the gain will be very low, essentially blocking high frequencies from passing. In the high frequency range the circuit acts as an integrator. On the other hand, if W is much less than Wo, the impedance of C becomes very large compared to R2 so the low frequencies are passed all the way down to and including DC signals.

WHAT IS A FIRST ORDER HIGH PASS FILTER?



What are the basic equations for the first order high pass filter shown in Fig. 1?



In the frequency domain for a time invariant linear network we can write the transfer function of gain from input to output as



G = Go * s / (s + Wo)



where s = j *2 *Pi *f, and j is the square root of -1, Pi = 3.14159… , and f is the frequency variable. Go is the gain in the pass band and Wo = 2*Pi*fo. fo is the frequency at filter cut-off. G is the complex gain and the expression shows us that the transfer function has what is called a “zero” in its response at f=0, and a “pole” in its response at Wo (the cut-off frequency in radians.) A more practical equation has been derived from taking the absolute value of the gain and expressing it as



Gabs = Go*W / (W^2 + Wo^2)^1/2



where W= 2*Pi*f. From the above equation we see that as W becomes much greater than Wo, the response approaches Go = -R2 / R1. We can also see that as f approaches zero, the gain also approaches zero.


Lastly, we can easily compute the cut-off frequency fo as



fo = 1 / (2*Pi*R1*C)



The first order high pass filter is useful for removing very low frequency noise from a signal. But due to its first order characteristic, its roll-off below the cut-off frequency fo is only -20db per decade of frequency. So for example if the cut-off frequency is 10KHZ, the signal would be down to -80db at 1 HZ, assuming we had zero db in the pass band, or a gain of 1.0.

WHAT IS A SALLEN-KEY FILTER?

The Sallen-Key filter can be configured in a number of different ways. We will discuss a low pass filter shown in Fig. 1. (at bottom of post.) This is a second order filter and provides 40db attenuation per decade of frequency above the cut-off frequency. This is a useful circuit for applications where we wish to obtain a fairly rapid roll-off with a one-stage filter.

I won’t go into the transfer function equation here. If you want to study it, you can find the equation on Wikipedia. But to explain my design procedure (which is not found on Wikipedia), we do need to know the equations for the cut-off frequency, fo, and the quality factor, Q, of the circuit which are as follows:

fo = 1 / ( 2 * Pi * (R1*R2*C1*C2)^1/2)

The inner parenthetical quantity is the square-root of the product of the R’s and C’s multiplied together.

Q = ((R1*R2*C1*C2)^1/2) / (C2*(R1+R2))

where again the numerator is the square-root of the product of R’s and C’s. These are the equations we need to design the circuit.

First we combine the two equations to get the product of fo and Q:

Q*fo = 1 / (2*Pi*(R1+R2)*C2)

A Butterworth maximally flat filter would have a Q equal to the reciprocal of the square-root of two. For ease of calculation here, I will set Q = 1 to obtain a simple equation for fo:

fo = 1 / (2*Pi*(R1+R2)*C2)

where in all of the above Pi = 3.14159…

Assume that we want a filter with a 10KHZ cut-off and we are satisfied with a Q = 1 which will provide a reasonably flat response in its pass band. Then we know that the quantity important to the cut-off frequency is

(R1+R2)*C2 = 1 / (2*Pi*fo) = 1.5915 X 10^-5

The units of the above are reciprocal radian frequency. Let C2 be set to a reasonable value of say 1 nano-farad. (Don’t make C2 too large a value because C1 will need to be even larger.) Now we have that

R1+R2 = 15910

So as a quick approximation let us set R1 = R2 = 8K ohms each so the total is 16K ohms. Then we can calculate C1 from the square of our first equation above as

C1 = 1 / (4*Pi^2*R1*R2*fo^2*C2)

C1 = 3.957 X 10^-9 ~ 4 nano-farad

Now let’s check the design by calculating fo and Q:

fo = 1 / (2*Pi*(R1*R2*C1*C2)^1/2) = 9947 Hz

That is close enough to our original goal of a 10KHZ cut-off frequency.

Now for Q:

Q = (R1*R2*C1*C2)^2 / (C2*(R1+R2)) = (8000^2*4X10^-9*1X^-9)^1/2 / (1X^-9*16000) = 1.0

The calculated value of Q agrees with our original decision to set Q = 1.

I have now completed the design of the filter so that we have the following component values:

R1 = R2 =8K

C1 = 1X10^-9

C2= 4X10^-9

Q = 1.0

fo = 10KHZ

In fact I simulated the design using a 1MHZ JFET input op-amp and had the following results:

fo ~ 12.7KHZ (-3db down frequency)

flatness 1.3 db DC to 7KHZ

40 db per decade attenuation above 10KHZ

-54 db at 300KHZ then rising slowly to -46db at 1MHZ.

The response was very smooth with no ring or ripple in the pass-band, with a steady 40db per decade roll-off after cut-off.


The Butterworth Filter

The Butterworth filter is a class of filters that meet certain mathematical characteristics and performance characteristics that can be met by certain filter types both passive and active. The Butterworth filter theory was developed by Stephen Butterworth in 1930. The theory is still applied today.
A Butterworth filter is maximally flat in the pass band-- that is no ripples, and has a monotonic shape in its pass band and in its stop band. The Butterworth filter is the only type that is monotonic in the stop band as opposed to Bessel, Chebyshev, and elliptic filter types which are not. In the stop band, the Butterworth filter rolls off at a rate of -20db per decade for each order. First order is -20db slope. Second order is -40db. Third order is -60db, etc. But the Butterworth filter does not have as sharp a cut-off slope as the other filter types. The Butterworth filter has a more linear phase response in its pass band.

The transfer function for the Butterworth filter can be written in terms of its poles of its characteristic equation (the denominator of the function.) There are no zeroes in the function which accounts for its monotonic characteristic.

H(S) = Ho /(II(k=1,n) (S-Sk)/Wc)

Ho = DC gain
II(k=1,n) means the product of the factors to follow
S=complex radian frequency = j*2*Pi*f
Sk’s = roots or pole locations in terms or radian frequency
Wc = j*2*Pi*Fo , the radian frequency for the cut-off frequency Fo
k,n is an index range for the product of factors to indicate the order of the filter from 1 to order n

The Butterworth polynomials have been calculated for normalized Butterworth filters (by setting the cut-off radian frequency Wc = 1.) We will list the first 3 Butterworth polynomials here. Higher orders can be looked up in standard tables found in most filter texts, or on the Internet by searching on “Butterworth filters.”

n=1 s+1

n=2 s^2 + sqrt( 2) * s + 1

n=2 (s + 1) * (s^2 + s + 1)

The root of the above polynomials are all negative and lie on the unit circle surrounding 0,0 on the complex plane.

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.