## The Differential Amplifier Common-Mode Error – Part 1

The common-mode voltage can bring errors in the differential amplifier applications.  What is the common-mode voltage?  The common-mode voltage is the voltage level common to both inverting and non-inverting inputs of the differential amplifier.  In many applications, the differential amplifier is used to amplify the difference between two voltages, for later processing, or to isolate a signal from common-mode noise, or to amplify a signal that rides on top of some large voltage level.  If the common-mode voltage is not rejected, it appears as an error at the amplifier output.

It is customary to consider the common-mode error as being negligible, based on the high Common-Mode Rejection Ratio (CMRR) of the operational amplifiers.  This is not always the case.  Once the electronics designer connects resistors around this amplifier, in a differential configuration, the common-mode error starts to be significant.

The common-mode voltage Vcm and the differential voltage Vd are shown in the group of equations (1).

 (1)

Why these expressions?  How was Vcm defined like that and why?  We will start by looking at the significance of each input voltage in the differential amplifier.

Looking at Figure 1, V1 is the input voltage between R1 and ground, while V2 is the input voltage between R3 and ground.

Figure 1

As we saw in MasteringElectronicsDesign.com: The Differential Amplifier Transfer Function, the signal at the amplifier output is as follows:

 (2)

If we arrange this equation differently, as in (3),

 (3)

one can see that, in the unique case in which

 (4)

the circuit amplifies the difference of the input signals, V1-V2.  In other words,

 (5)

So, which is the common-mode voltage?  In order to give you an answer, let’s rearrange the input signals as in Figure 2.

Figure 2

It should be clear now that, when the ratio of the resistor pairs is equal, V2 contribution to the output signal is zero.  This can also be seen from equation (2) written differently, as in (6).  In equation (6), I grouped the terms so that two main signals are shown: the difference V1-V2 and V2.

 (6)

How did I arrive at this equation?  It can be done in two ways: mathematically, using simple algebra methods, or, by using the Superposition Theorem.

Using the Superposition Theorem is easier, because we can consider that there are two voltage sources in the circuit in Figure 2.  One source is V1-V2 and the other one is V2.  Based on the Superposition Theorem if we take out one source, V2, and replace it with a wire, we find the first term of equation (6).  Indeed, when R3 is connected to ground, the amplifier in Figure 2 becomes a non-inverting amplifier.  As I showed in a previous article, MasteringElectronicsDesign.com: The Differential Amplifier Transfer Function, Vout1 is the voltage at the non-inverting input times the gain given by R4 and R3.

 (7)

With Vout1 I noted the output voltage when V2 is zero.

By rearranging

we arrive at the first term of equation (6).

The second term of equation (6) is the output voltage when V1-V2 is made zero.  In this case the amplifier in Figure 2 is a differential amplifier with the same voltage, V2, at both inputs. Hence, the second term of equation (6).

Equation (6) is important because it shows the common-mode error.  Since the circuit amplifies the difference V1-V2, this signal appears as riding on top of V2.  Hence, V2 can be seen as a common-mode voltage.   If the resistor ratios are rigorously equal, the second term in equation (6) is zero.  If they are not, the same term will show up at the amplifier output as an error.  This is the common-mode voltage error.

How big is this error and why should the electronics designer be concerned about it?

Let’s consider that the ratio of the resistors is equal, as in equation (4), and that only R2 has a tolerance t which can be positive or negative, but smaller than 20%. In other words:

 (8)

For resistors, this is a practical assumption.  Examples of usual resistor tolerances are 0.1%, 1%, 10%, 20%.  In my example R1, R3 and R4 are ideal resistors, with 0 tolerance, while R2 has a tolerance of, say, 10% which I noted with t.  This creates a mismatch in the resistor ratios R2/R1 and R4/R3 , so that the common-mode voltage V2 appears at the differential amplifier output, scaled by a factor dependent on the tolerance t.  This voltage level is the common-mode error.

