Electronic – How to derive the node voltage for this comparator with hysteresis

comparatorhysteresisschmitt-trigger

I have the following circuit. U26 is a simple unity buffer and U15 is just a dual comparator.

I want the top comparator to compare the battery voltage (VBAT/2) on the inverting input with 2.0V reference on the non-inverting input. I also want 50mV of hysteresis. For some reason, pin 3 is sitting at 2.8V and pin6 at 2.4V. I figure it has to do with the Req of R13, R14, and R16 but I can't seem to figure out how to get the equations to work to make pin three of U15 2.0V and have hysteresis.

Likewise, I want the bottom comparator to compare VBAT/2 with 1.70V on the inverting pin and have 50mV of hysteresis made with R22 and R23.

The equations and how to derive them to get pin 3 at 2.0V, pin 6 at 1.7V and 50mV of hysteresis for each comparator will be accepted.

The output is just 3 LEDs where only 1 can be on at once, being on when the output of the comparator is low.

EDIT:

So what I got working was to multiply R21, R22, and R23 by 10. This gives me the desired effect. I see no downsides to this method? I still can't derive the equation that figures out the voltages at pins 3 and 6 though.

enter image description here

Best Answer

Assuming you have some buffering so the comparators swing exactly 5V.. solving numerically to minimize the error squared of the two thresholds and the two hysteresis (using solver software)

R13 = 30.000K (defined)

R14 = 2.923256628K

R16 = 16.07788776K

R21 = 1142.70829K

R22 = 1061.133891

Obviously you could scale those values higher or lower. I happened to pick an exact value for R13, based on arbitrarily making the divider current about 100uA and thus having feedback resistors in the 1M ohm range.

That makes the voltages at pins 3 and 6 2.000 and 1.7000 with both outputs high- with the respective output low they each will switch 50mV lower- 1.9500V and 1.6500V

I simply calculated the current voltages given resistor values (assuming both outputs high), then calculated the two (high and low) resistances looking into the divider from R21 and R22, and from there the hysteresis with a 5V change- 5 * Rthev/(R21 + Rthev), for example.


To roughly estimate the resistor values, you can ignore the feedback (we know it's relatively small voltage change), assume a divider current of (say) 100uA and then you know that:

R13 = (5V - 2V)/0.1 = 30K

R14 = (2V - 1.7V)/0.1 = 3K

R16 = (1.7V)/0.1 = 17K

Just roughly, looking into the node at pin 3 and ignoring R22, we see R13 || (R14 + R16), so the feedback resistor R21 should be roughly 4.95/0.05 = 99 times higher, or about 1.2M. Similarly, looking into the node at pin 6 and ignoring R21, we see (R13 + R14) || R16, so R22 should be around 1.1M.

As you can see, those guesstimates are not far off at all, and it's possible to just fiddle a bit with them in Spice and get close enough that (say) 1% resistor tolerance will dominate.


C14 is a really bad idea- the op-amp will oscillate, also C21 and C22 are not a good idea either. To get the output to snap you should not delay the feedback.