# Output contention in peak detector

#### petewh

Joined Mar 23, 2016
45
I want to build a peak detector using an op amp with a diode and capacitor output. I was going to reset it with a transistor across the capacitor. But shorting the output to ground brings the op amp's output to a diode above ground. Doesn't forcing an op amp's output to ground momentarily cause a problem?

#### ronsimpson

Joined Oct 7, 2019
1,131
Can you post the schematic you have now.
What is the voltage level? of the signal you want to find the peak of
There is a 0.7V problem because of the diode. Do you need that removed?

#### petewh

Joined Mar 23, 2016
45
Well, first, I cannot post a schematic as much as I'd like to. The voltage levels are roughly 0 to 5V. I intend to feedback the voltage at the diode-capacitor node to the op amp making the op amp in effect a follower. So, the diode drop should be eliminated. The circuit itself is pretty standard and I like it for its simplicity.

#### OBW0549

Joined Mar 2, 2015
3,566
I was going to reset it with a transistor across the capacitor. But shorting the output to ground brings the op amp's output to a diode above ground. Doesn't forcing an op amp's output to ground momentarily cause a problem?
Yes.

The way around this problem is to put a resistor (probably a few hundred ohms) between the transistor's collector and your capacitor. The resistor should be small enough that the capacitor will discharge through it quickly enough, but large enough that the op amp is still capable of driving it without problems.

By the way, using a transistor to discharge the capacitor won't bring the op amp's output to a diode drop above ground; it brings it down to the transistor's Vce(sat) above ground-- typically a few dozen millivolts or so.

You can also use a MOSFET to discharge the capacitor, for instance a 2N7000.

#### crutschow

Joined Mar 14, 2008
26,391
What is the op amp, and what are its supply voltage(s)?

#### petewh

Joined Mar 23, 2016
45
Yes, that works! I didn't think of that. Just running some numbers a TL082 probably puts out 20ma max and over 5V comes out to 125 ohms so thinking a resistor amour 200 or bigger seems in the realm of small. This project is for hobby, it's not going into a product. Ultimately I'll run the peak detection into an ADC and using a general purpose "micro board" I built make a digitally controlled ADC

What is the op amp, and what are its supply voltage(s)?
I'm going to use a TL082 because that is what I have around, running at plus/minus 5V. I don't have an inexpensive CMOS op amp though would like a smaller supply current for future projects.

#### ci139

Joined Jul 11, 2016
1,696
you can also bring down the both ends simultaneously and the op amp and cap - (such however adds complexity and maybe even a lot to preserve the other features of your design -- but is fairly simple as Op Amp 1-st as it's protected by diode , then cap ...)

#### DickCappels

Joined Aug 21, 2008
6,963
A TL082 with ±5V power supplies is not going to allow the circuit to handle signals more than a couple of volts away from ground.

By the way, I am working with a circuit similar to the one you described. The 2N7000 that OBW0549 mentioned is probably a better solution that the bipolar I am using. If you end up using a bipolar transistor take the collector cutoff current into account when making the selection.

#### ci139

Joined Jul 11, 2016
1,696
yes , but you can always ground your NPN below "0" by the amount defined by another NPN - allows to reach perhaps even below mV precision (from "0") /// another option is controlled discharge (where "0" is defined by output amplifier ← in that approach the "end of discharge" delay and random reaction from circuit at that point will set a random error to "0" ) . . .

#### petewh

Joined Mar 23, 2016
45
My choice of +/- 5V is because I am going to run the 5V from the board with a microprocessor, which is 5V. I'm going to use a 7660 too. I did get an end of life notice about the 7660. I don't get the front end of your circuit. You have the Megohm resistors tied to -V for some offset I presume but what does the zener do?

#### Audioguru again

Joined Oct 21, 2019
2,668
The 7660 makes a lot of 10kHz power supply noise and its output voltage drops even with a light load. Its life is nearly ended.
Maxim makes a much better one.

I have used a single supply opamp (MC34071 which is better than the opamps in an LM324 or LM358)) to make a peak detector that did not need a negative supply voltage. Its schematic is on my broken old hard drive.

#### petewh

Joined Mar 23, 2016
45
I agree about the noise. Do you happen to have the number of the Maxim chip? Thanks.

#### Audioguru again

Joined Oct 21, 2019
2,668
A quick look in Google shows that Maxim make the ICL7660 and the improved MAX1044. Digikey has the LMC7660 in stock and it is still being made.

#### ci139

Joined Jul 11, 2016
1,696
Re #6

