Electrical – How Do I Calculate The discharge Time of Capacitor with a resistor as a load

capacitor

I was trying to make an ADC with an RC circuit. I was using an ATMEGA328P to measure the time the capacitor needed to discharge to 0V. I created the circuit with a sample and hold opamp, a precision 1uF Cap, and a 10K precision Resistor.
I was trying to find out the formula to calculate the capacitor original charged voltage with the time constant I get from my microcontroller and my known resistor and capacitor value.
Is there any way/formula to calculate it?

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

If the capacitor is charged to voltage \$V_0\$ it will take

\$R C\$ (R in ohms, C in farads) seconds to discharge to \$V_0\over e\$ \$\approx 0.368 V_0. \$

It (in theory) will never get to 0V.

If you are timing it, you will get diminishing returns by triggering on much less than about that number as the curve flattens so your reading will be more sensitive to noise.