To calculate this error, let’s write the common-mode portion of the differential amplifier output by taking into consideration the tolerance t of resistor R2,

 (9)

where with Vocm I noted the common-mode voltage at the differential amplifier output.  Since the signal of interest is the difference V1-V2, the common-mode error at the differential amplifier output is Vocm.

After calculations, and using (4), Vocm becomes

 (10)

We can consider that t·R2/R1 is small compared with the ratio R2/R1 which determines the gain of the amplifier.  Also, for gains larger than 10, the value of 1 in the denominator can be neglected.  Therefore, the common-mode error Vocm is

 (11)

Equation (10) shows that, if one resistor, R2, has a tolerance other than zero, there is a significant error at the differential amplifier output, which is approximately the common-mode voltage times that tolerance.

As an example, if V2 = 10V, V1 = 10.1V, and

the circuit in Figure 1 amplifies the difference between these two signals, so that the output is 2V.

However, if R2 has a tolerance of +10%, the error at the circuit output is Vocm = 10V·0.1 = 1V.  As a result, the differential amplifier output will be the sum of the differential output of 2V and the error of 1V, which makes 3V.  The error of 1V is significant.

If R2 has a tolerance of 0.1%, the error is 10mV, which can be considered negligible in some applications.  That is why the usual recommendation is to have either highly matched resistors for the differential amplifier, or resistors with 0.1% or even 0.05% tolerance.

The same logic is valid for V1 that can be viewed as the common-mode voltage, while the circuit amplifies the negative difference -(V1-V2).  In the next part I will show that the convention for the common-mode voltage is

and also the reason why this is the preferred method.

## How to Derive the Differential Amplifier Transfer Function

The transfer function of the differential amplifier, also known as difference amplifier, can be found in articles, websites, formula tables, but where is it coming from? Why is the differential amplifier transfer function as in the following mathematical relation?

 (1)

where the resistors are those shown in Figure 1.

Figure 1

First, an important remark: This formula applies only for an ideal operational amplifier. This means that the amplifier has a large gain, so large that it can be considered infinity, and the input offset sufficiently small, so that it can be considered zero. Also, the input bias currents are sufficiently small so that they can be considered zero. I was once asked “but what is sufficiently small?” A voltage or current in electronics is considered sufficiently small, when its numerical value is 1/100 or less versus the dominant voltages or currents in the circuit. For example, if the input voltage levels, in the circuit in Figure 1, are around a few volts, and the operational amplifier input offset is millivolts or sub-millivolts, then we can neglect the input offset and consider it zero.

Having said that, do we need to know this formula by heart? Of course not. All we need to know is how to derive it. This is not difficult at all.

The transfer function can be derived with the help of the Superposition Theorem. This theorem says that the effect of all sources in a linear circuit is the algebraic sum of all of the effects of each source taken separately, in the same circuit. In other words (back at Figure 1), if we remove V1, and replace it with a short circuit to ground and calculate the output voltage, and then we do the same with V2, the output voltage of the differential amplifier is the sum of both output voltages as they were calculated with each source separately.

Let’s first remove V1. R1 cannot be left unconnected, because in the initial circuit there was current flowing through it.  Therefore, let’s ground R1 (see Figure 2).

Figure 2

We can see that our amplifier becomes an inverter, which has its non-inverting input connected to ground through R1 and R2.  Vout2 is given in equation (2).

 (2)

Read MasteringElectronicsDesign.com: How to Derive the Inverting Amplifier Transfer Function for a proof of this function.

Now let’s remove V2 and ground R3 (see Figure 3).

Figure 3

This is a non-inverting amplifier. For an ideal operational amplifier, Vout1 is a function of V, which is the voltage referred to ground at the non-inverting input of the operational amplifier.

 (3)

The resistors R1 and R2 are an attenuator for V1, so that V can be determined as in the following relation.

 (4)

By replacing V in equation (3), Vout1 becomes:

 (5)

