Author Topic: Finding the leak in an opamp peak detector circuit  (Read 4024 times)

0 Members and 1 Guest are viewing this topic.

Online DaJMastaTopic starter

  • Super Contributor
  • ***
  • Posts: 2352
  • Country: us
    • medpants.com
Finding the leak in an opamp peak detector circuit
« on: November 09, 2016, 11:27:44 pm »
So I've built up a peak detector as part of a larger circuit, and have run into much lower performance than I expected.  I'm using the basic design found in Dave's video on the topic, the middle image in this picture:


My opamps are both OPA1612s, my diode is a DA2S10400L, my capacitance is 50uF, the system is running a split supply of plus and minus 5V.  The circuit finds the correct peak in the signal, but I'm using it at audio level frequencies, and when the frequency goes low enough, it simply does not hold the peak for as long as I would expect - below a couple hundred Hertz, it actually gets to zero between pulses, and that just doesn't seem right.

So I've taken a look at the reverse current on the diode (up to 500nA) and the bias current on the opamp (up to 250nA), but that up to .75 microamps I don't think should be able to drain the capacitor (measured charge of 2.5V at the peak) as quickly as it does - my ballpark math says it should take several seconds to fully discharge.  I also know it's not my probe impedance (which should be in the same magnitude as the opamp bias current) because the circuit runs into a comparator and the comparator triggers at about the same spot when probing as when left alone.

Also interesting, while I've checked the diode on its own and it rectifies properly, when attached to the circuit, the "peak" charge on the capacitor goes slightly negative when the frequency of the input is low enough (400mV with a 2.5V peak), and from the best I can tell.... it just shouldn't be going negative even if it discharges.  I also don't think the slew rate on the opamp is deficient because the risetime for the charge on the caps match the rise of the input signal.

Now I can easily switch in an opamp with a pA bias current and find a diode with much less leakage, but will that actually solve the problem?  Do I need a lot more capacitance to just minimize it?  Has anyone seen this strange negative voltage behavior in their peak detector?  I feel like I've got several or several dozen microamps of leakage that I don't know where its going off to.
 
The following users thanked this post: clockfix

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1507
  • Country: ca
Re: Finding the leak in an opamp peak detector circuit
« Reply #1 on: November 10, 2016, 12:34:24 am »
You are using the wrong opamp. The OPA1612 has diodes between each input that are causing the capacitor to discharge too soon.
 
The following users thanked this post: clockfix

Online DaJMastaTopic starter

  • Super Contributor
  • ***
  • Posts: 2352
  • Country: us
    • medpants.com
Re: Finding the leak in an opamp peak detector circuit
« Reply #2 on: November 10, 2016, 12:42:21 am »
 :palm:

Well that'd do it.  To verify before I go ahead, the OPA1642 (uses a jfet input stage) would be a viable choice to keep the cap topped up, correct?
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Finding the leak in an opamp peak detector circuit
« Reply #3 on: November 10, 2016, 02:51:19 am »
:palm:

Well that'd do it.  To verify before I go ahead, the OPA1642 (uses a jfet input stage) would be a viable choice to keep the cap topped up, correct?

Yup! So long as the GBW and frequency response of the OPA1642 is fine for the signal you're peak detecting, it'll work. Most OP Amps with JFET inputs are "low input bias current" types, which means the inputs don't drain a lot of current (generally in the low nA to pA range). This would be ideal if you're trying to peak detect a very low frequency signal. (Though, in that case I'd also use a low leakage diode and a plastic or film capacitor; polystyrene used to be great for this sort of thing, but they're hard to find now.)
« Last Edit: November 10, 2016, 02:53:42 am by timb »
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 

Online DaJMastaTopic starter

  • Super Contributor
  • ***
  • Posts: 2352
  • Country: us
    • medpants.com
Re: Finding the leak in an opamp peak detector circuit
« Reply #4 on: November 10, 2016, 03:16:33 am »
Perfect, I'm not sure I'll need to get into low leakage caps, but it's on the table if it gets in the way of the performance target.  Basically, I want less than 5% peak decay between cycles at 20Hz to maximize rejection of higher harmonic content at the comparator stage, but I actually think some leakage is beneficial to help responsiveness to changing incoming signals.

I'll likely be swapping parts and adjusting pots with the proper tongue angle to get it right, but I've got a (currently removed) bleeder resistor to take care of the fine adjustment.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17103
  • Country: us
  • DavidH
Re: Finding the leak in an opamp peak detector circuit
« Reply #5 on: November 10, 2016, 05:15:22 am »
Well that'd do it.  To verify before I go ahead, the OPA1642 (uses a jfet input stage) would be a viable choice to keep the cap topped up, correct?

Yes, although that is not a feature exclusive to JFET or MOSFET inputs.  Precision bipolar operational amplifiers commonly have back to back diodes across their inputs because otherwise large differential voltages would cause reverse breakdown of the base-emitter junctions damaging the input transistors.  But not all bipolar amplifiers have that issue; for example the venerable LM833 has PNP inputs which neatly avoid this problem by having a very high emitter-base reverse breakdown voltage.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14724
  • Country: de
Re: Finding the leak in an opamp peak detector circuit
« Reply #6 on: November 10, 2016, 04:14:21 pm »
Usually the storage cap used is much smaller, so more like a few nF not in the µF range. With low leakage this is good enough and the first OP will otherwise have trouble to drive the capacitive load. Depending on the OP and capacitance one might need to add a series resistor.

The diode chosen is also not the very best, a smaller one should work better as it has less capacitance and leakage.

The output side might need an defined bias so the voltage will not slowly drift up even without a signal.
 

Offline Fgrir

  • Regular Contributor
  • *
  • Posts: 164
  • Country: us
Re: Finding the leak in an opamp peak detector circuit
« Reply #7 on: November 10, 2016, 04:23:33 pm »
Also, the OPA1642 has a common-mode input range that only extends to 3.5V below the positive rail.  If you use it with +-5V supplies you will only be able to work with signal levels up to about 1.5V.
 

Online DaJMastaTopic starter

  • Super Contributor
  • ***
  • Posts: 2352
  • Country: us
    • medpants.com
Re: Finding the leak in an opamp peak detector circuit
« Reply #8 on: November 15, 2016, 06:46:35 pm »
Just a follow up, I swapped out the opamp and that did the trick!  In fact, with just the bias currents and leakage on the caps/diodes, it was holding its charge too, well, so I dropped the capacitance to 4.7uF and have a couple hundred K of bleeder resistor across the cap to aid in discharging (half meg pot, haven't measured to be sure).

I went from ok performance at high frequency and basically no performance at 20 Hz to having the comparator on the output be able to identify between a 40Hz carrier wave with a 20Hz, 1% AM modulation without any additional tweaking.

I wasn't too concerned with the 1642's input range because the 3.5V was the posted max and this is a one-off project, so I could choose between chips if need be, but since it's so high, I suspect that it scales somewhat with supply voltage - I can't imagine it would be 3.5V from the rail when the minimum supply voltage is +-2.25V, even if it is when the supply is up at +-18V.
 
The following users thanked this post: clockfix


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf