15
\$\begingroup\$

I'm essentially a digital guy, and am used to using a comparator to compare two voltages and give a high or low depending on their relative values.

Now instead I want to subtract one voltage from another, and have the difference be available as an output.

I breadboarded the following circuit, but it doesn't seem to work right:

enter image description here

I am using two op-amps as voltage-followers, and feeding them into the inverting and non-inverting inputs of another amp-amp. The quad op-amp chip (LM324) has a single supply (9v).

EDIT: see my comment to the accepted answer -- I was on the right track, but had a bent pin on one of the output pins.

Now, since I do not have a negative supply, so the output cannot go negative, what I really want is for the output to be biased by +2.5 volts, so that if both pots are set midway the output will be 2.5v, not zero. Instead of adding the resistor from pin 12 to ground, I tried putting a 4.7K resistor from the non-inverting input (pin 12) to a 2.5v reference, and that seems to add in the offset I wanted.

enter image description here

So it now appears to do what I want.

\$\endgroup\$
  • \$\begingroup\$ The drawn circuit does not produce the difference between the two voltages V3 − V5. It produces 2⋅V3 − V5. You need the divider on pin 12 to make them equal. What voltages out do you get for the voltages you put in? \$\endgroup\$ – endolith Aug 15 '11 at 20:20
  • 1
    \$\begingroup\$ If you fix the circuit as outlined below, you will have succeeded in creating an instrumentation amplifier with a gain of 1. \$\endgroup\$ – Mike DeSimone Aug 16 '11 at 0:09
  • \$\begingroup\$ @davidcary then I used my iPhone to take a picture of it so I could post it After I did my edit, with the modified circuit, rather than drawing a new one (since I no longer had the original) I used copy and paste in Paint to add the offset resistor going down to 2.5v. \$\endgroup\$ – tcrosley May 22 '12 at 16:11
14
\$\begingroup\$

This should work, but usually there's also a resistor from the non-inverting input to ground:

enter image description here

If \$\dfrac{R4}{R2} = \dfrac{R3}{R1}\$ then:

\$V_{OUT} = \dfrac{R_{3}}{R_{1}} \times (V_{IN+} - V_{IN-})\$

To minimize offset error both inputs have to see the same impedance, and therefore \$R1 = R2\$ and \$R3 = R4\$.
Omitting R4 will only give a scaling factor for the voltage on the non-inverting input, namely:

\$V_{OUT} = 2 \times V_{IN+} - V_{IN-}\$

but changing the setting for the lower potmeter should definitely have a result in the output. Did you measure the voltages on both inputs?

What happens if you set the lower voltage to 2.5V and the upper to 1V? The inverting input should also be 2.5V, and the output 4V. What do you measure?

Note: especially the lower voltage follower is not necessary in your version; the opamp's input current is low enough to be negligible for most uses, and by the way, you're connecting the potmeter's wiper to an exactly same input!


Further reading
differential amplifier tutorial (interesting site overall!)

\$\endgroup\$
  • \$\begingroup\$ I'll try your suggestion tonight. I was able to measure the change of voltage on the output of the bottom V.F. (pin 1), but the input to the final op-amp (pin 12), i.e. the other side of the 4.7K resistor didn't change. I double-checked my wiring because I thought that was odd. The reason I used the voltage followers, was I thought maybe it was better to have an identical load on the inputs of the differential amp regardless of the pot settings. \$\endgroup\$ – tcrosley Aug 15 '11 at 19:19
  • 1
    \$\begingroup\$ I tried playing around with it some more, with no success. Finally I decided maybe I should switch op-amps, just in case. When I pulled out the chip, it turned out pin 14 was bent under the chip and was not making contact with the breadboard, so I was just measuring the inverted input voltage, not the output! With the resistor to ground, it is now working as described above. And with R4 connected to 2.5v, I get a 2.5v offset in the output as desired. \$\endgroup\$ – tcrosley Aug 16 '11 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.