op amp based peak detector issue - Page 1
Forum section: electronics / beginners

author: lk.dgironi
author_rank: Regular Contributor
timestamp: May 28, 2024, 12:21:26 pm
content: Hello,I'm working on a peak detector based on op amp.I'm using a NE5532, dual rail supply +-2.5V, to detect +-1.8V.You can find simulation and schematic attached.I'm using a signal generator to test it.The problem I've found is that if I inject +-1.8V or more directly before R1, without having the voltage follower in "A" populated, it work. With "A" populated it works only with positive voltage (>1.8V), if I inject a negative voltage (ex. -1.8V), U read on pin 7 -1V almost, it never goes below that threshold.I can't get why. Anyone can explain this to me?Thanks!

author: jwet
author_rank: Frequent Contributor
timestamp: May 28, 2024, 04:00:21 pm
content: The 5532 is not designed to operate with only 5v across it. Though it says on the cover sheet of the data sheet, that it will run with +-3v to +-18v rails, this is kind of misleading. The problem is that the input common mode range has be to be 2-3 volts from each rail so at 2.5v, your common mode voltage is gone and all op-amp mojo goes away. The lowly LM358/324 would work ok in the spot, it can sense down to ground and within a volt and a half of the high rail. There is no need for a low noise 5532 amp for an aux function, save these for your signal path. You can also alleviate some pain by scaling the input with a voltage divider, you generally never want to run a rail to rail signal through a follower- there are rail to rail amps and you can do it but its not great (study CMMR and linearity).When you put that follower in, nothing happens, its input is never active. Plug in a single supply amp like a 358 or better and it will work more or less.It will work but there are many better peak detector schemes, look at the app notes on Elliot Sound Products site or A of E. At these low voltages, you might want to look at "ideal" rectifier type circuits where the voltage drop of the diode doesn't get in the way so much.Good luck, I hope this makes sense.

author: Terry Bites
author_rank: Super Contributor
timestamp: May 28, 2024, 05:37:57 pm
content: Context please.This is not a peak detector, more of a clamp. See attached showing the waveforms it would present to the comparator.Input range from 0.5V to 5VIs this what you are expecting?Peak detectors measure the maximum input amplitude and hold it until reset or the charge leaks away.https://www.youtube.com/watch?app=desktop&v=jllsqRWhjGMAs lk.dgironi says, most opamps won't work as comparators.Some do, a TL07x for example.What is your Applcation? auto trigger, clipping detector, peak detection...

author: Benta
author_rank: Super Contributor
timestamp: May 28, 2024, 05:59:21 pm
content: Why is U1A running at unlimited gain? Seems you've built a not very good, but very complicated comparator.

author: shapirus
author_rank: Super Contributor
timestamp: May 28, 2024, 06:03:43 pm
content: I'll just leave this here

author: MathWizard
author_rank: Super Contributor
timestamp: May 28, 2024, 10:18:41 pm
content: In real life, what are the chances Vnon-Inv=Vinv, and it won't take much difference to make the output hit a rail.I was trying to add a basic continuity tester function to some of my DMM's, and they sort of work, but not great. Trying to use op-amps just as comparators hasn't work great for me either. I need to try again with positive feed-back type circuits, and hysteresis.

author: shapirus
author_rank: Super Contributor
timestamp: May 28, 2024, 10:24:39 pm
content: Quote from: MathWizard on May 28, 2024, 10:18:41 pmWhat were the problems in those cases?I think I did use op amps as comparators a couple of times, IIRC they were some rail-to-rail output ones. They worked fine, of course the saturation recovery time had to be considered.Non-RRO op amps should still work, with the exception that the output won't swing all the way to the rails. Were there any more serious issues?

author: Benta
author_rank: Super Contributor
timestamp: May 28, 2024, 10:30:48 pm
content: Quote from: MathWizard on May 28, 2024, 10:18:41 pmIt never works great. Opamps are not built for that job.Opamps are built for circuits where the inputs are kept at equilibrium. "Overdriving" an input mostly results in saturating internal stages, causing all kind of problems.Comparators are designed for overdriving and will respond correctly and quickly.

