Electrical – How to calculate Vout on a voltage divider with a diode in parallel to R1

diodesvoltage divider

If you have a simple voltage divider circuit, but with a diode in parallel to R1, how would you calculate Vout? My attempt was a simple voltage divider (.5 * Vin) for Vin < 0.7, then Vout = Vin after 0.7 V. When I attempted this circuit in ltspice, it gave me a continuous function, contrary to my idea. How would this be calculated?

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

Ok. Here we go:

I've taken the equation for the diode current from Wikipedia, it's:

$$ I_D = I_S * (e^{\frac{U_D}{n*U_T}}-1) $$

\$U_D\$ is the diode voltage, \$U_T\$ is a temperature voltage, which is calculated from Temperature and Boltzmann constant. Or you can just approximate it with 25 mV at room temperature. \$I_S\$ is the saturation current and somewhere in the pico to nanoamp range. \$n\$ is the emission coefficient and, according to wikipedia, somewhere between 1 and 2. These are variables that aren't too important for the general form of the curve tho, so I'll just use values that seem somewhat reasonable.

.

schematic

simulate this circuit – Schematic created using CircuitLab

Looking at the above circuit, we know that the current through \$R_2\$ is the combined current of \$R_1\$ and the diode. This can be written as:

$$ i_2 = \frac{u_1}{R_1} + I_s(e^{\frac{u_1}{n*U_T}}-1) $$

From Ohm's Law, we calculate \$u_2 = R_2 * i_2\$. Obviously, the rest of \$U_0\$ has to fall of over \$R_1\$, so:

$$u_1 = U_0-u_2 = U_0-R_2*i_2 = U_0 - R_2(\frac{u_1}{R_1} + I_s(e^{\frac{u_1}{n*U_T}}-1)) $$

which we can rewrite to:

$$ u_1 = \frac{U_0 - R_2*I_s(e^{\frac{u_1}{n*U_T}}-1)}{1+\frac{R_2}{R_1}} $$

As you can see, this equation has the usual voltage divider part in it (\$u_1 = \frac{U_0}{1+R_2/R_1}\$) but also an "error voltage", introduced by the diode that rises exponentially with \$u_1\$ itself. You can also see that \$R_2\$ is factored in with the error voltage.

Since we cannot rewrite this equation in its explicit form, we just put it into Matlab and solve numerically for a sweep over \$U_0\$. My matlab code is the following:

function [ u0, u1 ] = sweep_diode_divider( U0_sweepstart, U0_sweepend, n_sweep, R1_, R2_, Is_, Ut_, n_ )
    syms U0_ R1 R2 Is Ut n U1_ Uc;
    U1_(U0_, R1,R2,Is,Ut,n) = (U0_ - Is*R2*(exp(Uc/(Ut*n)) - 1))/(R2/R1 + 1);

    u0 = linspace(U0_sweepstart, U0_sweepend, n_sweep);
    u1 = [];
    res = 0;
    for u = u0
        res = vpasolve(Uc == U1_(u, R1_, R2_, Is_, Ut_, n_), Uc, res);

        u1 = [u1 double(res)];
    end
end

We can now plot this for plausible values of \$I_s, U_T, n\$ and \$R1=R2=1000\$ and \$0V < U_0 < 10V\$ (calculation takes about 20sec for 100 points):

>> [u0, u1] = sweep_diode_divider(0, 10, 100, 1000, 1000, 1e-9, 25e-3, 1.75);
>> plot(u0, u1)

enter image description here

This is the kind of curve you would expect and that LTSpice also gives me.