Sei sulla pagina 1di 5

2/16/13

Adder and subtractor circuit

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:
homepages.which.net/~paul.hills/Circuits/Adder/Adder.html 1/5

2/16/13

Adder and subtractor circuit

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 (dont worry if you dont 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 Lets 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: Ma = 1 M1 = 1 M2 = 4 5 = 0.8. We will choose a reasonable value of feedback resistor of 10k. Then: Ra = 10k 1 = 10k R1 = 10k 1 = 10k R2 = 10k 0.8 = 12.5k 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:

2/5

2/16/13

Adder and subtractor circuit

Below is the result of a simulation of this circuit with the following inputs: V1 = +10v Va = Sine wave: Freq=100Hz, Ampl = 3v.

It can be seen that the output waveform agrees with the required equation Vout = V1 Va + 4
homepages.which.net/~paul.hills/Circuits/Adder/Adder.html 3/5

2/16/13

Adder and subtractor circuit

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. Lets look at another example to show this procedure. Well 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.
homepages.which.net/~paul.hills/Circuits/Adder/Adder.html 4/5

2/16/13

Adder and subtractor circuit

Conclusion
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: Inaccuracies in the resistor values will lead to inaccuracies in the calculated output voltage. If necessary, you can series or parallel combine resistors as appropriate. 1% resistors are fairly cheap now and will reduce error in the final Vout. If necessary, 0.1% resistors are available but cost around 70 pence (1 US dollar) each. Note however that the possible Vout error is the sum of all the tolerance errors on all the resistors. Temperature drift will also affect the circuit. To reduce this select resistors with low temperature coefficients. The accuracy of the output depends on the accuracy of the inputs. If you want a 1% precise output, then using a power supply rail of 5v +/- 5% will be no good. In this case, you may want to use dedicated voltage references instead of the power rails. The opamp power supply should span all possible input and output voltages. If normal opamps are used, the supply voltages should be a couple of volts beyond the required voltage range, both positive and negative. If this is not possible, see rail-to-rail opamps described below. See the Power Supplies section for details on how to implement this. Unlike the simple negative feedback negative gain amplifier circuit, this circuit does not have a virtual ground at the opamp inputs. The +ve and -ve inputs should both be at the same voltage, but this voltage will vary with the input voltages.

Performance
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

homepages.which.net/~paul.hills/Circuits/Adder/Adder.html

5/5

Potrebbero piacerti anche