Now that we have Vout1 and Vout2, and using the Superposition Theorem, Vout is the algebraic sum of Vout1 and Vout2,

 (6)

which is the differential amplifier transfer function.  (Q.E.D.)

## Solving the Differential Amplifier – Part 3

### Design a Differential Amplifier by Inspection

Designing the differential amplifier by inspection is part of the art in the analog design.  Inspecting the circuit and knowing how it works, it really gives you a feeling on what the values of the resistors should be.

Looking back at the example I took in MasteringElectronicsDesign.com: Solving the Differential Amplifier – Part 1 and Part 2, we need to have an output signal of -1.25V to +2.365V with an input signal of -0.5V to 5.5V.  In those two articles I used the differential amplifier transfer function and I applied math to find the resistors.

This time I am going to demonstrate how this circuit can be solved by simple reasoning and knowing how it works. Some calculations are also necessary.  Cannot get rid of math totally.

Let’s write down the design requirements.

If Vin1 = -0.5V, then Vout1 = -1.25V and
If Vin2 = 5.5V, then Vout2 = 2.365V.

First, let’s remark the following:   If we bring a positive signal in the V1 input, the output will swing towards the positive rail.  If we connect a positive signal to V2, the output will swing towards the negative rail.  Of course, if the input signal is negative, the effect is opposite (see Figure 1).

Figure 1

The transfer function of the differential amplifier is as follows:

 (1)

For this function proof read MasteringElectronicsDesign.com: How to Derive the Differential Amplifier Transfer Function.

We will use V1 as the signal input, because the amplifier is not an inverter.   The design requirements show that, when the input swings positive, the output goes positive as well.  Let’s ignore for the moment V2. We will make V2 zero, by connecting R3 to ground (see Figure 2).  If V2 is zero the transfer function can be rewritten as in the following equation.

 (2)

Figure 2

The amplifier output in Figure 2 has to swing between -1.25V to +2.365V which means that the output total trip is

 (3)

The same can be written about the input range

 (4)

Therefore the gain has to be

 (5)

In effect, this circuit is an attenuator, with a sub-unity gain.

By comparing equations (2) and (5), we conclude that

 (6)

However, even if we do calculate the resistors based on equation (6), we know that there is something missing.  Although the output range of 3.615V is correct for the input range of 6V, when the input is at Vin1 voltage level, the output is not at Vout1.  By the same token, when Vin is at Vin2 level, the output is not Vout2.  Although the total trip at the amplifier output is correct, the extremities are not in the right position.  We need to introduce an offset, to move Vout1 in position, at -1.25V.  If we do that, since the swing is correct, Vout2 will fall at the correct voltage level of 2.365V.

How do we calculate the offset? If we multiply Vin1 with the amplifier gain, the result is

 (7)

The difference between -0.301V and Vout2 = -1.25V is -0.949V.   This is the negative offset we need to introduce at the amplifier output. How do we do that? Enters V2.  A positive value at V2, will move the output in the opposite direction.  Comparing equations (1) and (2), the output offset is

 (8)

We can choose for V2 any suitable voltage level or reference we have in our system.  If this is V2 = 2.5V, and after choosing a standard value for R3 = 10 kOhm, we can calculate R4 as 3.795 kOhm.  A standard value for R4 is 3.83 kOhm, with 1% tolerance.

Now that we know the resistor ratio R4/R3, R1/R2 can be easily calculated using equation (6).  After calculations, R1/R2 = 1.29.  Then we can choose R1 = 10 kOhm, therefore R2 = 7.754 kOhm.  A standard value for R2 is 7.68 kOhm, with 1% tolerance.

>>> <<<

## Solving the Differential Amplifier – Part 2

### Design a Differential Amplifier with the Coefficients Identification Method

In the first part of this series, MasteringElectronicsDesign.com: Solving the Differential Amplifier – Part 1, I wrote that the common usage of the differential amplifier is as a gain circuit for the differential voltage at its inputs.  When the circuit in Figure 1 has the resistor ratios equal

 (1)

