Peak detector concept for sinusoidal sweep generator - Opamp choice - Page 1
Forum section: electronics / projects

author: Verdefluox
author_rank: Contributor
timestamp: May 06, 2025, 03:43:22 pm
content: Hello folks,recentely it came into my mind to build a simple sweep generator to test filters and other stuff. Now, apart from the generator itself (for which I thought to use an AD9834 and an Arduino), but in this post I want to focus on the "receiver" part. To test the amplitude outside of filters etc., I thought to design a peak detector to evaluate the outputs amplitude. Some thoughts/requirements:- speed is not particularly important, as I assume to evaluate only sinusoids (not single peaks); hence, I can focus on a single frequency for as much as I want, as long as the peak is accurate enough- manage evaluate 1 Hz to 1 MHz, if I can go up to 10 MHz it would be better- I'll eventually include an attenuator at the input and/or amplifier at the output, if neededI based my configuration upon Figure 2 from this design:https://www.analog.com/en/resources/technical-articles/ltc6244-high-speed-peak-detector.htmlfor now, my trials on LTSpice used the AD8066, a dual JFET amplifier. However, since this design is not the most classical peak detector configuration, I noticed that to obtain accurate results (while playing around with the values) the resistor value R5 (referred to LTSpice) is not that high compared to other configurations I've seen around (which usually use resistors in the MegaOhm range, while mine is in the 100's kOhm). For this reason, and given the fact in any case I added a trimpot to fine tune the peak detector output (which works nicely even at 1 MHz, if I trimpot correctly), I'm wondering if a JFET amplifier isstrictly necessary. In other words, since there's current flowing from the capacitor to the resistor in question the peak detector works fine for my purposes, but it doesn't seem a proper sample-and-hold. What do you think? Any suggestions on which opamp should I choose in this case? Mind that getting away with something that costs less (even if we are talking of two different amps - since the first requires high slew rate and current, while the seconds ideally only a low input bias current) would be nice.Other infos regarding the Kicad schematic:- used switches to change the capacitor, depending on which frequency I'm analyzing in that moment (high or low frequency ranges)- output can be amplified, otherwise I configured it as a follower- I have an optional LP filter at the output with cutoff at 1 kHz, since I'm assuming that below that frequency some digital reading can help me with the result (frequency is low enough)

author: David Hess
author_rank: Super Contributor
timestamp: May 06, 2025, 05:46:53 pm
content: Quote from: Verdefluox on May 06, 2025, 03:43:22 pmOnly the input bias current of the second operational amplifier matters insofar as it affects droop of the hold capacitor. Since JFET operational amplifiers have higher slew rate than bipolar operational amplifiers, and low input bias current, using the same one for both functions works well.A similar peak detector, used as part of a trigger circuit, is shown below using a current feedback operational amplifier for the input.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 06, 2025, 07:06:47 pm
content: The peak detector circuit needs some way to bring the signal back down. That current sets the speed how fast the regulator can react to a reduction in the amplitude. For a super stable amplitude this current would scale with the frequency, so faster reaction with higher frequency. For a simple case a roughtly constant current is OK and switching the capacitor can be good enough. Especially if the frequency is not super low one does not need or want a very low current and the input bias of the OP-amp can be used for this. I have build a peak detector that intentionally used a BJT based OP-amp (LM318 AFAIR) to get the constant current.So there is no absolute need for a JFET amplifier.The circuit as shown has the diode forward drop not compensated. This is fast, but not very accurate. The scope trigger example is compensating the diode drop at least to a good part. The output amplifier at the capacitor does not have to be fast (see the scope example).For better precision a circuit that compensated the diode drop may be better. Here the buffer is inside the loop and should be rather fast.

author: mawyatt
author_rank: Super Contributor
timestamp: May 06, 2025, 07:26:10 pm
content: OP,Why not consider a Log-Amp?Best

author: Kleinstein
author_rank: Super Contributor
timestamp: May 06, 2025, 09:04:26 pm
content: Log amps are usually made to work over a large range. For amplitude regulation is more a thing of a pretty fixed amplitude and good accuracy. Not sure if a normal log amp would be stable enough. The alternative could be some precision rectifier.

author: David Hess
author_rank: Super Contributor
timestamp: May 06, 2025, 10:26:37 pm
content: Quote from: edavid on May 06, 2025, 06:44:53 pmIt is simple, and noise is not usually a consideration from a local signal source. The alternative could be a closed loop precision half-wave rectifier, but the performance limitations of the operational amplifier are worse. Jim Williams tended to use an open loop compensated diode as a half wave rectifier.What I might try for both greater speed and precision is to use a transconductance amplifier to drive the diode. Since now the diode is driven with a current, forward voltage drop is irrelevant, and the current output of a transconductance amplifier can have a very fast slew rate to traverse diode forward voltage drops. This would replace a half or full wave precision rectifier, so now the output is simply averaged after buffering. I do not remember ever seeing this done so maybe the idea is flawed.

author: zapta
author_rank: Super Contributor
timestamp: May 06, 2025, 11:59:47 pm
content: Have your consider ac/dc converters? For example, this one from Analog outputs dc signal that is proportional to the RMS or average(abs(v)) of the input ac. There are others.https://www.analog.com/media/en/technical-documentation/data-sheets/AD8436.pdf

author: Kleinstein
author_rank: Super Contributor
timestamp: May 07, 2025, 07:51:54 am
content: Quote from: edavid on May 06, 2025, 09:47:51 pmFor looking a the filter / DUT output it would indeed make sense to use a log amplifier of some kind.For a kind of network analyser one could also consider the step towards a vector analyser and phase sensitive detector. This would however want the I/Q signals from the source, so more a different type of generator to start with.Noise can be an issue for small signals in the stop bands. To get more points in the curve it helps to no need too much time for each point.

author: Verdefluox
author_rank: Contributor
timestamp: May 07, 2025, 03:32:27 pm
content: EDIT: Forgot the sim attachmentQuoteSince I see that AD8066 offers also 35 mA of output I was prone to use it, but given its not so low cost I wanted to be sure if I could go with that or choose two different, more specialized ICs (which maybe could be lower cost too).QuoteI guess this circuit is based on the fact on having roughly the same drops between the diodes (so, I thought to match them by picking them as accurately as possible). Hence, choice is on the two resistors. The JFET amp is to have low bias current, so I could safely assume that input bias is ~0 and analyze separately the two branches. Datasheet for the AD8066 specifies ~10s of pA for DC, but obviously we're talking about AC because there's input capacitance that ruins the calculations (you can see that from the sim I attached in which input bias of the first is in the orders of ~uA). Key point is that I think I can get away with something that's not a JFET (since it's not particularly useful in terms of bias in the first one), but in that case I wouldn't know:- what to use as a first (something high current, high slew, for sure)- how to handle the second one: since there's a discharge resistor (ideally infinite), there's still current that flows out of the cap through it and so I don't know how much gain I have in a JFET amp. In other words: ideally I would remove the second resistor (so cap holds "indefinetely" and so the JFET makes sense for U2), but in this case I would need an high R1 to equalize the two branches. Which, in turn, makes the current lower and more relevant the bias of U1. Hence, I should add a resistor to discharge the cap to equalize it (plus, it's easier to trim since that part is DC - I wouldn't add a trimpot in the AC part).I know I'm explaining the problem awfully, but given the performances I expect I think that I can trim it even manually, I'm just not sure if my components are right and justify the cost (which shouldn't matter now, I could use the AD8066 and forget about it - it's more to learn for the future). To me, it seems like a problem that's biting its own tail, so to say.^ Tell me if it's unclear and I try to rephrase it better, I did my best but I'm aware of the convolution of my phrases sometimesI also attached a quick sim at regime with the bias current, especially U1QuoteOk, one thing at the time: I tried to start looking at log amplifiers, but I'm not getting where is the advantage for this. I mean, regarding theamplitude rangeI wasn't this much strict (I was thinking something 10V max to 100 mV min, roughly - maybe adding a 20 dB attenuator in case and, as from my Kicad, an optional 20 dB amplifier), but my point was more to get the peak right (so, even if in a "restricted range") and that was it.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 07, 2025, 11:23:33 pm
content: Quote from: Verdefluox on May 06, 2025, 03:43:22 pmThat's quite some dynamic range.... At very low values, you may want to trigger your ADC to stop the filter getting crazy.Quote from: Verdefluox on May 07, 2025, 03:32:27 pmthat's not so bad.An alternative here would be to use the classic RF probe approach, which is just a simple low C diode to a voltmeter.You can get dual and triple low C schottky diodes, so you use one as a thermal tracker and one as the RF probe. Encase them & slot the PCB for better tracking.A triple diode could use two outers as thermal and the inner one as RF det.You can auto-zero this frequently with a 0V signal, to correct any offset between the two diodes.RF probes are inherently non-linear at lowest voltages, but that's predictable, so you can calibrate the correction curve.A quick spice run with a 2uA injection bias, and 200k load TC to RF nodes gives thisAC(50Ohms) dV (VTC-VR)0mV = -91.940165µV5mV = 97.461045µV10mV = 644.55718µV50mV = 16.086117mV100mV = 51.584378mV150mV = 91.394303mV250mV = 177.33573mV1V = 876.40449mV15V = 14.649225VCrosses 1mV at about 10mV AC, so should comfortably manage 10V~100mV, with closer to 10mV possible with care.Addit : the numbers above show the zero uncertainty. It is better to create a small offset to avoid any step effects.eg a skew of 40nA on the 2uA/diode pre bias (2%), gives a ~0.47mV offset, and a 15V ~ 15mV input range, gives a 7.316V ~ 1.06mV output with Zero ~ 0.224mV

