-
EEVblog #490 - Peak Detector Circuit
Posted by
EEVblog
on 29 Jun, 2013 11:49
-
Fundamentals Friday.
Designing and measuring basic and precision peak detector circuits.
-
#1 Reply
Posted by
lewis
on 29 Jun, 2013 12:23
-
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.
-
#2 Reply
Posted by
sergey
on 29 Jun, 2013 12:57
-
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?
-
#3 Reply
Posted by
EEVblog
on 29 Jun, 2013 13:02
-
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.
Yes, 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.
-
#4 Reply
Posted by
Dennis
on 29 Jun, 2013 17:10
-
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.
-
#5 Reply
Posted by
fmaimon
on 29 Jun, 2013 18:20
-
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.
-
#6 Reply
Posted by
Psi
on 30 Jun, 2013 00:43
-
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.
-
#7 Reply
Posted by
cthree
on 30 Jun, 2013 00:49
-
Another fine quality video
-
#8 Reply
Posted by
KerryW
on 30 Jun, 2013 03:51
-
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 + supply
Tie 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.
-
#9 Reply
Posted by
bktemp
on 30 Jun, 2013 08:26
-
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.
-
#10 Reply
Posted by
SeanB
on 30 Jun, 2013 10:40
-
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.
-
#11 Reply
Posted by
dentaku
on 30 Jun, 2013 16:14
-
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 this
http://www.muffwiggler.com/forum/viewtopic.php?t=14328 and I see the similarity.
-
#12 Reply
Posted by
JuanPC
on 30 Jun, 2013 18:44
-
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
-
-
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 amplified
Do you think this circuit makes sense.
-
#14 Reply
Posted by
btober
on 01 Jul, 2013 06:15
-
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!
-
#15 Reply
Posted by
Christe4nM
on 01 Jul, 2013 12:34
-
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.
Thanks! That answers the question that I wanted to ask here.
-
#16 Reply
Posted by
Smokey
on 01 Jul, 2013 23:59
-
...I am woking with AD9850 based signal generator. It only outputs a sine wave. And I needed square wave. ...
That 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
-
#17 Reply
Posted by
DBoulanger
on 10 Nov, 2013 05:01
-
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.
I 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 ?
-
#18 Reply
Posted by
cybermaus
on 18 Jan, 2014 18:13
-
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.
-
#19 Reply
Posted by
JMThomas
on 06 Sep, 2015 08:32
-
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?)
-
#20 Reply
Posted by
codeboy2k
on 06 Sep, 2015 21:01
-
You generally want your peak detector to be faster than your sample rate from the ADC. (note: please write ADC [Analog to Digital Controller Converter], 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.
-
#21 Reply
Posted by
lewis
on 09 Sep, 2015 10:21
-
note: please write ADC [Analog to Digital Controller],
Ahem, it's Analogue* to Digital
Converter*British spelling of Analogue.
-
#22 Reply
Posted by
codeboy2k
on 10 Sep, 2015 05:35
-
note: please write ADC [Analog to Digital Controller],
Ahem, it's Analogue* to Digital Converter
*British spelling of Analogue.
*embarassed* yeah, converter... I knew that too, for several years now

I slipped, thanks for the correction, I fixed it.