# Calculating an operational amplifier with changing power source

I've been stuck since days to calculate an operational amplifier circuit used as an under-voltage protection. At first my design:

simulate this circuit – Schematic created using CircuitLab

The main problem here is the changing supply voltage $V_{dd}$. It slowly varies from 9V to 17V and the other way round (battery). I would like to have the switch occurring at 10V and 10.5V respectively. For calculating the hysteresis I would use

$$\Delta U_e = \frac{R_2}{R_{1}}(U_{a,max}-U_{a,min})$$

Ignoring the small output swing from rail $U_{a,max}$ is essentially $V_{dd}$ and thus varying. So there are two solutions one for $U_{a,max}=10V$ and one for $U_{a,max} = 10.5V$. Assuming a 300k resistor for R1 and a 14.6k resistor(not existing) for R2 the error should be pretty low. The main problem comes with finding an analytical formula for calculating the potential at the input of the opamp $U_+$. Since $U_+$ is depended on $U_{out}$ I don't know how to calculate the voltage divider R4 and R5 to get the switching points as mentioned. (For the diode i chose a 6.2V)

• It's not that difficult; there are only two interesting values of the output voltage. So you'll end up with only two values for Vin+(and a very weak dependence on Vdd thanks to the zener's slope resistance). (There is another problem, however; I think you are applying hysteresis in the wrong direction) – Brian Drummond Mar 14 '18 at 17:52
• Undervoltage protection must behave in predictable manner as the VDD rises up from Zero volts. How to ensure that? – analogsystemsrf Mar 15 '18 at 2:13
• @BrianDrummond From the diodes perspective you're right. Thats why I used it as reference voltage. But Vin+ is also dependent on the output which is highly dependent on the powersource Vdd itself. What exactly do you mean with wrong direction of the hysteresis? (R1 is the resistor to the output so it should be okay) – menjuel Mar 15 '18 at 9:48
• @analogsystemsrf The circuit shown above is already well defined and behaves in a predictable manner. What I want to know are the exact equations which are describing the circuit so that I'm able to assign values to my parts. – menjuel Mar 15 '18 at 9:48

Typically, over a fairly wide range, you can approximate the output voltage when railed at the positive or negative supply at Vout as Vcc-kp or GND + kn, where kp and kn are some voltage like 0.1V or 1.5V and are dependent on the output circuit of the op-amp (and loading).

It's a voltage divider. Ignoring output drop (which you can't do with the shown op-amp) & ignoring zener impedance and assuming it's biased appropriately by R3, we can write the equations by inspection.

When Vout is low it's Vin+ = $\frac{R1}{R1+R2}V_Z$

When Vout is high, it's Vin+ = $(\frac{Vdd}{R1} +\frac{Vz}{R2})(R1||R2)$.

The first equation applies when Vout is low, so it's only of concern at the lower Vdd switching point in your design. The second applies when Vout is high, so it's only of concern at the higher Vdd switching point.

For example, if Vdd is 10V, Vz is 5V, R1 is 100K and R2 is 10K, Vin+ will be 4.545V or 5.454V depending on your intent.

That answers your question- to actually design this circuit for given voltages involves some algebra to re-arrange in terms of desired switching voltage, which I will leave to you.

As an aside- designing undervoltage protection circuits is actually non-trivial and perhaps you should just buy one. Before the zener is properly biased (low Vdd) the voltages at the inputs do not follow the above equations and there may be plenty of mischief a circuit can get into below voltages that will bias a zener or normal voltage reference. A commercial circuit will have guaranteed output stated down to below some fairly low voltage (probably < 1V), which is more than adequate to protect most power devices and often is enough to prevent NV memory corruption.

• You are talking about the output-swing from rail which I mentioned is neglectable in my case. I want to know the formula for calculating the potential Vin+. – menjuel Mar 15 '18 at 9:54
• Thanks a lot! This was kind of what I was searching for. But how did you come up with this equation (the second one)? I just don't know how to get there. I feel pretty dumb right now.I know it can not be that hard, but I got a brain freeze with this topic. But still, there needs to be one general equation for describing this voltage Vin+. So that for example, when the high state changes to the low state the formula you posted for the high state would merge into that for the low state. Which is not feasible with those ones because there is not even a dependency on the output voltage. – menjuel Mar 17 '18 at 9:53
• The general solution for a bunch of resistors connected to voltage sources (including ground) is (V1/R1+V2/R2+..+Vn/Rn)*(R1||R2||...Ri). Just substitute in. Solving the equations may be harder than just iterating to get close. – Spehro Pefhany Mar 17 '18 at 20:42
• Thanks for your patience. With your help I finally tracked down my mistake. Which was that I can not simply put Vz - Vout for the combined voltage across the divider. Somehow I got stuck there. – menjuel Mar 18 '18 at 12:11