author: SCSKITS
author_rank: Regular Contributor
timestamp: May 08, 2025, 02:34:03 am
content: Use an analog devices log detector like the AD8318 or similar. The AD8318 is wide bandwidth (1MHz to 8GHz) and has a DC output in dB.

author: MariuszD
author_rank: Regular Contributor
timestamp: May 08, 2025, 03:01:14 pm
content: Passive diode detectors are non-linear, detectors with diode and op amp are slow.Analog switch, controlled by comparator (zero crossing detector) is fast and linear. This is not peak detector, but average.Jim Williams designed something like this schematic in the attachmentFrom Application Note 13 High Speed Comparator Techniques

author: PCB.Wiz
author_rank: Super Contributor
timestamp: May 08, 2025, 09:05:17 pm
content: Quote from: MariuszD on May 08, 2025, 03:01:14 pmGood point, and in 2025, such a design is rather easier.Worth exploring, linearity is better than a RF Detector diode, but still hits issues at very low voltages due to* Comp speed drops with low overdrive.* Vos and Ios effects* Delays and Hyst phase shift the analog switch points from the ideal true zero crossing.Some of those effects could be calibrated out. Looks usable over appx 1000:1 range.Parts like MX3501/MX3502 at lcsc are low cost, have CMOS inputs, and fast switching speeds ~ 5ns, with small hyst on pins.Analog switch parts in SPDT can both average sample on one half and work as sample and hold on the other half cycle.Voltage range is somewhat limited by the Analog Switch.

author: David Hess
author_rank: Super Contributor
timestamp: May 08, 2025, 11:43:45 pm
content: Quote from: MariuszD on May 08, 2025, 03:01:14 pmI have had good results with two diode bridge square law detectors, but of course the output is not linear at low levels. Dynamic range is excellent however.QuoteThanks for posting that because otherwise I would have.