Unexpected PEAK DETECTOR behaviour

Thread Starter

Rogare

Joined Mar 9, 2012
78
Hello! I'm using the peak detector circuit found here along with an LM358N op amp, a 10 uF capacitor, and an 1N4148 diode. It works absolutely fine for one of the two inputs I need it to:

4 V -----------------------------------
-------------|--------|-----------------
0 V ------------------------------------

It's a positive rectangular pulse, a couple hundred microseconds long. No problem. It takes a few hits of the input for the output to reach the peak (4 V), but that's fine.

However, when I try it with a bipolar input (see below) of about the same length, the output just climbs and climbs—far higher than the peak value.


2 V -----------------------------------
-------------|-\-------------------------
0 V -------------\--------------------
-------------|----\-|-----------------
-2 V ----------------------------------

Any ideas why this second input might drive the output so high? (Again, it's just fine if it takes a few of these short inputs to get the output up to the peak value—in this case 2V.) Thanks for reading!
 

ssnyde

Joined Apr 4, 2012
19
Hmm wierd. How high does it go? Does it hit the rail and sit there? Can you try a bipolar square wave instead of that triangle, and watch the output on a scope along with the input and see what the output does with respect to the input.

I just want to make sure I'm clear on how it is wired. A schematic would help but I'll describe how I envision it and correct me if I'm wrong. You have the circuit you linked to, Vcc on +8V, Vee on -8V and the capacitor to a ground that comes from the same supply which provides +/-8V. Then you have a function generator, whose negative terminal is also tied to this common ground, and it's other terminal going to the non-inverting op-amp terminal.
 

Brownout

Joined Jan 10, 2012
2,390
You may need to address stability in your design. The capacitor in the feedback circuit could possibly cause ringing. If you can scope the output of the amp, that would tell you alot, or if you can simulate the circuit with a good LM358 model. 10Uf is a big capacitor, and most likely an electrolytic, hence not the best for peak detection. I'd try a smaller poly cap, and find out about the ringing.
 

Ron H

Joined Apr 14, 2005
7,063
Hello! I'm using the peak detector circuit found here along with an LM358N op amp, a 10 uF capacitor, and an 1N4148 diode. It works absolutely fine for one of the two inputs I need it to:

4 V -----------------------------------
-------------|--------|-----------------
0 V ------------------------------------

It's a positive rectangular pulse, a couple hundred microseconds long. No problem. It takes a few hits of the input for the output to reach the peak (4 V), but that's fine.

However, when I try it with a bipolar input (see below) of about the same length, the output just climbs and climbs—far higher than the peak value.


2 V -----------------------------------
-------------|-\-------------------------
0 V -------------\--------------------
-------------|----\-|-----------------
-2 V ----------------------------------

Any ideas why this second input might drive the output so high? (Again, it's just fine if it takes a few of these short inputs to get the output up to the peak value—in this case 2V.) Thanks for reading!
I ran a sim on your circuit. It didn't overshoot at all. In fact, the crappy slew rate caused the output peak to be missed, and the peak voltage was reached when the input was already on the way down.
 

Thread Starter

Rogare

Joined Mar 9, 2012
78
Hmm wierd. How high does it go? Does it hit the rail and sit there? Can you try a bipolar square wave instead of that triangle, and watch the output on a scope along with the input and see what the output does with respect to the input.

I just want to make sure I'm clear on how it is wired. A schematic would help but I'll describe how I envision it and correct me if I'm wrong. You have the circuit you linked to, Vcc on +8V, Vee on -8V and the capacitor to a ground that comes from the same supply which provides +/-8V. Then you have a function generator, whose negative terminal is also tied to this common ground, and it's other terminal going to the non-inverting op-amp terminal.
Hi ssnyde, thanks for the reply. When the bipolar input is sent to the peak detection circuit, the output rises to 8V—roughly half of my supply voltage (~16V). The schematic I used was the same as the wikipedia article, but with the additional details:
- V+ connected to Vcc of supply (16 V)
- Ground connected to GND of supply (0 V)
- The input signal uses the same GND as the supply

[ I originally said a +/- 8 V supply because it's essentially a 9 V through an 8 V rectifier, then sent to an ICL7660 to yield a +/- 8V supply. That said, I'm really just using it as a 16 V supply with a ground. ]
 

Thread Starter

Rogare

Joined Mar 9, 2012
78
You may need to address stability in your design. The capacitor in the feedback circuit could possibly cause ringing. If you can scope the output of the amp, that would tell you alot, or if you can simulate the circuit with a good LM358 model. 10Uf is a big capacitor, and most likely an electrolytic, hence not the best for peak detection. I'd try a smaller poly cap, and find out about the ringing.
Hi Brownout! I tried a smaller ceramic cap (47 nF) and though it definitely had some advantages over the electrolytic—e.g., the output jumps to the peak value after just a single short input pulse instead of requiring a few—the output still shot up to much higher then the peak value when I tried the biphasic input.
 

Thread Starter

Rogare

Joined Mar 9, 2012
78
Can you try a bipolar square wave instead of that triangle, and watch the output on a scope along with the input and see what the output does with respect to the input.
When I take the capacitor out altogether, it's pretty clear that the problem is the negative part of the wave. You can see in the attached image that the response to the positive part of the wave looks OK (note the different scales), but the negative is the problem.

It may be that the current in my circuit exceeds the rated current for my diode...

NOTE: In the attached image, the blue wave is the input to the peak detection circuit and the red wave is the output. (The two waves are set to different scales as shown.)
 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
You said the input uses the same 0V as the single positive supply for the LM358 opamp.
Then your biphasic signal is exceeding the -0.3V maximum negative input voltage!
 

Brownout

Joined Jan 10, 2012
2,390
[ I originally said a +/- 8 V supply because it's essentially a 9 V through an 8 V rectifier, then sent to an ICL7660 to yield a +/- 8V supply. That said, I'm really just using it as a 16 V supply with a ground. ]
Would'a been much better to tell us this in the first place!
 

Thread Starter

Rogare

Joined Mar 9, 2012
78
You said the input uses the same 0V as the single positive supply for the LM358 opamp.
Then your biphasic signal is exceeding the -0.3V maximum negative input voltage!
Yup, I think that's it. When I reduced the amplitude of the biphasic down below +/- 0.3V, the problem went away. Thanks, Audioguru.

Without making any changes to the power supply situation (V+ is 16 V, supply and input signal share the same ground), is there simply another (cheap) op-amp that doesn't have the -0.3 V limitation?
 

Audioguru

Joined Dec 20, 2007
11,248
Most opamps have inputs that are damaged when the input signal is more negative than the negative supply voltage that is 0V in your circuit.
Some circuits use a dual polarity power supply. Why don't you connect yours as a dual polarity supply?
Other circuits use a series resistor from the signal source then a Schottky clamp diode at the input pin of the opamp.
 

Ron H

Joined Apr 14, 2005
7,063
Yup, I think that's it. When I reduced the amplitude of the biphasic down below +/- 0.3V, the problem went away. Thanks, Audioguru.

Without making any changes to the power supply situation (V+ is 16 V, supply and input signal share the same ground), is there simply another (cheap) op-amp that doesn't have the -0.3 V limitation?
What are you going to do with the output of your peak detector? Can you tolerate AC coupling? If so, you could bias the input signal at ≈8V, but this could open a can of worms.
 

Thread Starter

Rogare

Joined Mar 9, 2012
78
Hi Ron, the rise-time wouldn't be more than a few microseconds. (I posted an image of the input signal on the first page of this topic.)
 

Ron H

Joined Apr 14, 2005
7,063
Hi Ron, the rise-time wouldn't be more than a few microseconds. (I posted an image of the input signal on the first page of this topic.)
The fastest expected risetime, and peak amplitude, are critical parameters to consider when choosing an op amp with adequate slew rate. "A few microseconds" is not really enough information.:(

EDIT: If we say the risetime>1usec, and the amplitude=1V, then we do have enough info.
 
Last edited:
Top