# Subtractor op-amp configuration to find the diference of 2 signals

Electrical Engineering Asked by MetrryBoros on August 27, 2020

How can a differential op-amp be configured in a way that it doesn’t amplify but only takes the difference between the signals at the inverting and non inverting input?

## First story

The best way to reveal the idea of this clever circuit solution, is to show how it was invented (this approach is suitable for explaining every unknown circuit).

• Probably, some tried to convert the humble non-inverting amplifier into a differential amplifier by connecting the second voltage to the unused inverting input. But it turned out the gain of the inverting input is one unit smaller than the gain of the non-inverting input. So they connected an amplifier between the second input source and the inverting input.

• Probably, others tried to convert the humble inverting amplifier into a differential amplifier by connecting the second voltage to the unused non-inverting input. But now it turned out the gain of the non-inverting input is one unit larger than the gain of the inverting input. So they connected an attenuator between the second input source and the non-inverting input.

Of course, the second solution turned out to be simpler ...

## Second story

The idea of this clever circuit solution is to equalize the gains of its two inputs since the gain of the non-inverting input is one unit larger than the gain of the inverting input. We can do it in two ways:

• By connecting a non-inverting amplifier before the inverting input (it needs another op-amp and resistors).

• By connecting an attenuator before the non-inverting input (it needs only two resistors).

Of course, we choose the second solution...

## Third story

But at some point they realized that the simple 4-resistor solution had a significant drawback - it was influenced by the internal resistance of the input sources. Then they remembered the more complex solution with an additional op-amp... and decided to use it. They called it "instrumentation amplifier":

Answered by Circuit fantasist on August 27, 2020

It is not hard to show that the output voltage of your circuit is:

$$text{V}_text{out}=text{V}_2cdotfrac{text{R}_text{g}}{text{R}_2+text{R}_text{g}}cdotfrac{text{R}_1+text{R}_text{f}}{text{R}_1}-text{V}_1cdotfrac{text{R}_text{f}}{text{R}_1}tag1$$

So, when we make $$text{R}:=text{R}_text{f}=text{R}_1$$ we get:

$$text{V}_text{out}=text{V}_2cdotfrac{text{R}_text{g}}{text{R}_2+text{R}_text{g}}cdotfrac{text{R}+text{R}}{text{R}}-text{V}_1cdotfrac{text{R}}{text{R}}tag2$$

Simplifying gives:

$$text{V}_text{out}=text{V}_2cdotfrac{2text{R}_text{g}}{text{R}_2+text{R}_text{g}}-text{V}_1tag3$$

So, we need:

$$frac{2text{R}_text{g}}{text{R}_2+text{R}_text{g}}=1spaceLongleftrightarrowspace2text{R}_text{g}=text{R}_2+text{R}_text{g}spaceLongleftrightarrowspacetext{R}_text{g}=text{R}_2:=text{k}tag4$$

So, we get:

$$text{V}_text{out}=text{V}_2cdotfrac{2text{k}}{text{k}+text{k}}-text{V}_1tag5$$

Simplifying gives:

$$text{V}_text{out}=text{V}_2-text{V}_1tag6$$

So, we need $$text{R}_text{g}=text{R}_2$$ and $$text{R}_text{f}=text{R}_1$$.

Answered by Jan on August 27, 2020

Using the superposition theorem: -

The gain through the inverting "channel" is $$dfrac{R_f}{R_1}$$

So, make $$R_f = R_1$$ to get an amplification of minus one.

The gain through the non-inverting "channel" is $$dfrac{R_g}{R_2+R_g}cdot (1+dfrac{R_f}{R_1})$$

So, if $$R_f = R_1$$ (as per above) then the non-inverting gain is $$dfrac{2cdot R_g}{R_2+R_g}$$

Hence for a non-inverting unity gain, make $$R_2 = R_g$$

Answered by Andy aka on August 27, 2020

We set the gain of a differential amplifier to unity (well, +1 from non-inverting input, -1 from inverting input), so that it 'doesn't amplify', while taking the difference between its inputs. For a conventional diff-amp, this means all four resistors equal.

Answered by Neil_UK on August 27, 2020

## Related Questions

### Do I need OD/OC/OV Protection for Small LiPo Batteries with a Protection PCB already?

1  Asked on October 29, 2021

### Zener Diode Reverse Current

3  Asked on October 29, 2021

### Two different ways to open a project in IDE’s for MCUs

1  Asked on October 29, 2021 by homecloud

### How does load resistance affect RC low pass filter?

3  Asked on October 29, 2021

### Is it possible to charge a laptop with a DC-DC converter using a 12V deep cycle battery

2  Asked on October 29, 2021 by john-zenith

### How to choose TVS/ ESD for sensitive application?

1  Asked on October 29, 2021 by kobi89

### Non-shorting SPDT switch using MOSFETs

1  Asked on October 29, 2021

### Microcontroller Current Consumption when different internal and external clock modules are used simultaneously

1  Asked on October 29, 2021

### What’s the device – S4L85H1X01 IC by Samsung?

0  Asked on October 29, 2021

### Interpreting pinout and the transfer function for this sensor from its datasheet

1  Asked on October 29, 2021

### Type-C Non-Negotiated Power and 20V protection

3  Asked on October 29, 2021

### Relay and wifi module

1  Asked on March 4, 2021 by thaaoblues

### How do I connect a 0-10V analog input to MCU with high input impedance?

2  Asked on March 3, 2021 by masoud

### Switched Mono jack + battery: Make circuit when plugged in

1  Asked on March 2, 2021 by javier-mejias

### compare half-bridge drivers IC for maximizing the quality/price

1  Asked on March 1, 2021 by hamid-s-k

### MOSFET differential pair with feedback

1  Asked on February 28, 2021 by jtaft121

### Newbie question about BMS boards and 18650 cells

1  Asked on February 28, 2021 by kercap

### Schottky diodes as full bridge rectifier

1  Asked on February 27, 2021 by electronicsnoob

### Will this DC UPS with off the shelf components for home network and laptop work?

1  Asked on February 26, 2021 by rej

### LTspice simulation doesn’t agree with predicted transfer function

2  Asked on February 26, 2021 by walden-marshall

Get help from others!