# Circuit with diodes and opamp

I have the following circuit for which I am asked to plot the characteristic vo=f(vi) indicating the conduction state of the diodes.

I have never done an exercise that involves both op-amps and diodes in the same circuit, so I am a bit confused about where to start this.

At first I tried to see in what conditions D1 and D2 conduct. I thought that maybe the only way D1 can conduct is if Vt1 is -0.7 V. For D2 to conduct I would say that Vt2 has to be 0.7 V.

Do I need to plot every option? Like if the opamp will be inverting or non-inverting according to to the conducting state of the diodes.

If D2 conducts, then there will be no current going through the non-inverting input of the opamp, so it would be a inverting opamp right? I don't know what to assume if D2 doesn't conduct, though. Will it be inverting or non-inverting? I am also having trouble figuring out if the diodes conduct or not.

This one requires you to know the behaviour of the circuit without the diodes in place, so that's where I'd start. You could cheat, and write down the i/o relationship, from memory, but that's no fun, so let's derive it from scratch.

simulate this circuit – Schematic created using CircuitLab

The trick is to remember that negative feedback causes the op-amp to ajdust its output to whatever potential is necessary to equalise its two input potentials. That means:

$$v_x = v_y$$

Then you have to find expressions for $$\v_x\$$ and $$\v_y\$$, and equate them. First up, $$\v_y\$$. Node y is at the junction of the potential divider consisting of R1 and R2. To approach this intuitively, rather than go full KVL/KCL on its ass, my observations about this arrangement are:

• The total voltage across the pair R1 and R2 is $$\v_o - v_i\$$

• the fraction of that total across only R1 will be $$\\frac{R_1}{R_1+R_2}\$$

• node y will have potential $$\v_i + v_{R1}\$$

Now I can combine that all those snippets in one go:

$$v_y = v_i + (v_0 - v_i)\frac{R_1}{R_1+R_2}$$

The other node x is a bit easier, since one end of the chain R3, R4 and R5 is grounded, so we can just write it straight down:

$$v_x = v_i\frac{R_5}{R_3+R_4+R_5}$$

That's enough for you to derive an equation relating $$\v_o\$$ and $$\v_i\$$, which I will leave for you to do.

You'll need also an expression for $$\v_z\$$:

$$v_z = v_i\frac{R_4+R_5}{R_3+R_4+R_5}$$

Armed with equations for $$\v_x\$$ and $$\v_z\$$, as a function of $$\v_i\$$, you can find values of $$\v_i\$$ at which D1 and D2 start clamping. D1 is preventing $$\v_z\$$ from falling below −0.7V. D2 is preventing $$\v_x\$$ from rising above +0.7V.

Last thing. The equation above for $$\v_x\$$ is only true while D1 is not clamping. To be strictly correct under all conditions, $$\v_x\$$ is actually a function of $$\v_z\$$:

$$v_x = v_z\frac{R_5}{R_4+R_5}$$

Since you're having trouble, I'll complete the exercise. Firstly, solving the above equations to find $$\v_o(v_i)\$$ gives us:

$$v_o = -v_i$$

This will be the relationship when neither diode is conducting.

Let's find the input voltages at which D1 and D2 start clamping. D1 conducts for $$\v_z < -0.7\$$:

\begin{aligned} v_i\frac{R_4+R_5}{R_3+R_4+R_5} &< -0.7 \\ \\ v_i\frac{2R}{3R} &< -0.7 \\ \\ v_i\frac{2}{3} &< -0.7 \\ \\ v_i &< -0.7 \times \frac{3}{2} \\ \\ v_i &< -1.05 \\ \end{aligned}

D2 conducts for $$\v_x > +0.7\$$:

\begin{aligned} v_i\frac{R_5}{R_3+R_4+R_5} &> +0.7 \\ \\ v_i\frac{R}{3R} &> +0.7 \\ \\ v_i\frac{1}{3} &> +0.7 \\ \\ v_i &> +0.7 \times \frac{3}{1} \\ \\ v_i &> +2.1 \\ \\ \end{aligned}

