.
You can find many more electronic circuits for beginners by clicking the link!

### Opamp Configurations - Difference Amplifier

Difference Amplifier

So far you've learned about how to make an opamp add an inverted (negative) voltage to a reference, and to add a positive voltage by setting the reference.

Since the opamp has two inputs, one inverting and one non inverting, it should be possible to use both at the same time to add them to one another, and since one will be inverted, the effect will be a difference of voltages.

This one is a bit trickier to derive equations for, since, as you already know, the voltage that will be applied to the non inverting input will also appear at the inverting input via the opamp trying to compensate.

Since we are using resistor ratios in the voltage divider to set the voltage at the non inverting input, the voltage at the inverting one will be in terms of those resistors as well, otherwise the equations are derived the same as for the inverting amplifier.

Vrin = Vin - Vinv
IinRin = Vin - Vinv => Iin = (Vin - Vinv)/Rin
Same as last time, except Vinv is non zero, set by the voltage divider. Applying the current rule:
Iin = Ifb, Ifb is the feedback current.
Ifb = (Vinv - Vout)/Rfb
Vinv is not tied to ground, so it can't be simplified more at this point. We also have
Iin = Ifb => (Vin - Vinv)/Rin = (Vinv - Vout)/Rfb
Expressed in terms of Vout, this becomes
(Vin - Vinv) (Rfb/Rin) = Vinv - Vout
(Vin - Vinv) (Rfb/Rin) - Vinv = - Vout
Multiply both sides by -1
(-1)[(Vin - Vinv) (Rfb/Rin) - Vinv] = (-1)(- Vout)
- (Vin - Vinv) (Rfb/Rin) + Vinv = Vout
Vinv - (Vin - Vinv) (Rfb/Rin) = Vout
Now, since Vinv is in terms of the non inverting voltage, we have
Vninv = Vin2 R2 / (R1+R2)
And
Vinv  = Vninv => Vinv = Vin2 R2 / (R1+R2)
So we can rewrite our Vout equation now in terms of both input voltages
Vinv - (Vin - Vinv) (Rfb/Rin) = Vout
[Vin2 R2 / (R1+R2)] - (Vin - [Vin2 R2 / (R1+R2)]) [Rfb/Rin] = Vout
This seems complicated enough as it is, so from here we are going to simplify by making some assumptions. Lets make all resistors equal.
R = R1 = R2 = Rfb = Rin
The equation then becomes
[Vin2 R/2R] - (Vin - [Vin2 R/2R] [R/R] = Vout
Vin2 (1/2) - (Vin - [Vin2 (1/2)] [ 1/1 ] = Vout
Vin2 (1/2) - (Vin - [Vin2 (1/2)] = Vout
Vin2 (1/2) - (Vin - [Vin2 (1/2)] = Vout
Vin2 (1/2) - Vin + Vin2 (1/2) = Vout
Vin2 - Vin = Vout
As you can see, with our assumption of equal resistors, the output will be equal to the difference of voltages applied, the applied at the non inverting minus the one applied at the inverting. In practice if you use the same ratios of resistors, the relation holds. You could also use equal ratios (not precisely 1:1) to set the gain; if you use different ratios you will get a weighted difference.

## Welcome To Electronic Circuits For Beginners!

All circuits included here are recommended to be assembled in printed circuit boards. Printed circuit boards, or PCB's increase the circuit reliability and mechanical stability.

-

-

-

-

-

-

Led chaser circuit

-

-

-

Simple power supply

-

-

All circuits include parts list and complete How-it-works for beginners and hobbyists to easily understand.