I don't quite get the gymnastics exercise you try to perform -- you can have isolated supply defining your ± OpAmp Rails around whatsoever "Reference Ground" -- you dont need 0 to 5 V at the output at level detector as you can define your level (for example) inside (*) ±500mV + voluntary DC offset , then use R2R or isolated supply to amplify and level-shift the required "scale" to MCU A/D input . . . . -- you can also split your detected level into chunks using comparator and feed it , say , in 0 to 1.7V intervals (←or that scaled) into random window inside your 0 toVcc A/D input of the MCU ((.. i do realize that each conversion adds a potential error ... but if you don't want to provide a std. ±15V to your Op Amp -- which would be most fast and precise with such supply voltage - then you have to trade some precision for different implementation ..))

. . . more -- you can "absolute" your level around 2 levels offset from the median ... to avoid nonlinearities near zero crossing of the " 'ideal' diode " and then feed "+upper" half and "–lower" half of your level to A/D ← also you can do it all inside the +5V supply using LM6142 TLV314 OP284 or alike

(*) -- note the op amp is most precise inside about the ±1/3 of the ±Vs (for Vs.TOT = 5V , ±Vs=2.5V , "usable range" ≈ 2.5V ± 833mV)

https://www.edn.com/Home/PrintView?contentItemId=4368505
http://www.ti.com/lit/an/sloa277/sloa277.pdf

Last edited:

#### DickCappels

Joined Aug 21, 2008
6,963
My choice of +/- 5V is because I am going to run the 5V from the board with a microprocessor, which is 5V. I'm going to use a 7660 too. I did get an end of life notice about the 7660. I don't get the front end of your circuit. You have the Megohm resistors tied to -V for some offset I presume but what does the zener do?
If your greatest voltage is small then you can get by with a ±5V supply. In my case, I expect the input voltage to range from 0V to +5V.

The front end of my circuit has to present a very high impedance to the source and then I need an offset voltage, and that is the reason for the Zener.

#### ci139

Joined Jul 11, 2016
1,696
some tests with apx. transistor models of µA776 LM308 LM358 TL072 -- looks the higher power op amp is more stable . . .

Last edited:

#### ci139

Joined Jul 11, 2016
1,696
while the previous biasing won't let the inputs of the op amp to travel beyond Vdd/2 ... Vss/2 -- then the things get interesting if they can
. . . /!\ the TL071 -'s plot may be misleading /!\ . . . now with Transistor level TL072 model
.

_____________
basic Gain 1 follower

Last edited:

#### ci139

Joined Jul 11, 2016
1,696
↑ what that means is ↑

. . . if your control chain is not "that" time critical then you could consider multiple parallel inputs to MCU (←if it has many A/D channels)
so that the input signals have a decent time to settle

. . . it is one signal to multiple peak detectros (reset @ $$\frac{i\ ·\ t_\text{Cycle of A/D Set of N A/D -s}}N$$) → to parallel A/D -s // ← such set of peak detectors also needs a calibration

↑ such set of A/D -s can be live calibrated ↑ by connecting a common signal ramp
from min to max to min ( _/¯\_ ) INP voltage
in parallel to all A/D input buffer Amps . . . ??? or mixed calibration with peak detectors then you saw tooth ramp up and down for discrete ramp levels ...

Last edited:

#### petewh

Joined Mar 23, 2016
45
Your diagrams are interesting but why is there a distinct sine wave on +V at 15V? Unfortunately the bottom part of your schematics are cut off in my view. I'll consider another op amp.

#### ci139

Joined Jul 11, 2016
1,696
I'll consider another op amp.
there is a relict in my Spice tests -- the op amp supply filtering - that may cause small DC component drifts when one of the OUTP shoulders dominates & then another . . .
why is there a distinct sine wave on +V at 15V
it's because the input exceeds it allowable range near there -- e.g. -- none of these are "over the top R2R input & R2R output" op amps
_____
i thought i manage to point out the common mode sensitivity loss away from the supply median ← but such requires some kind of different setup or a way smaller input voltage amplitude . . .
_______

what my tests were about was the INP signal travel from ±15V !!!
/// when you use bipolar transistor (not iC) analog multiplier (for analog multiplication/division/reciporal/square-root/... ) then the linearity gets lost above ±200mV input , and it starts "sensing" form ??? say ±2mV . . . ← you have to fit your math into that range e.g. -200mV ... -2mV , +2mV ... 200mV
you here attempt to go 5V / 0.4V better (about 12.5x)

the problem is that the Op Amp's internal transistors change their voltages quite a lot with that and the transistor is a non-linear device -- means -- it is conditionally linear only in small range of changes at a time (if you don't need much precision - then you also don't have to get the backgrounds here . . .)