Peak detector problem - Page 1
Forum section: electronics / projects

author: elki
author_rank: Regular Contributor
timestamp: May 09, 2023, 08:25:14 pm
content: Hello,I am trying to simulate a basic peak detector circuit (please see below). Naively, I would expect it to look for positive voltages, while it happens that it mainly hunts for the negative ones .. Would appreciate any ideas of why it could happen!Thanks in advance!

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 09, 2023, 09:02:59 pm
content: I don't see anything fundamentally wrong with your schematic. Please check that the Spice model for the opamp is valid and that you have set up valid power supplies for V+ and V- (which we don't see on your schematic).Other than that, it should work albeit with a voltage drop due to the diode. I would place the feedback loop after the diode rather than before. In practice, you'll also probably need a way of resetting the peak detector - can be done with a NMOS in parallel with the output cap. for instance.

author: Benta
author_rank: Super Contributor
timestamp: May 09, 2023, 09:27:05 pm
content: Check the pin numbering in the D1 Spice model.Spice expects anode=1, cathode=2. Standard pinout for most diodes is the opposite.Use the "Alternate pin sequence" in KiCAD to correct this.Tip: always check the "Show pin numbers" box for ALL symbols on your schematic. It helps no end when troubleshooting.

author: elki
author_rank: Regular Contributor
timestamp: May 10, 2023, 04:20:24 am
content: Thanks a lot for the quick feedback

author: inse
author_rank: Super Contributor
timestamp: May 10, 2023, 05:16:50 am
content: What’s puzzling me is that you have two scales on your diagram while both of your signals are labeled as voltages - is that assigned correctly?As already stated before: put a discharge resistor parallel to the storage capacitor otherwise you will only detect the highest peak of all times.What kind of signal peak do you want to detect?I just noticed the OPAMP is a current feedback type, are you familiar on how they work ( I‘m not so)

author: elki
author_rank: Regular Contributor
timestamp: May 10, 2023, 06:14:05 am
content: Thanks again for all the replies.A few observations:1) As Benta pointed out, the alternate pin sequence has to be used for diode in KiCAD.2) SiliconWizard, yes, an additional resistor to the ground on the output part was planned to be added3) inse, while the main issue was the diode polarity, there is indeed something to be understood concerning the operation mode of the current-feedback op amps. The main idea is to find the peak voltage of relatively short pulses (1us or so) of positive polarity with these op amps (which also have rather high slew rate).The corrected schematics works as expected now, thanks. The evil was the diode pin assignment. Nevertheless, I see some cases of the input pulses, when I have to add one more diode right at the output of op amp in reverse direction, otherwise it does not seem to be be operational and saturates the whole thing to supply voltage right at the first pulse. I believe it has something to do with the op amp being of a current-feedback type. Please see the working example below (part of the schematics is shown with input and output oscillograms, since the whole thing is rather big). The non-working case is shown in the last two screenshots.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 10, 2023, 06:24:32 am
content: The circuit with the extra diode is a btd strange. It depends on the OP-amps bias current to work or fail. The simple circuit shown is just a voltage follower and than a simple diode and capacitor peak detector. It works, but is not very precise, as the diode drop reduces the output voltage and this drop is temperature dependent and with short pulses and the relative large capacitor the current through the diode also effects the drop. With similar pulses to look at this may still be OK. The more standard, more precise circuit used 2 OP-amps. An additional OPamp buffers the storage capacitor and the feedback is from the buffer. It is however a bit tricky at high speed.