Your application might be much -
much more complex than first meet the eye because your choice of MCP130 instead of MCP120. The integrated 5k pullup resistor put hard constrain on one leg of the equation.
Let consider the following equivalent circuit:
Let's ignore I
Q,
I ain't doing this shit again.Consider the downward going input (i.e. discharging), output high, 5k pullup floating and is out of equation.
Let V
R be reference voltage and V
L be battery lower threshold voltage, the equation is:
V
R = V
L R
2 / (R
1 + R
2)
V
R R
1 + V
R R
2 = V
L R
2V
R R
1 = R
2 (V
L - V
R)
R1 = R2 (VL - VR) / VRNow consider upward going input (i.e. charging), output low, 5k pulled down making it parallel with R
2.
Let V
H be battery higher threshold voltage, the equation is:
V
R = V
H 5000R
2/(5000+R
2) /(5000R
2/(5000+R
2) +R
1)
5000V
RR
2/(5000+R
2) + V
RR
1 = 5000V
HR
2/(5000+R
2)
5000R
1 + R
2R
1 = 5000V
HR
2/V
R - 5000R
2R
1(5000+R
2) = 5000R
2(V
H/V
R - 1)
R1 = 5000R2(VH/VR - 1)/(5000+R2)Eh, whatever...
Now consider the scenario:
V
R = 4.7 V (you measure it)
V
L = 6.6 V (3.3V per cell, a bit conservative here since I'm not sure what battery you use that their max Vcell is 4.4V)
V
H = 7.4 V (3.7V per cell should be enough to start operating again)
Solving the two equations:
R
2(6.6-4.7)/4.7 = 5000R
2 (7.4/4.7 - 1)/(5000 + R
2)
Oh shit, quadratic...
Let there be magic...
R
2 = 2105
R
1 = 2105 (6.6 - 4.7) / 4.7 = 851
Eh, close enough. Pick closest standard value or whatever. 2k2 and 820.
Notice that those resistor values are way too small for a battery operated system. It'll drain the battery in no time. You can increase the values by widening the hysteresis (increasing source impedance allowing the 5k to affect input more). Even then with 6.6V and 7.8V thresholds they still have uncomfortably small value (3k and 1k2).
Moral of the story, pick MCP120 instead of MCP130. It helps simplifying the equation
a lot.
Or just pick suitable supervisor with integrated hysteresis in the first place...
help...