the amplifier transfer function is

 (2)

and the circuit amplifies the difference between the input signals.

Figure 1

But the resistors’ calculation  becomes a bit of a challenge, when one might be faced with designing a differential amplifier with a certain transfer function.  The example I took in the first article was as follows:  Given an input range of, -0.5V to 5.5V, the output has to swing between, -1.25V and +2.365V.  I solved the problem by using the amplifier transfer function and a system of equations.

In this article I am going to write about designing the resistors of this differential amplifier using the method of coefficients identification.

Starting from the differential amplifier transfer function,

 (3)

we note that this is a linear function Vo, with two variables:  V1 and V2.  However, if we consider one of these two variables a known value, say, V2, Vo becomes a simple linear function with one variable.  Let’s note this function with Vo(V1).

The design requirements are as follows:

If Vin1 = -0.5V, then Vout1 = -1.25V and
If Vin2 = 5.5V, then Vout2 = 2.365V,

where by Vin1 and Vin2 I noted the input range limits, and by Vout1 and Vout2 I noted the output range limits.

A linear function of first degree is a straight line which is determined by two points in the (x,y) plane (see Figure 2).

Figure 2

If we know one point (x1,y1) and the second point (x2,y2), we can determine the slope of the line, which is the tangent of the angle α between the x2-x1 and the hypotenuse of the triangle formed by the segments x2-x1 and y2-y1.

 (4)

If we take an arbitrary point on this line between (x1,y1) and (x2,y2) and call it (x,y), the slope of the line has to be the same between the segment to the left and the one to the right of (x,y) point (see Figure 3).

 (5)

Figure 3

Solving for y in equation (5), the result the well known linear function y(x), that we know it goes through the first point (x1,y1) and the second point (x2,y2).

 (6)

Having said that, now we can compare the differential amplifier transfer function (3) with the linear function (6).  When these two functions are identical, Vo(V1) is y(x) and V1 is the variable x.  These are two linear functions that can be identical only if they have the coefficients identical, hence the name of the method.

 (7)

As y(x) is determined by its two points in plan, so is Vo(V1).  The given data points (Vin1, Vo1) and (Vin2, Vo2) determine the transfer function Vo(V1).  Therefore, (7) can be rewritten as the following system of equations.

 (8)

After replacing the known values Vin1, Vin2, Vout1 and Vout2 and after calculations, the system becomes

 (9)

which is exactly the result we had in part one of this series.

The system of equations (9) can be solved in the same manner as in the first article.   In brief, we choose the voltage reference V2, based on the available voltage references we have in the system, then we calculate the ratio .  Knowing this ratio we can calculate.  Then, knowing the resistor ratios, by choosing a pair of resistors say, R1 and R3 we can calculate R2 and R4.

Therefore, if we choose V2 = 2.5V, R3 = 10 kOhm, and R1 = 10 kOhm, the result is R4 = 3.795 kOhm, or a standard value of 3.83 kOhm, with 1% tolerance.  Also, R2 = 7.754 kOhm, or a standard value of 7.68 kOhm, with 1% tolerance.

## Solving the Differential Amplifier – Part 1

### Design a Differential Amplifier Based on the Input and Output Voltage Level Requirements

The differential amplifier, also known as the difference amplifier, is a universal linear processing circuit in the analog domain.  Why?  Because you can achieve any linear transfer function with it.  It can be reduced to a simple inverter, a voltage follower or a gain circuit.  It can also be transformed in a summing amplifier.

Figure 1

So, what is the common usage of the differential amplifier in Figure 1?  When the resistor ratios are equal

the amplifier transfer function is

and the circuit amplifies the difference between the input signals.

However, there are times when the electronics designer is faced with the following design requirements:  Given an input range of, say, -0.5V to 5.5V, the output has to swing between, say -1.25V and +2.365V.  It is clear that this requires an amplifier with a certain gain and an offset different than zero.  How can we design the differential amplifier to achieve such a function?