EEVblog #490 - Peak Detector Circuit - Page 1
Forum section: electronics / general

author: EEVblog
author_rank: Unknown
timestamp: June 29, 2013, 11:49:53 am
content: Fundamentals Friday.Designing and measuring basic and precision peak detector circuits.

author: lewis
author_rank: Frequent Contributor
timestamp: June 29, 2013, 12:23:20 pm
content: That loss of feedback when the op-amp saturates negative makes it almost impossible to measure high frequency signals. It's possible to give the op-amp some feedback on the negative half-cycle by putting another diode around the feedback loop; this helps to stabilise the op-amp, stops it oscillating, and makes the precision peak detector even more precise. See attached image (taken from page 12 here:http://www.site.uottawa.ca/~rhabash/ELG4135L8.pdf). It's a very small re-arrangement of Dave's bottom circuit.

author: sergey
author_rank: Regular Contributor
timestamp: June 29, 2013, 12:57:24 pm
content: Nice video. But one thing is not so 100% clear, unfortunately.When Dave was probing "precision diode" (voltage follower modification where op-amp compensates voltage drop) it doesn't seem to be perfectly clipped. Is it just because op-amp isn't fast enough and that "undershoot" will become smaller with lower frequency input / faster op-amp?

author: EEVblog
author_rank: Unknown
timestamp: June 29, 2013, 01:02:51 pm
content: Quote from: lewis on June 29, 2013, 12:23:20 pmYes, I wanted to get into that, but I babbled on and the video was already too long, so stuck with the basic arrangement for this video. I thought that could be a part 2.

author: Dennis
author_rank: Contributor
timestamp: June 29, 2013, 05:10:47 pm
content: Great topic Dave; has anyone ever used a circuit like this to de-bounce a switch/relay? It sure looks like a simple diode/capacitor combination would work if you didn't have a Schmidt trigger handy.

author: fmaimon
author_rank: Unknown
timestamp: June 29, 2013, 06:20:13 pm
content: Did you noticed that the opamp spikes were syncronous with the "edges" of the generated sine wave? Maybe if it was a real sine wave it would be continuous.

author: Psi
author_rank: Super Contributor
timestamp: June 30, 2013, 12:43:47 am
content: Seems to me that a peak detector and an envelope filter are exactly the same.The envelope filter just uses a smaller cap or higher discharge resistor to create the envelop like effect.

author: cthree
author_rank: Frequent Contributor
timestamp: June 30, 2013, 12:49:40 am
content: Another fine quality video

author: KerryW
author_rank: Regular Contributor
timestamp: June 30, 2013, 03:51:31 am
content: A good (and fast) peak detector can be made using an LM311 comparator in place of the op-amp.Tie the output collector (pin 7) to the + supplyTie the output emitter (pin 1) to the capacitor, no diode needed.You need enough of a load to offset the output transistor leakage current.The circuit is shown in the TI datasheet, fig. 24.

author: bktemp
author_rank: Super Contributor
timestamp: June 30, 2013, 08:26:52 am
content: I think the oscillations could be supressed by inserting a small resistor between the opamp an den capacitor (outside the feedback loop!). Yes, this makes the response to short peaks worse, but opamps don't like pure capacitive loads without any series resistance. Then the voltage would not overshoot and the opamp output would smoothly follow the input as long it is larger than the voltage at the capacitor.Is there really no current flowing thrue a diode with no bias on it? I think this is not completely true. At least if you shine light on a 1N4148 in its transparent glass case there should be some pA or even nA flowing, depending on how much light you put into it.In the Keithley 480 Picoammeter they have used two JFETs connected as extremely low leakige diodes at the high impedance input of the opamp as overvoltage protection. Thince the voltage at this point is exactly zero volts, they could also have used standard diodes instead of the more expensive JFETs if no current would flow in a normal diode at zero bias.

author: SeanB
author_rank: Super Contributor
timestamp: June 30, 2013, 10:40:46 am
content: Glass bodied diodes have both photocurrent leakage and produce a photoelectric voltage with light. With zero bias they would put in an error current and with bias they would allow a leakage current. Just took a random glass diode and got a voltage of 12mV across it with just a torch. Not very repeatable, but then again I did not clean off all the black paint on it.

author: dentaku
author_rank: Frequent Contributor
timestamp: June 30, 2013, 04:14:07 pm
content: So a circuit like this could be used to input a regular old audio signal (a 1khz tone out of a computer or something like that) and give you a steady-ish DC voltage out that changes as the volume of the audio source changes?I was just reading thishttp://www.muffwiggler.com/forum/viewtopic.php?t=14328and I see the similarity.

author: Unknown
author_rank: Unknown
timestamp: June 30, 2013, 06:44:33 pm
content: Hey! What happened with DaveCad(TM)?You should make a rubber DaveCad(TM) logo with a cnc machine or a laser machine.Fridays my favorite day of the week

author: kaushleshchandel
author_rank: Newbie
timestamp: July 01, 2013, 05:32:10 am
content: Great video Dave!!!This gave me an Idea. I am woking with AD9850 based signal generator. It only outputs a sine wave. And I needed square wave. So after viewing your video here is the setup I want to try. Another issue with this DDS chip is that the peak voltage varies if I change the sinewave frequency.* Output sine wave.* Add a peak detector to measure the max V of the sine wave, using an OpAmp based peak detection as Dave described.* Use this feedback into another opamp that will amplify the signal from the DDS.Thus, if the DDS is giving 800mV peak to peak, it can be amplifiedDo you think this circuit makes sense.

