Electrical – How to store the difference of 2 voltages on capacitor

adccapacitormixed-signalvlsivoltage

Suppose we have two voltages V1 and V2 how can we store the voltage difference (V1-V2) on a given capacitor?
I tried charging the top plate of the capacitor to V1 and then charged the bottom plate of the capacitor to V2. but the value of the voltage across the capacitor is not V1-V2, how can we do this?

Basically I want to perform subtraction of 2 voltages, with a simple circuit which does not consume much power and area

Best Answer

This is standard technique and quite a good way to subtract voltages, as long as they are static/slow moving.

You use analog switches to first connect your capacitor between V1 and V2, now VCAP = V1-V2. Then you switch the capacitor to ground. Now you have V1-V2 referenced to ground. C2 holds the voltage on the output, while the capacitor is sampling. It takes some cycles for the voltages to reach equilibrium.

It is really useful if you are using an ADC in a micro, your ADC can sample the voltage when you switch to single ended, and your micro can control the switches. (C2 is not needed)

This has a lower parts count and low supply current, and lower cost than differential amplifiers. Matched resistors are not needed. It can also have far better balance/common mode performance than a simple opamp differential arrangement.

CD4053 can be used for voltages up to 18V, and 74HC4053 for voltages up to 6V (and both will work with -ve voltages) Other analog switches allow higher voltages, and you can use discrete fets, or opto-fets to do this at hundreds of volts.

schematic

simulate this circuit – Schematic created using CircuitLab

This technique is also very good with tiny input voltages, e.g thermocouples, as you can use an AC amplifier to eliminate drift and offset. e.g here we use an LM358 (filthy cheap, big offset and drift) to measure thermocouple voltages, in the presence of a large offset V2. Even though the gain is 1000, the offset is only uV at the input. This can be subtracted by the micro.

schematic

simulate this circuit