Electronic – RC peak detector calculation

accapacitorcircuit-designresistorssensor

enter image description here

Before the edit was made

I have a signal that is an AC signal and I would like to track its envelope. I'm not doing AM, I'm trying to make a transducer for my sensor. Frequency is constant but amplitude changes from 1 to 3 volts based upon value from the sensor. I would like for the output voltage to be able to follow changes of the input in maximum of 300ms while having minimal ripple. I would like to calculate values for R and C and not guess them. All of the calculations I have found were about AM but I don't really have a carrier signal.


Edit: It looks like I have made a mistake and mixed some terms. Sorry for wasting some of yours time. I was looking for a peak detector actually. Diode voltage drop does not bother me. I was looking on how to calculate R and C, for an input signal of 770 Hz with an amplitude ranging from 1V to 3V, so that the output reaches peak within maximum of 300ms. I would like a somewhat realtime measurement so that's why 300ms but preferiably in much less time with again somewhat smooth voltage level.


Edit: changed the title from "Envelope detector circuit" to "RC peak detector calculation"

Best Answer

Here’s what the math looks like for your example.

The worst case (fastest changing) is if your input suddenly changes from 3V rms (4.2V peak) to 1V rms (1.4V peak). In that case you want your detector to pick up the new peak in no more than 300ms.

Ignoring the diode drop, the capacitor will be charged to 4.2V and then start an exponential decay towards zero until the new peak at 1.4V is hit at which point the cap will stay charged there.

If I did my math right (below) the RC time constant should be .27, so C=1uF and R=270K would work. (If you want to take into account the diode drop, subtract 0.6 from the 4.2V and 1.4V in the equation.)

enter image description here

enter image description here

This is the maximum RC to meet your 300ms spec: anything larger, it would take longer than 300ms to find new peak.

The minimum RC would be if you want the peak detector to track as fast as possible. In this case, the fastest it needs to track is a drop from 4.2V peak to 1.4V peak in one period of your 770Hz signal (which has a period of 1.3ms). enter image description here

Use the same formula with t=.0013 to get an RC of .0012 for this quick delay. If RC made any smaller than this, it’s moving faster than it needs to.

So your desired RC is bounded between .0013 (fast but lots of ripple) and 0.27 (slow but no ripple).