Voltage divider with capacitor

I don't understand why in the circuit $$V_{saadc} = V_{ain}\cdot{(C_{ext} - C_{sample}) \over C_{ext}}.$$ Can anyone please help me to understand this equation?

https://devzone.nordicsemi.com/blogs/943/measuring-lithium-battery-voltage-with-nrf52/

This is a common trick.

Using high value resistors in your divider reduces current draw on the battery, so it's a good thing. However, SAR ADCs require the source impedance to be low enough so the voltage on the sampling capacitor ($$\C_{sample}\$$) is fully settled after sampling. This won't work with MOhm resistors.

So, you add $$\C_{ext}\$$. Before sampling, your resistors charge $$\C_{ext}\$$ to :

$$V_{ain} = V_{Batt} \times \frac{R2}{(R1+R2)}$$

Now, during sampling, we can suppose the resistors are large enough that all charge that goes into $$\C_{sample}\$$ comes from $$\C_{ext}\$$. The formula is the classical conservation of charge:

Before sampling,

• $$\C_{ext}\$$ contains a charge $$\q = V_{ain0} \times C_{ext}\$$
• $$\C_{sample}\$$ contains no charge (0V)

When the sampling is done, voltage in both caps is equalized, which means the original charge is now spread between both caps:

$$q = V_{ain1} \times (C_{ext} + C_{sample})$$

Voltage $$\V_{ain}\$$ went from $$\V_{ain0}\$$ to $$\V_{ain1}\$$:

$$q = V_{ain0} \times C_{ext} = V_{ain1} \times (C_{ext} + C_{sample})$$

Therefore:

$$V_{ain1} = V_{ain0} \times \frac{C_{ext}}{(C_{ext} + C_{sample})}$$

Since we choose $$\C_{ext}\$$ much bigger than $$\C_{sample}\$$, we can simplify:

$$\frac{\Delta(V_{ain})}{V_{ain}} = \frac{C_{sample}}{C_{ext}}$$

This means that if...

• you want 1 LSB (0.1%) error due to $$\C_{Sample}\$$ charging
• then you pick $$\C_{ext} > 1000 \times C_{Sample}\$$

I don't understand why in the circuit

it is called "charge transfer". basically the charges on Cext is transferred to both Cext and Csample once the switch is closed. The same charges on more capacitance -> lower voltage.

BTW, this approach can be used to detect touches in capacitive sensing.

Assume Tacq is the acquistion tome of the ADC during which it "reads" Cext. Call the intersample period Ts. Call the input filter time constant (see below) Tf.

Vain is initially set by R1 & R2, and Cext will charge to very close to that voltage. The two R's and C form a single pole low pass filter with time constant Tf of about (R1 // R2) x Cext.
The value of Cext is selected so the the RC time constant Tf of the input filter is much shorter than the inter-sample period Ts.
When the ADC input switch closes for Tacq the internal capacitor will be charged from Cext. The sample acquisition time is small compared to the input filter time constant (ie Tacq << Tf << Ts) so R1 & R2 have minimal affect on the voltage sampled. eg if Vbat suddenly double at the start of the acquisition time, Cext would vary only insignificantly during Tacq.

So, for practical purposes only Cext and Csample are involved during Tacq.
The charge on Cext must be shared between Cext and Csample.
Charge in a capacitor is indicated by Q = CV.
If Capacitance changes from C1 to C2 and the charge does not change then.
V1.C1 = V2.C2 or
V2 = V1.C1/C2.
In this case C1 = Cext and C2 = Cext + Csample s0 V2 = V1 x Cext / (Cext + Csample)

WHen Csample is >> Cext (which is always the case in order to minimise r=the voltage change seen here) then your formula and my one above are essentially identical in result. I'd argue that my answer was more correct and that they had made a minor derivation error (but I may be the one that's wrong :-) ).

If say Cs = 10 pF and Cext = 10 nF = 10,000 pF then.
(Cext-Cs)/Cext) = (10,000-10) / 10000 = 0.999 &
(Cext/(Cext+Cs) = 10,000/(10,000 + 10) = 0.999001 = 0.00001% higher

BUT

Neither result is actually correct.
In practice, when a capacitor is discharged energy is lost due to I^2 x R resistive energy loss in the connecting circuit.
This effect CANNOT be overcome by using very low resistance connections (or very high resistance ones) - if Vconnect is low then the connection currents are very high and losses may be even higher.
If Vinitial is close to Vfinal the energy loss is small and can be ignored in most cases like this. But it pays to be aware of the affect as in some systems it leads to very significant energy loss.

|

• Charge redistribution does not suffer from an error due to energy lost. Mar 12, 2017 at 10:17
• thanks for your complete answer it's been a big help now I understand all Mar 12, 2017 at 22:14
• @Andy en aide of makinhing one's head explode :-) - av8n.com/physics/capacitor-transfer.htm Mar 13, 2017 at 2:08
• @Andy - I suspect you may not have assimilated the page :-). While the writer is "a member of the scientific establishment" [tm] he attempts here to turn some concepts on their head. Or give them new heads. He identifies a quantity which he calls "Gorge" which is ~= mod|charge|. He then uses it instead of charge and works some magic. Sample comment: "The energy-transfer efficiency can approach 100%, and the gorge-transfer efficiency can easily exceed 100%.". Mar 13, 2017 at 11:35

When the switch closes charge held on Cext redistributes to both capacitors. This slightly lowers the voltage to the amount in the formula.

The formula assumes that Csample had no charge prior to the switch closure. Can you work it out from this given that Q=CV?

• Noting that for Cs << Cext (usually the case) Qfinal is close to Qinitial, but energy is always lost and for Csample say 10% or even 2% of Cext energy losses start to couny when precision is needed. Mar 12, 2017 at 10:11
• Energy is lost but charge isn't lost and that's why using charge gives you the correct answer for any ratio of capacitors. Mar 12, 2017 at 10:15
• What is still missing is average current taken by sample capacitor. Anytime it's switched in will take $$Q_\text{sample}=C_\text{sample}V_\text{ain}$$ charge. Doing so once every $$T_\text{s}$$ seconds yields an average current $$I_\text{ain}=C_\text{sample}V_\text{ain}/T_\text{s}$$ which can be thought as a $$R_\text{in}=C_\text{sample}/T_\text{s}$$ resistance loading the voltage divider. In other words any sample you have the "sudden" drop above calculated using charge conservation but at time of next sample $$C_\text{ext}$$ voltage has not yet exactly recovered its asymptotic value. Mar 12, 2017 at 17:33
• @carloc I'm not sure I understand the point you are trying to make. I'm trying to explain the simplified formula in the question but what are you trying to explain. Maybe you should leave an answer instead of adding a confusing comment? Yes, I'm sure that everyone making an answer understands that theoretically, with a long sequence of switch cycles the resistors need to be accommodated into any formula but that's missing the point of the question. Just leave an answer if you want to get things off your chest. Mar 12, 2017 at 17:51
• I am sorry, I could copy the above in an answer but I basically believe that's not enough stuff for a good answer. It's just like a switched capacitor equivalent resistance. Average charge per time unit gives the average current into sampling capacitor. This current will drop average voltage out of voltage divider. Since this current is proportional to applied voltage it could be eventually accounted as resistance. Mar 13, 2017 at 20:54