author: MathWizard
author_rank: Super Contributor
timestamp: May 29, 2024, 04:05:12 am
content: The main problem I remember was, I'd set some voltage divider level, from 10-turn pot from some Vref circuit. And it would be working when compared to some small resistance like 5 ohms. But then the next time I'd turn it on, stuff might be moved a few 10's of mV up or down, and then it might not trigger from 50 ohms, or already be triggered.It worked ok in LTSpice tho, but neither 1 was a great design.

author: lk.dgironi
author_rank: Regular Contributor
timestamp: May 29, 2024, 08:45:56 am
content: Thank you all.You are right, I mislead the terms peak detector, I just need a circuit that turn on a lead when voltage goes above or below +-2V almost, supplied with +-2.5V.By the way it's for a null detector.I've try replacing my 5532 with one 358 that I've here but it does not works as expected.I've notice in my previous simulation I was using a 741. Maybe the 6002 (or a couple of 6001) can do the job. Or at least it seems from simulation (find attached).What's your opinion?

author: shapirus
author_rank: Super Contributor
timestamp: May 29, 2024, 09:22:15 am
content: Quote from: lk.dgironi on May 29, 2024, 08:45:56 amSearch for "window comparator". That's a classic building block.(but beware of the input voltage being too close to the power rails -- check the datasheet of the specific comparator you'll be using to make sure it supports the range you need)btw up to this point this is a job for acomparator, not an op amp.Quote from: lk.dgironi on May 29, 2024, 08:45:56 amNull detector sounds like a yet another different thing. What exactly does it need to do?

author: ArdWar
author_rank: Frequent Contributor
timestamp: May 29, 2024, 09:22:17 am
content: Quote from: lk.dgironi on May 29, 2024, 08:45:56 amNeither will workQuote from: lk.dgironi on May 29, 2024, 08:45:56 amItmayworks.You're working awfully close to supply rails. Get RRIO opamps. Watch out for phase inversion. Also input protection diodes and maybe overdrive recovery time too on the second opamp. If you're useing two separate opamp then might as well use comparator for the second one.

author: lk.dgironi
author_rank: Regular Contributor
timestamp: May 29, 2024, 09:27:32 am
content: Thanks!The null detector output is connected to a multimeter, I just want to know if the null detector op amp is going to saturate, so I need a +-2V almost visual detection. It's just a plus.I will try the 6002, just have to find one.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 29, 2024, 09:40:50 am
content: There are plenty of CMOS RR op amps for 5 V operation similar to the MCP6002.The standard window comparator circuit with 2 comparators (e.g. LM393 or maybe a modern more RR type) could be more versitile. The proposed circuit is just simpler for the specific limits set by the diodes and if the initial buffer is not needed.

author: lk.dgironi
author_rank: Regular Contributor
timestamp: May 29, 2024, 10:00:02 am
content: Thanks!@Kleinstein I'm speaking about a post you already know, the one here:https://www.eevblog.com/forum/metrology/null-detector-based-on-conrad-hoffman-design-checkwhich I've posted from my non-job profile.There I'm yet using the MCP6001, maybe i can skip the U4B stage and use just a MCP6001 instead of the MCP6002. What's your opinion?

author: Kleinstein
author_rank: Super Contributor
timestamp: May 29, 2024, 11:03:34 am
content: It is OK to skip the buffer U4B and take the signal directly from U3, not from behind the 100 ohm resistor. One could still combine 2 x 6001 to ine chip.

author: lk.dgironi
author_rank: Regular Contributor
timestamp: May 29, 2024, 12:03:22 pm
content: You mean like this?Thanks!

author: Terry Bites
author_rank: Super Contributor
timestamp: May 30, 2024, 06:36:18 pm
content: Save yourself from eternal damnation. Use a window comparator.Led is on when Vin is outside +1.8V or -1.8V. Simple, cheap works.

author: lk.dgironi
author_rank: Regular Contributor
timestamp: May 31, 2024, 07:12:48 am
content: Thank you!Meanwhile I've tested the MCP6001 version, it works too.If anyone interested find attached the simulation files.

author: Terry Bites
author_rank: Super Contributor
timestamp: May 31, 2024, 04:20:12 pm
content: If you try this circuit with opamps you need to connect to the LED via diodes.Adjust the LED resistor to accomodate Vf.