# Conflicting impedancies in peak detector

Here a circuit :

Here is a scope view of what I get before the diode (in blue : input, in yellow : output of the Op Amp):

The opamp saturates almost everytime. There is just a small time where the signal is non-zero due to the presence of the capacity (when I get it off, everything is okay at the output of the opamp (always before diode) ; when I put a resistance before the capacity, everything is okay also). But I can't explain more. Someone to help me?

The circuit performs well in any case, it is just a wonder of comprehension.

-
The other trace's colour seems like orange to me? –  abdullah kahraman May 15 '12 at 3:05

You have a correctly connected positive peak detector that seems to be functioning correctly.

When you put in a sine wave with a period much less than the peak decay time constant of the output, the output will be above what the opamp is trying to drive it to most of the time. During that time the opamp is trying to drive the output low, but it can't because of the diode. It therefore saturates to the lowest output it can produce. During this part of the cycle, the output will decay a little towards ground.

As a result of the output decay while the input is low, when the input reaches its peak the output will be a little less than what it should be, so the opamp output goes up and current flows thru the diode. At this point the output tracks the input. When the input goes down again the output stays up, the opamp output slams low, and the cycle repeats.

It would be instructive to look at Vs also. At the resolution of the traces you show, it probably will look flat and just a little below the levels of the peaks of the yellow trace. If you AC couple it and expand the voltage scale, you should see it go up sharply by a small step each cycle, then a linear ramp down between the steps. Even at the lowest gain setting when you have the shortest output time constant, that time constant is 200 ms. Your signal has period of less than 1 ms, so there will only be a small decay between the peaks of the input cycle. This is exactly what we are seeing the opamp do.

-

Also, don't forget that you are getting amplification from the non-inverting amplifier configuration here -- currently a gain of (R20+R21+R22)/(R21+R22) = 12, according to your original schematic. If your input is truly a ~5Vpp sine wave, and your op-amp appears to be powered from +/-15V, your peak detector is quickly going to saturate at the upper rail and you won't be seeing the intended behavior.

I've drawn your active peak detector circuit but set the gain to 1, and added an explicit load resistance for discharge (although the capacitor also discharges through the feedback path as well):

And here's what the voltages look like:

Looks a lot like your oscilloscope capture! You can see how V(prediode) is stuck to the negative output rail most of the time, but occasionally pumps a bit of charge through the diode to top off the capacitor. If you open the circuit, open it in the editor, and press F5, you'll see this plot and will be able to mouse over or zoom in to the V(out) line, and see the discharge that Olin mentioned (looking at Vs -- small step up, then slow discharge down, then repeat). The simulator also lets us plot the current into the diode, which may be instructive here:

-