# Op amp rectifier : transfer function and output impedance

I'm working on an EE student project which uses a rectifier to keep the peak value of a sine wave. You can find a PSpice pic of the schematics below (Ve is the input (1kHz), Vs is the output).

Op amp rectifier:

I really have problems to analyse this pic. It is quite easy when I replace the diode by a short (and forget about the capacitor for now), then I just have Vs = (2+R3/10k)Ve (the potentiometer R3 gives a variable gain) by considering the op amp is ideal. Until now, it is okay.

When Ve is positive, the diode is on and the upper relation between Ve and Vs is correct, knowing that the 0.6V voltage drop accross the diode is compensated by the op amp. When Ve is negative, the diode is off and the op-amp saturates at -Vsat behind the diode. Until now, is it correct ?

Everything becomes more complicated when we put on the capacitor. It works perfectly to keep the peak value but I don't understand everything yet. When the diode is on, the time constant should be very small, isn't it ? The output impedance of the op amp should be near zero, so the time constant tc = RC is very small, right ?

And when the diode is off, all resistors in the feedback loop (R1, R2 and R3) come in the time constant and tc becomes high, isn't it ? Well, then why isn't the capacitor just following the signal when it is positive ? And stay at zero when it is down ? I'm sure I'm missing something simple, but I don't know what...

And, when the time comes to find the total transfer function Vs/Ve (for both cases when the diode is on and off), I'm completely lost. Just the same when it comes to find output impedance...

Hope I expressed myself clearly (and my English wasn't too bad). Any help would be greatly appreciated.

With the diode shorted, this is just a ordinary non-inverting amplifier. Note that R2 and R3 together form a single resistance, just that it's adjustable from 10 kΩ to 110 kΩ. This provides variable voltage gain from 2x to 12x.

With the diode, everything will be normal as long as the opamp is trying to drive the output higher than it is. The opamp output is actually the diode drop higher than the output at Vs. Due to the feedback, the opamp tries to drive the left side of the diode to whatever it takes to get the desired Vs.

When the Ve input goes lower, the opamp will again try to do whatever it takes on the left side of D1 to make Vs be Ve times the gain. However, in this case it won't succeed. All it can do is slam the output as low as it goes. Since the diode won't conduct, the output is effectively only tied to ground via R1, R2, and R3 in series. If the low input voltage persists, that series resistance will discharge the cap. The waveform will be a exponential decay towards ground with a time constant of (R1 + R2 + R3)*C.

The net effect is that the positive peaks of Ve are followed on Vs with some amplification. In between the input peaks, Vs will decay towards 0. This is sometimes called a "detector" circuit, and the amount of decay between the peaks is intended to be small compared to the value of the peaks themselves. When the input signal is AC coupled, the net result is a voltage proportional to the input amplitude.

You could make a basic detector with just a diode biased properly, but the input and output would be off from each other by the diode drop. This circuit uses the opamp to compensate for the diode drop.

I try to explain everything as clear as possible, but Falstad simulations will help in understand each piece. The links are in the headers

## Non-inverting amplifier:

Let's start from the base, ignoring the diode and the capacitor: you obtain a non-inverting amplifier. Skipping the 100k potentiometer to make the signals more readable, the Op-Amp forces the two inputs to be equal, and the voltage divider makes the inverting input to be half of the output: $$V_{-} = V_{S} \frac{R_{1}}{R_{1} + R_{2}} = \frac {V_{S}}{2} = V_{+}$$ $$V_{S} = \frac {R_{1} + R_{2} + R_{3}} {R_{1}} V_{e}$$

Result: the Output is 2x the Input.

## Rectifier

Now the diode comes into play: in this new circuit, the input follows the output when it's positive, and: $$V_{-} = (V_{S} - V_{D}) \frac{R_{1}}{R_{1} + R_{2}} = \frac {V_{S} - V_{D}}{2} = V_{+}$$ $$V_{S} = \frac {R_{1} + R_{2} + R_{3}} {R_{1}} V_{e} + V_{D}$$

When the input voltage goes negative, the Op-Amp tries to push the output more negative to balance its inputs, but the diode is reverse biased and acts like an open circuit; so, the Op-Amp goes in negative saturation, the inputs are not anymore equal, and the only conductive path to the output is to the ground through the resistors.

What you obtain is a half wave rectifier.

## Filtering

Now let's put in the capacitor. This acts like a low-pass filter, storing the charge when the output is positive and releasing it when it goes to 0. So the charging will be fast, because the current will be supplied by the Op-Amp through the diode, but the discharge will be much slower, because it will happen through a resistance that varies between 20k and 120k. $$V_{S} = V_{sat}^{+} e^{- \frac{t}{RC}}$$ $$RC = 20 \cdot 10^{3} \cdot 4.7 \cdot 10^{-6} = 94 ms$$

So the capacitor will discharge with a time constant ($\tau$) of 94 ms (the time to discharge to 27% of the starting value), but the time between two charges is only half a period (in this case 0.5 ms), so it will go down to

$$V_{S} = V_{sat}^{+} e^{- \frac{0.5}{94}} = 0.994 \cdot V_{sat}^{+}$$

So with the smallest feedback resistance it will discharge to the 99.4% of the peak. The result is a pretty much continuous output voltage, with a small ripple due to the charge/discharge process.

The potentiometer has two effects: in the charging phase, it increases the gain of the amplifier, because R(feedback) becomes bigger and the Op-Amp has to push the output higher to balance the inputs; in the discharge phase, makes the discharge path of the capacitor more resistive, increasing the time constant and so reducing the ripple.

## Transfer function and Output resistance

To describe these parameters, we have to consider separately the charge and the **discharge phases, because the circuit behaves differently between both and it's not possible to define them uniquely.

### Charge phase

As we said, ideally the op-amp and the diode have 0 output resistance, so the capacitor is charged instantly and

V_{S} = \frac { R_{1} + R_{2} + R_{3} }{ R_{1} } V_{e} + V_{D}

Vs = ( R1 + R2 + R3 / R1 ) Ve + Vd

(LaTeX is giving problems)

The output impedance will be the parallel of the capacitor with the series of the resistance of the diode and the Op-Amp. Since both these resistances are 0, so will be the total output impedance.

### Discharge phase

Here it's not possible to define the transfer function, as the output will no longer be dependent on the input because of the diode and the saturated Op-Amp.

The output impedance is shown in the figure:

And it will be given by:

Z_{out} = R_{eq} || \frac {1}{sC}

Zout = Req || (1 / sC) (LaTeX is giving problems)

• (A general note, not just applicable to this answer) I feel a bit uneasy about this use of a simulator. A simulator should be used to verify a design you've made and which you understand. As such it doesn't explain things: you can see what happens, but it doesn't say why this is so. – stevenvh Mar 29 '12 at 9:26
• @stevenvh this answer is a bit a work in progress: I was using the simulator to show what I was explaining, but the second part requires some more work. And now I have a mess with markdown – clabacchio Mar 29 '12 at 9:38
• Thanks a lot for your help ! Sorry for the late answer (I guess you spent a lot of time for it), just too much work these days... Anyway, everything becomes much clearer. Just wondering, isn't the figure '![Rout][4]' lacking ? Thanks for everything. :) – Ryl Mar 30 '12 at 15:24
• @Ryl not so much effort :) no it isn't lacking, there is a problem with the markdown that I still have to fix (i work too :D) – clabacchio Mar 30 '12 at 15:27