# Trying to develop a peak detector circuit

The circuit below has as an input a sound wave that is amplified (the op amp used is an ideal one) that then goes through a peak detector circuit. I intended to implement part of this circuit using breadboards but my problem is the capacitor C1 value.

With C1 equal to 1u (biggest capacitor I have) the output signal looks like this:

It doesn't really detect anything. What should I do if I don't capacitors with higher capacitance?

If C1 is equal to 3u:

It's better but not good enough. In the first 350ms the output signal is always 1.5V for some reason when it should be close to 1V or just following the peak values.

When C1 is 100u:

This one is the best so far but there is just one thing that annoys me is that the output seems to only follow the local maximum, when the input gets considerably lower the output just keeps whatever value it had before till the input surpasses that value.

This is from another circuit that I found:

The op amp from the peak detector is connected to Vcc.

The output of the peak detector appears to be more well behaved than mine, perhaps because the input signal has a bigger frequency? Anyway, that circuit still has a large capacitor value (50u) that I don't have.

• What is your question? Commented Nov 30, 2022 at 0:30
• What should i do if i dont capacitors with higher capacitance? Because i have no more than 1u capacitors. Also the first circuit compared to the second circuit the output of the peak detector seems to behave different and i'm not sure why Commented Nov 30, 2022 at 0:36
• You probably don't really need a larger capacitor, but any serious experimenter or hobbyist should have a bunch of higher value capacitors, either purchased in a kit or scrounged from junk electronics. And it really should be a film or maybe ceramic type with low dielectric absorption factor. Polyethylene, polyester, polycarbonate, and polypropylene are best. Commented Nov 30, 2022 at 5:30
• What you have described is what a peak detector does. What you have in screen shots is what I would expect from your circuit and a peak detector. It detects a peak on the first waveform when you think it doesn't. Maybe you want something other than a peak detector? I mean, if it detects a peak of 3 volts, the output will remain at 3 volts unless some signal comes along that has a peak greater than 3 volts. This is what they do. I think you want something else if you are not happy with it. Commented Nov 30, 2022 at 8:38

Why are the parts on your schematic so far apart? Your capacitor is missing a resistor parallel with it to discharge the capacitor between sounds. Audio opamps work much better when they are biased at half the supply voltage. I do not have your WAV file. I reduced the spacing on your schematic:

• I followed this video in minute 5:00 : youtube.com/… . There's no parallel resistor. And also here: sound-au.com/appnotes/an014.htm. The 0.5V are just there to put vPreAmp2 voltage always positive, if i put 2.5V the output of the real OP amps will be clipped because they cant handle more than 5V Commented Nov 30, 2022 at 1:43

You probably want a peak detector with decay, you don't want to hold the peak "forever". You need a resistor across C1. You probably also want a resistor in series with C1 so the the opamp doesn't have to drive a high capacitance.

D2 is optional. D2 helps the opamp come out of saturation after the negative cycle. Depending on the speed of your opamp, this can be a problem.

The decay time constant is 10 ms. I have found this to be a good value for sound activated lights.

simulate this circuit – Schematic created using CircuitLab

It looks like the simulator is trying to guess the starting voltage of the capacitor (the so-called "DC operating point") and when the capacitor is larger it guesses a bigger value. If you put a resistor in parallel with the capacitor - even a really big resistor - it will probably guess zero volts.

Your circuit (made from ideal components) is able to hold a voltage forever, so the simulator has no idea what the voltage would have been before the simulation started, and is forced to guess.

Any real capacitor will have some leakage, so it won't hold its voltage forever in the real world, but it will hold it for quite a long time (possibly days, but less if it discharges slowly through U1 or U2). When you turn the circuit on it may still remember the peak from the last time you turned it off. Is this what you want? If not then you need to add a resistor to make the circuit slowly "forget" the peaks.