It's clear that there's never a point where D1 and D2 conduct simultaneously, since it's impossible for $$\v_i\$$ to satisfy both of those conditions simultaneously. That simplifies things, since we only ever need to consider one diode at a time, or neither.

When neither diode is conducting, in the interval $$\-1.05 < v_i < +2.1 \$$, we know already that the graph is:

$$v_o = -v_i$$

Consider what happens when diode D1 is conducting, which occurs for $$\v_i < -1.05\$$. In that region of the graph, z is fixed at $$\v_z = -0.7V\$$. All we are concerned with, really, is the slope of the graph in that region, since we can calculate one point that it passes through from the above equation evaluated at $$\v_i = -1.05\$$, which is the point (−1.05, +1.05). We will use this trick for D2 below.

For now though, just for completeness, let's find the entire equation for $$\v_o\$$, using the same technique of equating $$\v_x\$$ and $$\v_y\$$ for this condition where $$\v_z = -0.7\$$:

\begin{aligned} v_x &= v_z \frac{R_5}{R_4+R_5} \\ \\ &= v_z \frac{R}{2R} \\ \\ &= -0.7 \times \frac{1}{2} \\ \\ &= -0.35 \end{aligned}

Now find $$\v_y\$$:

\begin{aligned} v_y &= v_i + (v_0 - v_i)\frac{R_1}{R_1+R_2} \\ \\ &= v_i + (v_0 - v_i)\frac{R}{3R} \\ \\ &= v_i + (v_0 - v_i)\frac{1}{3} \\ \\ &= v_i - \frac{1}{3}v_i+\frac{1}{3}v_o \\ \\ &= \frac{2}{3}v_i+\frac{1}{3}v_o \\ \\ \end{aligned}

Equate $$\v_x\$$ and $$\v_y\$$:

\begin{aligned} \frac{2}{3}v_i+\frac{1}{3}v_o = -0.35 \\ \\ 2v_i + v_o = -1.05 \\ \\ v_o = -1.05 - 2v_i \\ \\ \end{aligned}

This relationship is valid for the region of the graph $$\v_i < -1.05\$$.

Notice that the slope of this relationship (gain) is −2. We could have seen this intuitively from the schematic. With constant $$\v_x=-0.35\$$, the amplifier has become a standard inverting configuration with an offset, for which gain is $$\-\frac{R2}{R1}\$$.

Now we take care of the region $$\v_i > +2.1\$$, in which D2 is conducting. I encourage you to follow the same procedure to derive a complete relationship between $$\v_o\$$ and $$\v_i\$$, but I also want to use the trick I mentioned above, which is to consider only the slope (gradient) of the graph in this section.

When $$\v_x\$$ is constant, this amplifier becomes a simple inverting amplifier with offset, whose gain is determined only by R1 and R2. We do not need to worry about the offset, which determines the y-intercept of the line, because we already know a point through which the line passes:

\begin{aligned} v_i &= +2.1 \\ \\ v_o &= -v_i \\ \\ &= -2.1 \end{aligned}

That's the point (+2.1, −2.1), at the left end of this section of line. The slope of the line as it extends to the right is the gain of the amplifier (the response to changes in $$\v_i\$$ with $$\v_x\$$ fixed to any value):

\begin{aligned} \frac{\Delta v_o}{\Delta v_i} &= -\frac{R2}{R1} \\ \\ &= -2 \end{aligned}

So this section is a line with slope −2, passing through (+2.1, −2.1).

The final graph is easy to simulate, so you could say I cheated:

