I have the following circuit I'm looking into (it's actually a section of a larger design)


simulate this circuit – Schematic created using CircuitLab

V1 has an input range of 0 to 4V. Vout I suspect, would be 0V for the entire duration.

However, when I simulate both here and using LTSPICE, I get a non zero answer.

I am unsure as to why.

It would seem that I am in fault since two simulations do not give me a non zero answer(although the simulation done here and on LTSPICE are also different from each other) and this circuit is "known" to work.

What am I missing ?

edit Updated schematic with R3.

  • \$\begingroup\$ That you're not using a rail-to-rail op amp. \$\endgroup\$ – Ignacio Vazquez-Abrams Sep 29 '14 at 6:35
  • \$\begingroup\$ @IgnacioVazquez-Abrams The actual opamp being used is a LM358, but in this case, why would it matter if its rail to rail or not ? \$\endgroup\$ – efox29 Sep 29 '14 at 6:37
  • \$\begingroup\$ What does "non-zero" mean? \$\endgroup\$ – Andy aka Sep 29 '14 at 7:37
  • \$\begingroup\$ @Andyaka I would have expected something near zero. LTSPICE shows about ~5V and CircuitLab is 4V for an input voltage of 4V. \$\endgroup\$ – efox29 Sep 29 '14 at 7:42

This is actually a useful circuit- for low frequencies it acts as a precision rectifier.

For inputs < 0V, the output is -0.5*Vin

For inputs > 0V, the output is +0.5*Vin (if loaded with a 15K resistor to ground or a virtual ground, which I suspect your inverting stage has-- 15K and 30K to yield an output voltage of -|Vin|).

Edit: You always get a positive output voltage from this circuit fragment. The 15K you mention is just to allow the op-amp to swing very close to the negative rail (ground).

If the input voltage is less than zero, it acts as an inverting amplifier, the op-amp output drives the diode anode to a voltage equal to -0.5*Vin (the op-amp output itself will be a bit higher to account for the diode drop).

If the input voltage is greater than zero, the op-amp saturates at the negative rail (ground) the diode is reverse biased, and the circuit looks like a 15K resistor. Hence, if you load it with 15K it will have an output of 0.5*Vin (voltage divider).

In the below top schematic, the shown (different) Vout = -|Vin|. Of course the second op-amp requires a negative supply, but the first one does not.

In the below bottom schematic, Vout = +|Vin| and neither op-amp requires a negative supply.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Actually, I forgot to add it, but there IS a 15k resistor going from the cathode of the diode to ground. But how can you get a negative output when its powered from a single supply ? I get that its a precision rectifier since the opamp compensates for the diode drop, but in this case - is that true ? \$\endgroup\$ – efox29 Sep 29 '14 at 16:42
  • \$\begingroup\$ Please see edit. \$\endgroup\$ – Spehro Pefhany Sep 29 '14 at 17:00
  • \$\begingroup\$ I'll have to relook at this circuit again. If what you said is indeed true, then this circuit makes sense in the larger design. Clever actually. \$\endgroup\$ – efox29 Sep 29 '14 at 17:12
  • \$\begingroup\$ One more edit in case the second amplifier is actually non-inverting. \$\endgroup\$ – Spehro Pefhany Sep 29 '14 at 17:53
  • 1
    \$\begingroup\$ I reran LTSPICE and chose a different opamp, and the results are as you said. It makes sense now. So basically when the signal is positive, the opamp is essentially bypassed, and when its negative, the opamp is used. Nice. \$\endgroup\$ – efox29 Sep 29 '14 at 18:37

Vout is not the output of your opamp. If you would add another tag and check the actual output of the opamp you will see it is always set on 0V because you have an inverting configuration without a negative rail so you force the opamp towards the ground voltage which is 0V.

So, the output of the opamp can be looked at like 0V, the same as if the diode's anode would be connected to ground. The input of the opamp has almost no current flowing in so it is almost an open circuit. The diode is also reversed biased so can be looked like open circuit. Finally, you get a voltage source with two resistors is series and you are checking the voltage on the farther away one, this will be the same voltage as the voltage source because all the voltage falls on these two resistors.

  • \$\begingroup\$ Which is something I thought of as well, then it makes me wonder what the point of this circuit is. The next stage is a non inverting stage with an overall gain of 2. \$\endgroup\$ – efox29 Sep 29 '14 at 6:40
  • \$\begingroup\$ @efox29 in the shown configuration, the circuit is a faulty design. It might serve some educational purpose, but being not in any context it is hard for me to determine anything more. If the next stage has the non-inverting input connected the diode's cathode, the output would be between 0V to 8V as you sweep the voltage source. \$\endgroup\$ – user34920 Sep 29 '14 at 6:43

Start by assuming the diode is a short circuit....

With a positive input voltage, the op-amp will try and force the inverting pin to be the same potential as the non-inverting pin (0 volts) by taking its output negative. That would happen in normal circumstances if there was a negative supply for the op-amp. Given you have no negative supply all the op-amp can do is drive its output hard against the 0 volt rail.

Now add the diode back in....

The op-amp output is at 0 volts and there will be a positive voltage from V1 (via the two resistors) applying itself to the cathode of the diode. This reverse biases the diode therefore, the op-amp output no longer has any influence on the actual circuit output.

The actual circuit output voltage then becomes the input voltage V1. In reality there may be a tiny trickle of input current into the op-amp's input that very slightly reduces the output voltage by a few millivolts BUT, your circuit might as well be V1 connected to Vout via 15kohm - the op-amp does nothing for positive inputs.

  • \$\begingroup\$ I've spent some time looking at this thing, thinking where I got lost. This circuit is used in a design (2 years) and is giving some headaches now. I was following through and I came across this, and it just didnt make any sense to me. Now that both you and User34920 confirmed that this is pretty much useless, I can move on. Looking at circuits at 435am...not always easy. Thanks! \$\endgroup\$ – efox29 Sep 29 '14 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.