Electronics - Positive and negative Peak detector circuits and models

   Created; 19-03-2016, Changed 14-04-2018 to 19-04-2018

Circuit modelling tools used;

  • SiMetrix 6.20 & 8.10 This pspice circuit modelling tool that I use is the capacity limited free version. It has excellent circuit entry and adding spice models you just click and drop them into the command window and then when you use the part first time you may define the symbol and pins if it has not already worked that out for you.
Be careful when creating new models it is very difficult to get rid of them or replacing them if they are wrong. I think I managed eventually but there is no help on that point in version 6.20. I believe that ADI's simulator isd based on SiMetrix and they also support LTspice but I do not know how that will change now that Analog Devices now own Linear Technoligy.
  • TI-Tina 9 This simulation tool is not capacity limited and does not require the use of at least one Texas Instruments part. Adding other models is a bit fiddly at first but easy when you know how!
Some of these circuits functions have also been modelled using; LT Spice IV


The proposed peak to peak detector;

There is a problem with the transistors in this model. The circuit requires the model to operate with some currents below the values that are specified in the data-sheet. An alternative and better explanation is that the inter-electrode capacitances of the transistors couples a false feedback signal and that results in  the peak detection not occurring. The problem is apparent because the transistors E-C voltage drop is higher than 1mV expected. (SiMetrix AL-0017-03F)

The transistors have an inter-electrode capacitance of ~20pF so in AC terms all electrodes are connected together. That inter-electrode capacitance is small in comparison with the output load but large in comparison with the feedback. This is, conversely to the reasoning above, likely to be useful in making the transition in polarity smooth. The circuit is limited potentially by the number of components possible on the PCB and simulation is limited by SiMetrix but that is no so severe.
The diagram above is for; +-25mV 100Hz input x10.

The design is not good initially but this circuit, the b-c voltage drops when the transistor is on looks wrong. Red is the positive output. Other waveforms are lost. The Blue is the op-amp output.
 The diagram above is for; +-25mV 2.5mS rise fall and width input x10 as the previous graph. 

 I have zoomed in around where the output settles to about the expected value.
  • Red is the positive output,
  • Green is the negative output,
  • Blue is the op-amp output,
  • Grey-ish-Green is the feedback that should closely (within 1mV) follow one or other output when there is current flowing but it does not.
2.5mV x 10 the model. different scaling

As before the circuit is not working at this scale we can now see that the transistors do not switch on and charge the capacitors although there is adequate base current for this to happen. There is not adequate emitter or collector currents. I do not think the model operates correctly with some of the transistor currents below what is specified in the data sheet. Specifically operate below collector, emitter currents and the specified hfe values given data sheet.

Some variations of this circuits parameters caused SiMetrix to stop with an error. This may be a problem with the op-amp model? This is because a similar Time step error happened more often when using LT Spice IV.

More-or-less the same circuit but for the use of a Texas Instruments operational-amplifier. The model now works over a significant signal range but with unacceptably low value feedback resistor. This compromises is usefully because we can see some more characteristics of this function and it is all as expected. (Tina-TI AL-0018-03B)

The Tina modeller shows function where the SiMetrix does not but gives a warning. The models are use different for the transistors and but also the Tina-TI is not limited in capacity and both points are significant. These transistors operate at particularly low current and very flat gain characteristic, are low noise and low leakage current but the saturation voltage is not good and is not specified at low current.

These alternative transistors BC849 and BC859 have specified gain to a lower current but do not have a good and specified saturation voltage at low current by comparison. So there is limited some value in putting them in the model. It is a just to see what happens step - which can be very enlightening.
Input +-2.5mV x10.

The circuit is working well and works down to +-25uV x10. Unfortunately the op-amp is not really suitable because of its high input current Although fine with this set of conditions - that is with a low value feed back resistor. 


A possible explanation for why the circuit with transistors can not be modelled.

The maximum; (for the first circuit on this page but not the one immediately above)
  • Base Collector cut off current is 15nA at 25'C and 4uA at 150'C 
  • Base Emitter cut off current is 100nA at 25'C
  • But the hfe is 150 at 10uA (BC848) which give; Ib = 67nA. Max hfe for BC849/BC859 is 800 at 10uA would corresponds to Ib = 12nA.
  • All of these typical room temperature currents are below the 500nA or so that the hold capacitor bleed resistor current that must pass through the base electrode as a minimum. It is also true to 45'C (two doubling of currents for every 11'C)
  • The transistors in this circuit do not have a good or specified saturation voltage at low currents unlike the FMMT617/FMMT717 parts. But they model well and are good in other ways. It is necessary for transistor saturation to be good and specified for this application. BC848 and BC858 should not be used. 
  • Another explanation is that the transistor's capacitance between B & E is significant when the signal is small. That capacitance only needs to be small to be significant compared with the high impedance feedback, creating a false feed-back.
The minimum feedback resistor current at normal gain would be 67nA and this would correspond to an output voltage of about 33mV (for the 470K feedback resistor). At this current the transistor would be turned on and current probably would be flowing between the emitter and the collector but the model shows the emitter current coming from the base but not the collector. The model struggles probably because these figures are in any case beyond the given data.