• I did what you said and found the equation relating vo and vi: vi=-vo. Then i plotted some values for vi to see what values i got in Vx and Vz. For example, for vi=1V i discovered that none of the diodes conduct, since vz is not -0,7v and vx is also not 0,7v. But for Vi=2v, Vx=0,7v so D2 will conduct. So what i did was discover Vo when D2 conducts. I think that Vx=0 in this situation because there will be no current going through R5, since all the current is going to be conducted by the diode to the ground, so Vy is also 0 which makes Vo=-2Vi. //Continuing this in the next comment(almost over) Apr 24, 2023 at 22:25
• For vi higher than 2V, D2 will also conduct right? In those cases vx will be higher than 0.7, is that a problem? Then i plotted negative values for vi, in order to get Vz = -0,7V, that happens when Vi=-1V. I have come to the conclusion that in this case vo=1V. I still have this daught: for values lower than vi=-1V (-2v,-3v,...) Vz will be lower than -0,7v, does the diode still conduct or it only conducts at exacly -0.7v? In your answer you mentioned "D1 is preventing vz from falling below −0.7V. D2 (...) vx from rising above +0.7V." So vx can't be higher than 0,7? (the same question for vz) Apr 24, 2023 at 22:36
• @Aleat A diode conducts for all conditions that cause it to be forward-biased, and when forward biased, a diode has 0.7V across it. That means for all $v_i < -1.05V$, D1 will be forward biased, having 0.7V across it, effectively preventing $v_z$ from falling below -0.7V. We would say that it "clamps node z to -0.7V for inputs $v_i < -1.05V$". Since you're having trouble, I've extended the answer to take you through my thinking for a complete solution. Apr 25, 2023 at 3:27

I will just answer your questions, then you can go through exact VTC (i.e. static vo = f(vin) ) calculations yourself and check against simulations.

I have never done an exercise that involves both op-amps and diodes in the same circuit, so I am a bit confused about where to start this.

When so, I'd advise to go back to theory, in general.

At first, I tried to see in what conditions D1 and D2 conduct, I thought that maybe the only way D1 can conduct is if Vt1 is -0.7 V. For D2 to conduct I would say that Vt2 has to be 0.7 V.

That's right. Then you have to figure out when such voltages are reached. As an example, notice that when both are off, you have $$\ v_x = v_i / 3 \$$; now let vin increase, eventually (when?) v_x reaches 0.7 and D2 is on, fixing v_x at 0.7.

Do I need to plot every option? Like if the OpAmp will be inverting or non-inverting according to to the conducting state of the diode

Yes. But notice diodes cannot be both active for same voltage polarity you're analyzing.

If D2 conducts, then there will be no current going through the non-inverting input of the OpAmp, so it would be a inverting OpAmp right? I don't know what to assume if D2 doesn't conduct though. Will it be inverting or non-inverting? I am also having trouble figuring out if the diodes conduct or not.

If your opamp is ideal, then it is always $$\ i^+ = i^{-} = 0 \$$. It's indepedent of topology, only on your opamp electrical model. So your conclusions are incorrect. Also, you're mixing feedback with other things.

The circuit will be piecewise linear (assuming otherwise ideal diodes with some fixed Vf such as 0.7V). It should be obvious that both diodes cannot conduct at the same time, so you have 3 possibilities- no diodes conducting, D1 conducting, D2 conducting.

So your task is to find the two points at which the diodes start (or stop) conducting and the transfer function or at least the gain (which is the slope of Vout/Vin) for each of the three regions. If you just calculate the gain, you'll also need at least one point to fix absolute value.

To get started, with no diodes conducting (you've correctly determined where each diode starts to conduct) the output will be k*Vin, where k can be calculated. So for Vin = 0, Vout = 0, this also gives you the output voltages at the two points of inflection once you calculate the input voltages where that happens. Beyond each point of inflection, the slope will change.

Since T1 is just 2/3 Vin and T2 is 1/3 Vin (at the points where the diodes just barely start to conduct) you can equate those to the appropriate diode drops of -0.7V and 0.7V respectively, to find the points of inflection. The gains can be calculated by replacing the conducting diode with a voltage source equal to Vf and ignoring the blocking diode.