Hysteresis not working properly

chargingcomparatorhysteresismosfetswitching

This question is related to my previous question about the battery charging and discharging. Here is the link to my previous question.

I have made a small change in my previous schematic, which is the PMOSFET. I have added NMOS in between the Charging IC and the Battery. Below is the schematic,
Schematic

The following is the principle of the circuit,

  1. Hysteresis of 3.4V and 4V is set using a Comparator.
  2. Depending on the voltage level of battery, comparator gives the output. If the battery
    voltage is 3.5V then the output of the comparator is "HIGH"; this then turns "ON" the mosfet M2 (and Turns "OFF" M1) allowing the charging IC to charge the battery. When the batter voltage reaches to 4V, comparator output becomes low. This then turns "ON" the Mosfet M1 (and turns "OFF" M2); allowing the battery to discharge to the load.
  3. The load I am using is 0.25W 1.4K resistor but I have added 10 resistor in parallel. Which then makes the resistance of 140 ohm, so the current Iload=28mA.

Following is what I observe in the circuit.

  1. When the battery is charging and it is 3.7V the charging stops and starts to discharge. At this point I was also monitoring the hysteresis point and it showed 4V, but what I don't understand is why did it stopped at 3.7V?
  2. Also the discharging stopped at 3.48V instead of 3.4V. Also at this point i was monitoring the hysteresis point which was set to 3.4V.

Why is my hysteresis not working properly. I have used M1 as PMosfet so that battery gets connected to load when the output from the comparator is LOW and M2 as NMosfet to disconnect the charging process when the battery is connected to load.

Best Answer

Without RC filter caps on the comparator inputs, I might suggest you have 80mV of noise that triggered the low point of 3.4 or you have some input offset on the comparator.

When the battery is charging, again either you have noise or the threshold on (+) input is not 4.0V.

How is the comparator powered? And what is the output swing? And how much noise is on V- and V+ of the comparator. It is either set to wrong threshold or there is noise.

The other problem is the lack of a good bandgap reference voltage supply on comparator output swing and thus input reference voltage for (+) and Vboost +5.. All of these sources & noise + R ratios affect your thresholds.