# Peak detector circuit operation

So I understand that the capacitor charges up to the peak voltage and remains there since it cannot discharge due to the diode. But when I reduce the voltage on the input, the capacitor voltage also reduces, but it cannot discharge since there is no path. So how does it reduce its voltage ?

• Do you have any load on the output? The capacitor is not perfect and will self discharge over time. Your diode also has some leakage too. Aug 5, 2017 at 14:38
• I have it connected to the ADC of a microcontroller Aug 5, 2017 at 15:04
• Your ADC is not a perfect infinite resistance, some current will be taken in order to measure the voltage. You can't measure something without taking a piece of it. Aug 5, 2017 at 16:02

But when I reduce the voltage on the input, the capacitor voltage also reduces, but it cannot discharge since there is no path. So how does it reduce its voltage?

It is not clear from your question whether you are observing this on a test setup or in a simulation. If you are using a multimeter with an imput impedance of 10 MΩ across a 0.1 µF capacitor then the discharge time can be calculated by $\tau = {RC} = {0.1 \mu \times 10M} = 1 \;s$. In 1 s the voltage will have discharged by 63%, in 3 s it will have decreased by 95% and in 5 s it will have discharged by 99%.

• Oops! I don't know what I was thinking and the fact that the maths worked out to unity didn't alert me to the inversion. Fixed, thanks. Aug 5, 2017 at 16:31

But when I reduce the voltage on the input, the capacitor voltage also reduces, but it cannot discharge since there is no path. So how does it reduce its voltage ?

It can discharge, but very slowly, through the reverse leakage curent of the diode.

Or possibly it can discharge through whatever circuit is connected to the right of the snippet of schematic you shared.

If you want to force the capacitor to discharge, you can connect an N-channel MOSFET in parallel with the capacitor, and drive its gate high whenever you want to discharge the capacitor.

The ADC needs some charge, to take a measurement.

The charge per sample is Csample * Vinput.

Scaling that by the sample rate per second, we get current, thus

$$Current = Fsample * Csample * Vinput$$

To compute Rin, we used Ohms Law: Rin = Vin / Iin, or in this case

$$Rin = Vinput / ( Fsample * Csample * Vinput)$$

which becomes $$1/F*C$$

For example, let Csample be 10pF, Fsample be 1MHz. The Rin is just 1/F*S or $$1/(1MHz * 10pF)$$ or 1/(1e6 * 1e-11) or 1/1e-5 = 100,000 Ohms.

The timeconstant of 0.1uF and 100,000 Ohms is 10 milliSeconds.

A slower sampling, for example at 1KHz, has numbers of 0.1uF and 100,000,000 Ohms, producing a timeconstant of 10 seconds assuming no leakage in diode, in capacitor, or ADC input ESD diodes or the PCB.