# How to 'tune' output from differential amp

I'm trying to use an opamp (LM324N) to measure the voltage between its 2 inputs. The simple circuit is attached. What I find is that the voltage measured at Vout is always 'off' by a significant amount, say around 100mV. I've tried replacing the various resistors R1 thru R4 with a 25 turn 10 kΩ trimpots but I have not been able to find a setting that would raise Vout to the same voltage as the inputs. For example, an input voltage of 3.2 V will give a Vout of around 3.1 V. Is there a way I can add some bias or compensation to 'tune' the circuit to give the correct output? While the example shows input voltages of 0 V and 3.2 V, this is just for demonstration. In reality, while the input voltages will never differ by more than 4 V, they can be any combination of voltages from 0 to 16 V, e.g. 5 and 8.2 V or 10.5 and 13 V.

Thanks for any guidance on this.

• Vout would not be measured as 100 mA. That's more like what you'd measure with a dead short caused by using a ammeter, which can read such values. Did you miss-type? Also, what's the opamp? Commented Jul 26, 2023 at 0:29
• Maybe it's a wrong opamp. But which opamp it even is, and why it does not have bypass caps? OK LM324 it is. Is the supply really 18V? Commented Jul 26, 2023 at 0:31
• Any combination of voltages won't work- the circuit can't output negative voltages and it can't even necessarily reliably get below about 0.7V on the output. It also can't get really close to the positive supply voltage (which should not be a problem if the supply is actually 18V and the difference does not exceed 4V). Commented Jul 26, 2023 at 0:41
• Vout = 100 mA is an error in terminolgy - what are you using to mesure Vout and what VOLTGE error do you get? We cn help but we ned the problem to be defined well Commented Jul 26, 2023 at 3:09
• LM324 is not a true ril to rail output amplifier. PLace a load on the output to get closer to ground. Say in 1k to 10k range to start, Commented Jul 26, 2023 at 3:10

Referring to an LM324-N datasheet, as long as the inputs are within the allowable voltage range, and the output voltage swing is within the allowable range, the differentially configured op-amp should perform over the range indicated in the question.

There are two sources of error circuit error:

1. The example voltages of 3.2 desired and 3.1 measured represents an error of approximately 3%. This can be expected with 5% resistors. Use precision resistors if you want accurate results.
2. The output resistance of the sources must be included as in series with R1 and R2. Signal generators usually have a source resistance of 50 ohms. If a potentiometer is being used as to vary the input voltage them the error will be significant. If the sources have a measurable resistance then buffer them or increase the differential amplifier resistances. The datasheet image shows a setup similar to yours using 1M$$\\Omega\$$ resistors

The input offset voltage is max 3mV. It could be positive or negative. If the precision of the measurement is high, then this voltage requires compensation.

The input voltages must not become negative. THe datasheet has protection advice.

The output voltage must not (can not) swing below 20mV. So 20mV is the minimum voltage difference of the inputs.

Finally, always decouple VCC with a capacitor to ground close to the VCC pin. Always "tie-off" the unused amplifiers in the chip. Vout connect to V-, V+ to ground. Even if just testing a theory.

• Very informative - I will try again with more accurate resistors, and the circuit mod you suggest. Many thanks RussellH. Commented Jul 27, 2023 at 5:41

You will have common mode issues with a diff amp. Use an instrumentation amp with a wide common mode range.