author: btober
author_rank: Newbie
timestamp: July 01, 2013, 06:15:37 am
content: The real reason, as I'm sure Dave is well aware, for the oscillation that is seen in the behavior of the op-amp when a larger capacitor is used, is that, generally, op-amps do not "like" capacitive loads. To elaborate a little further, unless you mean to build an oscillator, you have to avoid positive feedback, taking into account that phase shift around the feedback loop may create positive feedback in a circuit designed to have negative feedback. I think "Stability considerations in the use of op-amps" would be a very fine topic for a future edition of Fundamentals Friday!

author: Christe4nM
author_rank: Unknown
timestamp: July 01, 2013, 12:34:41 pm
content: Quote from: lewis on June 29, 2013, 12:23:20 pmThanks! That answers the question that I wanted to ask here.

author: Smokey
author_rank: Super Contributor
timestamp: July 01, 2013, 11:59:34 pm
content: Quote from: kaushleshchandel on July 01, 2013, 05:32:10 amThat chip has a built in comparator to make square waves (usually for clock generation). Check out page 8 of the data sheet for an example circuit.www.analog.com/static/imported-files/data_sheets/AD9850.pdf

author: DBoulanger
author_rank: Regular Contributor
timestamp: November 10, 2013, 05:01:15 am
content: Quote from: lewis on June 29, 2013, 12:23:20 pmI tried this circuit, and I guess I'm missing something obvious. The "DC" voltage at the capacitor does reflect the peak as such. However, the output of the "follower" gives me something close to the rail, which I really don't understand. Normally it should be pretty much the same voltage as the one presented at the non-inverting input of the "follower", right ?I've redone my checks to validate for proper wiring many times, and I can't come up with a logical explanation. Anyone can clarify it for me ?

author: cybermaus
author_rank: Frequent Contributor
timestamp: January 18, 2014, 06:13:54 pm
content: I build this peak detector, I needed if for a 25~35 KHz application and I ran into saturation recovery time issues. Which basically showed (as with the previous post?) as if follower was not following, always pressed to V- with some small peaks above it V-I finally understood what was happening, the OpAmp recovered to slowly from saturation. This peak detector is not useable above audio frequencies. And I found there exists also a very simple improvement to Dave's example:Just one extra component: simply add a anti-saturation diode.Not only does it avoid saturation and thus allows much higher frequencies. It also actually reduces the current use of the circuit.The 2nd diode (anti-saturation diode) simply allows the attempt of the opamp to equalize the inputs to not be in vain, and thus it does not saturates so drained current is much less, and by placing the resistor slightly different it the drained current actually comes from the the capacitor. If you want no sag, but a driven reset, just do not add the resistor and put a FET like normal.

author: JMThomas
author_rank: Newbie
timestamp: September 06, 2015, 08:32:46 am
content: I'm terribly late to the party, but how do you know when you've captured a peak value?In other words, what can you use to trigger the a2d sampling that reads that wonderfully charged capacitor?(Looking at the scope trace, I could see where the op-amp started recharging the cap. But there was often oscillation there, not to mention multiple recharges. Would there be a Q&D way using this op-amp output to signal the ATD?)

author: codeboy2k
author_rank: Super Contributor
timestamp: September 06, 2015, 09:01:50 pm
content: You generally want your peak detector to be faster than your sample rate from the ADC. (note: please write ADC [Analog to DigitalControllerConverter], not ATD -- use the well-established acronyms). When you want to sample the peak within your sampling interval, then you know it's going to be ready and holding a peak for you. Your peak detector can be self-resetting (via a resistor across the cap, i.e. using the RC time constant) or it can be reset via a transistor across the capacitor, using an output signal from the micro after you've read the peak. If you use a self-resetting peak-detector then you need the ADC to sample it fast enough to get the reading before it decays. If you use a reset transistor, then your ADC can be slower than your peak detector and you can reset it after each reading.To design the peak detector you need to know your input signal, and design it so that it is fast enough to track and hold the peaks that you want (i.e. choose the proper op-amp and cap)Peaks are always going to be within some time period that you establish. You can wait 1 us or 1 second for a peak to arrive. It's completely up to you and usually depends on what you are sampling. You just need to make the peak detector hold it that long, and you sample it at the required rate.You can't just decide that I'll wait for the peak to arrive and trigger the ADC when it does, because how long should you wait? You can't wait forever, so you have to wait some time period. This is going to be your ADC sample rate.Yes, you can get fancy and do some tricky stuff with analog switches, holding caps and comparators to hold the previous peak value value and the current value and trigger the ADC using the comparator output when the current value is greater than the previous value. But you generally don't need that added complication, if your peak detector is fast enough you can just sample the peak value periodically.

author: lewis
author_rank: Frequent Contributor
timestamp: September 09, 2015, 10:21:46 am
content: Quote from: codeboy2k on September 06, 2015, 09:01:50 pmAhem, it's Analogue* to DigitalConverter*British spelling of Analogue.

author: codeboy2k
author_rank: Super Contributor
timestamp: September 10, 2015, 05:35:25 am
content: Quote from: lewis on September 09, 2015, 10:21:46 am*embarassed* yeah, converter... I knew that too, for several years nowI slipped, thanks for the correction, I fixed it.