# Precision high speed peak detector

As a follow-up to my previous question, where I seek to determine the amplitude of a 2 MHz sine wave, I've settled for an op amp based solution. To recall, my input has a maximum 240 mV amplitude -- in fact I'd like to go lower than this, so long as output accuracy is not significantly affected. Having relaxed my accuracy requirements for the circuit (I'm willing to accept 5% error on the amplitude/RMS value of the sine wave), I've found a cheaper op amp, namely the MAX4453. The main specs of interest are: 200 MHz bandwidth, 95 V/µs slew rate, 400 µV typical input offset and 800 nA typical input bias current. Maxim provides a SPICE model for this op amp.

In principle, after rectifying the wave, I could low-pass filter the output and read the DC value $V_{DC}$, which would be related to the peak value $V_{pk}$ by $V_{DC} = V_{pk}/\pi$ for a half-wave rectifier, and $V_{DC} = 2 V_{pk}/\pi$ for a full-wave rectifier. Hence I simulated the following circuit (the same mentioned in my previous question): I determined that there is some distortion in the output wave, especially near the zero-crossings, where $A_1$ switches between open and closed loop, as shown in the following simulation: Obviously, such distortion would introduce uncertainty in the value of $V_{DC}$ and hence reduce the accuracy to which $V_{pk}$ can be determined.

Hence I decided a peak detector might be a more appropriate solution. Adding a 1 µF capacitor to the output of the rectifier above, I get the following simulation result: Zooming in after the capacitor has settled: The average value of the output is ~215 mV vs. a 240 mV input, so around 10% error and hence outside my specs. Apparently the op amp output current limit prevents the 1 µF capacitor from charging quickly enough. The obvious solution would be to reduce the capacitance; unfortunately, the high output impedance of $A_2$ (due to $R_2$) translates into excessive droop in the capacitor.

I've tried a few alternative circuits, with similar results. In particular, the following very simple half-wave rectifier circuit appears to work just as well as the circuit above: simulate this circuit – Schematic created using CircuitLab

The lower output impedance of the op amp in this circuit means that droop is acceptable with a 1 nF capacitor. Here is the simulation result: Zooming in after the capacitor has settled: It is clear there is no improvement (although of course the circuit is simpler and cheaper).

My questions: are there alternative circuit topologies I should try, which would get the output closer to the peak value of the input? Should I look for another op amp? Which specific characteristics of the op amp should I seek to improve?

• The output impedance of A2 is the parallel combination of its own output impedance and the feedback resistor R2, so it's certainly not high; Most op-amps have an output impedance of < 100 Ohms. Looking at page 5 of the datasheet for the MAX4453 has this device's output impedance being 0.8 Ohms at 1 Mhz. – sherrellbc Feb 15 '15 at 18:05
• This was my first thought upon seeing the circuit; however, there is a path from the output to ground with a 10 kΩ impedance (that's the value of $R_2$ in the simulation) in the circuit, and sure enough, from the graph, one can see a droop of ~2 mV over ~18 µs while the capacitor is discharging. Plugging this into $I = C dV/dt = 1 µF \times 2 mV/18 µs \approx 111 µA$, which is consistent with a 10 kΩ impedance. So maybe output impedance is not the correct term, but the effect of $R_2$ is, in my mind, definitely there. – swineone Feb 15 '15 at 18:13
• The output impedance of the amplifier is in parallel with its own impedance (~0.8 Ohms) and the feedback resistance R2. You then place a capacitor on the output which is also in parallel with R2. What you are seeing is the discharging of the output capacitor through R2 to the virtual ground generated by the amp's negative feedback. – sherrellbc Feb 15 '15 at 18:20
• The point is that a large capacitor is required in the first circuit, while a small capacitor suffices in the second. In my mind that has to do with $R_2$ being 1 kΩ (sorry, not 10 kΩ as I said at first), while no such resistor exists in the second circuit, so the droop in the second circuit is due to the op amp's bias current alone. – swineone Feb 15 '15 at 18:27
• Your claim that 215 mV output for a 240 mV input is outside your accuracy requirements needs verification. Run the simulation again for 120 mV input. If the output drops to 107 mV, you can treat the 215 as a result of scale factor not being ideal, and compensate easily for it. As a matter of fact, you can produce a calibration table for a range of input/output voltages. The only question then would be how the output varies with other variables such as temperature. – WhatRoughBeast Feb 15 '15 at 23:02

Precision rectifiers at high frequency are surprisingly hard, as you are finding out...

The tricky bit is, what does the amplifier do when the diode is non-conducting?

In the second circuit, we can infer what's happening from the zoomed-in waveform.

When the diode is off (V1 < Vout) the opamp Vin+ input is below Vin- and there is no NFB, thus the opamp is effectively open-loop, instantly driving its output hard against the -ve supply rail.

When Vin+ goes positive again (exceeds Vout,Vin-) the opamp recovers from this condition and slews its output positive as fast as it can... and JUST starts charging C as Vin+ falls below Vout. (You can see the tiny charging spike). If you can add a simulator trace on the opamp output, you'll see this happening more clearly. (Update the question with the plot, maybe!)

(You can reason similarly about the zero-crossing distortion in the first circuit, though the error is limited to the forward voltage across D1, therefore recovery is relatively fast)

So what to do about it? Essentially, ensure OA1 never loses control quite so badly. A high value resistor and diode in series, across D1, (the diode having the opposite polarity) will ensure the opamp output remains only 2 diode drops from the output voltage, giving faster recovery (but not infinitely fast) This will load C1 a little, thanks to the resistor. simulate this circuit – Schematic created using CircuitLab

Alternatively, use two diodes in place of D1 - one charging C1, the other as part of the feedback network above (which becomes simply 2 back-to-back diodes, there is no more need for the resistor). In this version, there will be imprecision from the mismatch between the two "D1" diodes; relatively small compared with what you see now. simulate this circuit

When D1 conducts, D3 keeps Vin- at (approx) the same voltage. When D1 turns off, D2 keeps the output somewhat under control.

There may be ways of fixing or improving the original circuit, now that you know what you're looking for.

• Thank you for your ideas. I suspected it had to do with the op amp's recovery time. Yet it appears these circuits only work in a split-supply scenario -- I mentioned in my other question that I'm shooting for a single supply solution, but apparently, not on this one. It seems that, for these circuits to work, the op amp needs to output a negative value. A possibility would be to bias everything around, say, VCC/2, so I have legroom to bias the diodes. I will give this some thought. – swineone Feb 15 '15 at 23:06
• I assumed that if you were using a single supply, you already were biassing "gnd" (in this part of the cct) to Vs/2. Of course if Vcc=3.3V, then the negative supply isn't as far away as I thought... Take particular note of the "common mode input range" in that datasheet : apparently performance isn't so good with the inputs close to V+. – Brian Drummond Feb 15 '15 at 23:08

Aside from the main issue, it was interesting for me to see yet how the first op-amp circuit works...

Really clever circuit solution... The bottom part (A1 and D1) acts as an ideal diode switch that grounds the A2 non-inverting amplifier at the negative input half-wave... and the whole circuit acts as an inverting amplifer with gain of -R2/R1 = -1. At the positive half-wave, the diode switch is open and the whole circuit acts as a voltage follower... it is also interesting to see why...

A possible explanation... The voltage at the A2 non-inverting input follows the input voltage since there is no current flowing through R3. The voltage at the A2 inverting input follows the voltage at the non-inverting input since A2, obeying the H&H Golden rules, tries to keep a zero voltage difference between its inputs. To do it, the op-amp output voltage follows the voltage at the A2 inverting input. As a result, there is no current flowing through the R1-R2 network... and all the four circuit nodes have the same voltage in regards to ground... they are equipotential...

The circuit does not load the input source and has extremely high input resistance since the input source sees (through R3) the naturally high input resistance of the non-inverting input, and the virtually increased (bootstrapped) R1 resistance.