How to calculate simple peak detector capacitance and resistance values?

muyustan

Joined Nov 29, 2019
10

While designing such a peak detector, what should be the approach of choosing C and R values? Which specs of the detector will be based on them? I assume their values will be depending upon the frequency of incoming signal, and related to time constant of RC network. But, I need some better understanding.

dl324

Joined Mar 30, 2015
11,282
I'd use something like this from the 1994 National Semiconductor Linear Applications Handbook:

C2 is the storage cap and need to be low leakage. C1 is compensation for the opamp.

TeeKay6

Joined Apr 20, 2019
572

dl324

Joined Mar 30, 2015
11,282
This circuit provides no discharge of the holding cap.
A peak detector doesn't need to have the capacitor discharged.

TeeKay6

Joined Apr 20, 2019
572
A peak detector doesn't need to have the capacitor discharged.
It does if you want to detect more than one peak...and in my experience that is generally the case. Also, T.S. indicated a discharge resistor in his starting post. I am merely trying to highlight what I think the T.S. was looking for.

dl324

Joined Mar 30, 2015
11,282
It does if you want to detect more than one peak...and in my experience that is generally the case. Also, T.S. indicated a discharge resistor in his starting post.
It's simple to modify the circuit to be able to discharge the capacitor.

AnalogKid

Joined Aug 1, 2013
8,536
Without knowing the characteristics of the signal being detected and the circuits that the output is driving, it is very hard to give specific advice.

In very round numbers, a peak detector is a type of low pass filter. R73 discharges the holding capacitor slowly between peaks, and how much discharge is acceptable is entirely up to you. that discharge looks like ripple if the input is periodic and relatively steady in amplitude, so the R and C values set the peak-to-peak amplitude of the ripple.

ak

Audioguru again

Joined Oct 21, 2019
1,767
Of course a peak detector capacitor needs a discharge path if the input signal has a varying level.
The circuit shown here uses a very slow rectifier instead of a fast diode like a 1N4148.

For my Sound level meter, I have a 330nF capacitor charged quickly by a transistor emitter-follower used as the diode then a 330nF discharge resistance for a discharge time constant of 109ms which is long enough for me to see the peak.

TeeKay6

Joined Apr 20, 2019
572
View attachment 194740

While designing such a peak detector, what should be the approach of choosing C and R values? Which specs of the detector will be based on them? I assume their values will be depending upon the frequency of incoming signal, and related to time constant of RC network. But, I need some better understanding.

@muyustan
No one can give you a simple explanation; the task is too complex to answer in a few sentences. Try searching AAC for "peak detector"; if you don't find enough info there, then do a web search for "peak detector". After you've done a bit of study, if you have specific questions, then post here again with those questions.

KW_KW

Joined Dec 18, 2019
9
Given "simple", implying that the limitations of that circuit are acceptable, then you need to know...

What is the lowest frequency you need to detect the peak of?
How long do you need to hold the peak for?
What is the output impedance driving the circuit?

Assuming reasonable (op amp, audio) values for all the above, the resistor needs to be large enough to not load down the source impedance, but at least an order of magnitude lower than the input impedance of the following circuit, and likewise lower than the leakage resistance of the capacitor (mostly relevant for electrolytics).

Pick a resistor value between 10k and 100k unless you have a reason for a higher or lower value. I'm assuming an op amp or low-impedance solid-state circuit driving this, and a high-impedance buffer of some sort reading the hold voltage. Below 10k can load down op amps, although down to 1k may work. Higher than about 1MEG starts to place demands on the quality of the buffer following the circuit.

Calculate the capacitor by setting the RC product below your lowest frequency and longer than your hold time. If this isn't possible because they overlap, you need a fancier circuit. Choose a diode that can handle the maximum peak current (typically limited by what is driving the circuit) and that doesn't have an unreasonable amount of leakage relative to your circuit (i.e. if you chose a 10 meg resistor for some reason, you'll need a lower leakage diode for it to work well, especially at high temperatures where leakage currents go up).

muyustan

Joined Nov 29, 2019
10
Given "simple", implying that the limitations of that circuit are acceptable, then you need to know...

What is the lowest frequency you need to detect the peak of?
How long do you need to hold the peak for?
What is the output impedance driving the circuit?

Assuming reasonable (op amp, audio) values for all the above, the resistor needs to be large enough to not load down the source impedance, but at least an order of magnitude lower than the input impedance of the following circuit, and likewise lower than the leakage resistance of the capacitor (mostly relevant for electrolytics).

Pick a resistor value between 10k and 100k unless you have a reason for a higher or lower value. I'm assuming an op amp or low-impedance solid-state circuit driving this, and a high-impedance buffer of some sort reading the hold voltage. Below 10k can load down op amps, although down to 1k may work. Higher than about 1MEG starts to place demands on the quality of the buffer following the circuit.

Calculate the capacitor by setting the RC product below your lowest frequency and longer than your hold time. If this isn't possible because they overlap, you need a fancier circuit. Choose a diode that can handle the maximum peak current (typically limited by what is driving the circuit) and that doesn't have an unreasonable amount of leakage relative to your circuit (i.e. if you chose a 10 meg resistor for some reason, you'll need a lower leakage diode for it to work well, especially at high temperatures where leakage currents go up).
Well, thanks for the answer, your assumptions are close enough! The signal will be coming from an active filter , and the peak value will go to an opAmp used as comparator. So your low and high impedance guesses are correct, I assume. My freqs are between 1k to 2k Hertz. So, assuming R=47k, R*C should be somewhat higher than 1ms(period at 1kHz, lowest freq) so that the capacitor does not discharge between two input signal cycles. So, for R*C = 4.7 ms, C=0.1 uF should be chosen.

Did I get you right? Am I correct in my calculations? Besides, I did not understand "longer than your hold time". If it is related to being able to "remember" the peak value after the incoming signal is lost, then this is not needed in my situation, rather I prefer fast switching between the peak values. In total, there will be 3 possible peak values at different freqs. Once the peaks changed, I would prefer the peak detector to adapt itself to new peak value, rather than "holding" the previous one.

KW_KW

Joined Dec 18, 2019
9
Yep. You got it, in general. There is an 0.6v diode drop we're ignoring, so your peak will measure a bit low.

That detector is going to have an exponential decay from any peak it detects. You can't do anything about that without a fancier circuit, but you can choose the decay time. If you're feeding a comparator, you need the decay time long enough that it doesn't drop below the comparator trip voltage between cycles, but drops as fast as possible beyond that.

You definitely don't want like a second or so, although if it were feeding, say, a VU meter, you would. 3 to 10ms would be about right, depending on your comparator. And remember that one exponential time constant drops the voltage to 37% of the starting voltage. If that's too much for your comparator, you have to have a longer decay time, hence the 10ms suggestion.

So "hold time" is defined as the time between when the voltage starts dropping and when your comparator trips, and that time is dependent on the comparator voltage as well as the RC time constant. Your comparator will be "held" on for that length of time.

Audioguru again

Joined Oct 21, 2019
1,767
For the audio peak detector in my LEDs bargraph displayed audio indicator, I used transistors to charge the capacitor very quickly. The second transistor cancels the voltage drop of the first transistor. You can use slower diodes to do it instead.

Attachments

• 20.9 KB Views: 9

muyustan

Joined Nov 29, 2019
10
For the audio peak detector in my LEDs bargraph displayed audio indicator, I used transistors to charge the capacitor very quickly. The second transistor cancels the voltage drop of the first transistor. You can use slower diodes to do it instead.
Where do you give then input and get the output(peak value) in this circuit? Also what is the connection of C4?

Audioguru again

Joined Oct 21, 2019
1,767
C4 is the audio input capacitor. Since the circuit has no negative power supply then the opamp (MC33171 or one opamp in an LM358) is one that works when its inputs are at 0V and this opamp is inverting so the output goes positive when the audio input swings to a negative part of the audio input.

muyustan

Joined Nov 29, 2019
10
is one that works when its inputs are at 0V
I could not understand this part actually, is there something missing in that sentence?

Audioguru again

Joined Oct 21, 2019
1,767
I used an opamp that works properly when its inputs are at 0V when there is no negative supply voltage. It is called a "single supply opamp".
Many ordinary opamps like an old 741 have inputs that do not work if their voltage is within about 4V from the negative supply voltage, so they need a dual polarity supply that has a negative supply, then when the inputs are at 0V they are volts above the negative supply voltage and then the inputs work properly.

muyustan

Joined Nov 29, 2019
10
I used an opamp that works properly when its inputs are at 0V when there is no negative supply voltage. It is called a "single supply opamp".
Many ordinary opamps like an old 741 have inputs that do not work if their voltage is within about 4V from the negative supply voltage, so they need a dual polarity supply that has a negative supply, then when the inputs are at 0V they are volts above the negative supply voltage and then the inputs work properly.
By the inputs of an opamp, you mean inverting or non-inverting inputs, right? Then, with an LM741 supplied by +/- 9V ; which voltage range this "not working properly" region correspondes to? Either I am not in my day or my english does not enough to fully understand your sentences.

Audioguru again

Joined Oct 21, 2019
1,767
A 741 opamp design is 52 years old. Its datasheet has most spec's when it has a +/-15V supply where its inputs work between +/-12V. Therefore its minimum recommended supply is +/-10V. With your +/-9V supply its inputs work properly from -6V to +6V.