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:
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.
So it now appears to do what I want.