# Peak detector is not working when voltage is changed

I am trying to design a peak detector in Multisim simulation tool. I have designed buffered peak detector to get peak voltage of sine signal. The designed circuit is working when signal voltage is constant, for example when signal voltage changes from 1V to 0.5V then it is giving 2V as peak detector output. The designed circuit as shown below.
In the above circuit I am using switch to change the voltage of sine wave from 1V to 0.5V. I am using one more switch to clip negative cycle of sine wave, then i am using buffered peak detector to get maximum voltage.

When i apply 1V sine wave it is working perfectly and giving peak voltage as DC. The problem is when I change signal voltage from 1V to 0.5V then also it is giving 1V as peak. ANy one suggest me what mistake i am doing. I want to design peak detector that will give max voltage even there is voltage variations. I am trying to attach Multisim file but it is not possible for me. I don't know how to attach file so i have added image.

So let me see if I understand this. You give it a peak of 1.0v and it detects it correctly. Then you back it off to 0.5v and it still reports a 1.0v peak. What's the problem? 0.5v is not the peak if the voltage also goes up to 1.0v.

I suspect that what you want is to detect a peak "over some amount of time", and not a peak "over an infinite amount of time".

If I am following your schematics correctly, you need some way to discharge C1 so that it can detect the next pulse. There are several ways to do that.

One way is to have a transistor/MOSFET/relay actually short C1 to GND. Then have some circuit that will periodically trip that.

Another way is to simply put a resistor in parallel with C1. This resistor would cause the peak value to decay over time. Change the value of the resistor to change how fast it decays. If the resistor is connected to GND then the decay will be a somewhat inverse-square curve. Use a constant current source to make it more linear.

• I have small doubt if i add resistor to discharge capacitor C1, is there any formula to calculate charging and discharging time. My voltage will vary at every 100 ms thus peak detector has to give max peak. So how to find the exact values of capacitor and resistor combination? is it 1/2*piRC? – verendra Nov 21 '12 at 8:32
• @verendra Simply multiplying R and C will give you the time required for the voltage on C to be reduced by 63.2%. – user3624 Nov 21 '12 at 14:54

The parallel resistor method works fine. Here is a design I've worked with that does exactly that. You'll need to turn the RC for your input signals time constant. 2.2RC will get you close (86%), 5RC gets you spot on (99.3%).

For a great explanation of RC time constant see: RC Charging. They provide a table like the below for a shortcut to the complicated equations.

Time
Constant            RC Value      Percentage of Maximum
Voltage  Current
0.5 time constant   0.5T = 0.5RC    39.3%   60.7%
0.7 time constant   0.7T = 0.7RC    50.3%   49.7%
1.0 time constant   1T = 1RC        63.2%   36.8%
2.0 time constants  2T = 2RC        86.5%   13.5%
3.0 time constants  3T = 3RC        95.0%   5.0%
4.0 time constants  4T = 4RC        98.2%   1.8%
5.0 time constants  5T = 5RC        99.3%   0.7%