The modelling does not advise me where limitations of the model has arisen but it does behave a little differently with different the transistors used. This is the most unusual circuit which is partly why I have chosen to evaluate modelling tools using these circuits. I have refined the conventional design as well.
Input +-25mV x10. 

The circuit is working well but driving with square waves does not show function clearly because the transistors turn on or off so we do not see any linear transition region. But we do see the circuit work very well with a fast step input.
Input +-25mV x10 Zoomed in. The small square wave is the input signal.  

The large square wave is the feedback it looks clean which is expected of the smooth transition in polarity due to the nature anticipated of the transistor circuit.

Input +-25mV x10 Zoomed in. The small square wave is the input signal.  
The large square wave is the feedback it looks clean which is I expected of the smooth transition in polarity due to the nature anticipated of the transistor circuit.
Input +-2.5mV x10 Triangle wave input shows the linear region.
The big signal is the op-amp output. The triangle is the input. The two near horizontal lines are the two rectified outputs.

Input +-2.5mV x10 triangle zoomed into the top of the peak.
We can see that the feedback resistors (which is too lower value) causes the discharge rate to increase when the transistor turns on then we see a spike of voltage that will correspond to high charging current flowing into the hold capacitor.
Input +-25mV x10 triangle.
A larger signal shows the characteristics describe above more clearly.
Input +-25mV x10 triangle zoomed in.
A larger signal shows the characteristics describe above more clearly.
SiMetrix model but of a very similar circuit as the previous circuit.
This model which uses a different pspice for the transistors does not work as well as the Tina-TI but it does work better using FMMT617 and FMMT717 transistors instead of the ones shown. The data-sheet show a flat gain for 10uA to 10mA the transistors for the transistors shown. The model can not make assumptions beyond what is not specified evidently? (AL-0017-04A)
Input 2.5mS rise and fall top and bottom plateau  +-50mV x10.
  • Blue - op-amp output.
  • Red - Vibration+
  • Green - Vibration-
  • Dark Green - Feedback (Transistor emitters)
The above circuit (Tina-TI AL-0018-04B) has another op-amp but operating in comparator mode 

TLV7211 CMOS comparator would also do the job but there is a benefit in using a an op-amp that the slower means there would be less noise in this function block. Modern rail-rail op-amp's work reasonably well as comparators but take care this can make the output very slow when coming out of saturation but that restriction is rarely the case in newer op-amps. The additional op-amp has allowed the circuit resistor R9 to be increased to 10M instead of about 10K and this prevents significant current being drawn out of the holding capacitors C5 and C6. The extra comparator makes the simulation look alright.

The circuit has now become more complex and the main point of developing this novel design was to minimise the component count. It now theoretically achieves all that is required although not over a wide temperature range.


A nearly conventional solution (below) works best and is a safe choice although it uses more components. The transition is not so smooth during signal polarity change as with the transistor circuits. This circuit has a lot of latitude for optimisation and improvement by comparison and is more model-able because components are all working within parameters specified in the data-sheets. For example the hold capacitor could be smaller making the frequency response higher. The circuit does not show the first amplifier. 

See below the diagram imediately below is the circuit that this circuit is derived from.

AL-0017-02B Full wave rectifier followed by a peak detector.  

Notice the feed back capacitor is located similarly to the peak detector but for the full-wave rectifier. I have therefore applied the lesson discovered and discuss elsewhere. 
+-200mV 50Hz sine wave input.
  • Blue - half wave rectifier output. 
  • Green - Peak detector op-amp output. 
  • Red - peak detector.

The peak detector circuit above is derived from precision signal rectifier below. - This function is not useful in this case. See below;
 Conventional precision signal full-wave rectifier (AL-0017-06A).

Look at that first should help explain how it works - Output is; Halfwave output is x2 - x1 the input. C2 is 1pF and is for circuit stability but if increased to 100nF would change the function to rectified and average.

    • Left; Green is the output waveform, blue is the half wave rectifier stage X4. (AL-0017-06A). 
    • Right; Green is output waveform. Increased C2 to 100nF provides output averaging and is a typical variant of this circuit. (AL-0017-07A).

    The last diagram may not be useful in this application. The application was for various sensors on a machine so peak vibration probably will be more useful in warning of failure or maintenance required. More likely simply connecting the output of the motion sensor amplifier to an A/D input would give more detail because it is raw data so that a noise spectrum analysis could be so you may determine individual part failure eg bearing failure in a micro-wind turbine. This is as the first circuit on the theoretical example page is implemented.


    1. Thank you for the very instructive article.
      I remember our technical specialists were working on the issue that took place in one of our data centers. That center must maintain the data room service. So we have implemented similar scheme.

    2. Wow, its great post, its really important to understand how it works.
      Its like my dissertation work, thank y.
      security online

      1. Possibly like your dissertation work I was satisfied with what I had developed over 35 years ago. I later find that it was the standard circuit anyway but with an extra diode that speeds it up a bit. Then to look again all this time later and refine the circuit even more because of the power of the simulation tools have allowing me the conveniently change things that I could not do conveniently do repeatedly with a soldering iron - so I stopped then.

        We never stop learning but I think I have learnt how to explain in words well since I was 19.

    3. April 2018 - changes being made.