Adder and subtractor circuit

V2.00 3-Aug-04

Testing status: Simulated

Several of the circuits in this section require analogue voltages to be added together or subtracted from one another. This section describes a general purpose circuit that can achieve this function using just one opamp, with only resistors as additional components.

The generic circuit

The diagram below shows the generic circuit configuration:

In this diagram, there are six input voltages. Va to Vc are negative inputs, and V1 to V3 are positive inputs. Each can have a gain (Mx), which is determined by the resistor value they go through. All the resistor values are referred to the fixed feedback resistor, Rf. The gain of input Va for example, is -Ma (minus because this is a negative input). The gain of input V3 is +M3.

There is then one single resistor value, Rf / S which must be calculated from the other values. The value S is given by the equation:

That is, it is 1 plus the sum of negative gains minus the sum of positive gains. Note that there can be any number of negative or positive inputs, so the general form of this equation is (donít worry if you donít understand this bit!):

where n is the number of negative inputs and p is the number of positive inputs.

The output voltage of the circuit is given by the equation:

or in general terms...

An example

Letís look at an example to get this clear. Say we want a circuit that subtracts a varying voltage Va from another varying voltage V1, and has an offset of 4 volts (that is has +4v added to it). We assume there is a fixed +5.0v power supply available which is stable enough to use for a reference voltage. We can write:

Vout = V1 – Va + 4

Since there is only one negative and one positive voltage input, Vb, Vc, and V3 and their associated resistors are absent from this ciruit. V2 we will use for the +4v to add by connecting it to the +5v supply.

The gains we require are:

We will choose a reasonable value of feedback resistor of 10k. Then:

Now we must work out S to find the resistor to ground:

S = 1 + [1] – [1 + 0.8] = 0.2

Therefore the resistor to ground must be 10k ÷ 0.2 = 50k. Thus the final circuit is as shown below:

Below is the result of a simulation of this circuit with the following inputs:

It can be seen that the output waveform agrees with the required equation

Vout = V1 – Va + 4

A potential problem

This is all very well for examples like that above, but what happens if the positive gains are more than one greater than the negative gains? Then S becomes negative, and the resitor to ground has a negative value! Note that S can be zero, since then Rf / S becomes infinite in value, which is an open circuit, i.e. resistor not present.

A negative resistor cannot be inserted, so we must fiddle the circuit to cope with this outcome. To do this we add more negative gain on a dummy voltage input, then tie the dummy voltage input to 0v so it has no effect on the calculation that the circuit is performing. Letís look at another example to show this procedure. Weíll modify the previous requirement slightly so that:

Vout = 3V1 – Va + 4

This time the positive varying input has a gain of three, so R1 = 10k / 3 = 3k33. But now:

S = 1 + [1] – [3 + 0.8] = -1.8

To cope with this, we will add another negative input with a gain of 2. To provide this new input, we must use a resistor of value 10k / 2 which is fed from 0v so that it makes no additive difference to the calculation that the circuit is performing.

Now the S equation is:

S = 1 + [1 + 2] – [3 + 0.8] = 0.2

So the resistor to ground has the value 50k again. The circuit for this is shown below:

The extra 5k resistor fed from 0v (ground) provides the extra negative gain required to keep S positive.


This circuit is used in several of the other projects on this site. It is the most convenient way to add and subtract fixed and varying voltages. There are some points to note however:


A standard type opamp such as LM358 (dual) or LM324 (quad) will be adequate for most of the circuits we will deal with.

If low noise is required, the Texas Instruments TL07x series is a good and cheap type.

If operation to the supply rails is required, or low voltage operation, then a rail-to-rail opamp such as the LM6132 or LT1218 may be used.

Back to circuits index
Back to main index