I have designed a battery charging and discharging circuit. The main purpose of this circuit is to charge the battery and then discharge, one operation at a time. I have also added a hysteresis of 3.4V and 4V.

Battery voltage is compared with the set hysteresis voltage and when the battery voltage reaches 4V, the charging is then stopped and then the battery is discharged to load; this is controlled by MOSFEST as a switch. When the battery voltage reaches 3.4V the switch is then turned off and then charge the battery.

It works in the simulation and it also works when I use power supply as a battery. The problem is when I connect the real battery the following things happens,

  1. When the battery is charging and its voltage is around 3.97 the discharging takes place. At this point it is charging as well as discharging, why doesn't it reach it 4V?

  2. Then I checked the output of the comparator which controls the switch, then I noticed that the output of the comparator is going crazy on and off (5V and 0V).

Why is the hysteresis not working and is there any way I can solve this?

this is my schematic enter image description here

this is the new schematic, easier to understand :) enter image description here

  • \$\begingroup\$ Sounds like a problem with battery resistance not factored in? \$\endgroup\$
    – EkriirkE
    May 22, 2014 at 18:46
  • \$\begingroup\$ I have just added my schematic. \$\endgroup\$ May 22, 2014 at 18:49

2 Answers 2


The comparator and battery charger (LTC4071) are making decisions independently of each other. The battery charger is looking for the battery to reach 4.0, 4.1, or 4.2V, depending on how you jumper the ADJ pin. However that only sets the voltage limit, it never stops trying to charge the battery. According to the data sheet page 10, "The LTC4071 does not have a discrete charge termination." The usage scenario being that it always tries to put current into the battery and the battery limits its own current when the charger goes into voltage-limit mode, then the current slowly reduces to nearly zero as the battery gets really full, at which point it's receiving a "float" charge. There is the HBO pin which shows when the battery is at voltage limit, but this isn't the same as the charger turning itself off.

Meanwhile the comparator is looking for the battery to reach 4.0V. I'm not sure why it's oscillating but possibly you're overloading what the charger can pass through since the load is in parallel to the battery, and the charger has to provide for them both. Or overloading the input source, whatever it is, solar panel or wall adapter? Or the load is so huge that it is actually pulling down the small battery to below the low-battery threshold. You don't state whether other parts of the circuit are also oscillating.

What you might want is a setup where the battery charger turns itself off when done and signals the load to turn on, and the load in turn signals the charger to start charging when it turns itself off. Since your battery charger IC doesn't have an enable pin and doesn't turn itself off, you might have to rig something up with FETs to gate power into or out of the charger, or swap the charger IC to something more appropriate. Is the goal to test battery cycle life, or specifically this circuit also?

  • \$\begingroup\$ Thanks a lot for your explanation Matt. I connected the scope in the input as well as the output of the circuit and they are oscillating as well. How can i use a FET at the output of the charging IC to stop the IC when the battery reaches the desired voltage, in my case 4V? The above circuit is being power by a small solar panel. The energy coming from solar panel is very low to directly power the load, so I decided to charge the battery at first and then discharge the battery to certain threshold (that's why i used the hysteresis), one operation at a time. do suggest me how i can improve. \$\endgroup\$ May 23, 2014 at 6:50

What is the expected output of the solar panel, capacity of the battery, current capability of the 5V regulator, current required by the load?

It sounds like you need to lower the comparator from 4.0V to maybe 3.6V. The comparator doesn't tell the battery charger when to stop, it only tells the load when to switch on or off. All it needs to do is turn off the load when the battery gets too low, and not turn back on again until the battery gets somewhat charged up again, so hysteresis is good, but it shouldn't be trying to do battle with the charger over what happens at 4.0V. Put it at a different threshold so you can tell what mode you're in.

Mode 1: Panel providing enough energy for battery and load, battery is charging and between 3.6V & 4.2V (or is full and pegged at 4.2V), load is on. If the panel remains lit this way the battery never gets discharged.

Mode 2: Panel not providing enough energy for battery and load, but battery is making up the difference, battery is discharging and between 4.2V and 3.0V, load is on, and will turn off when battery discharges to 3.0V. This assumes the load isn't so huge that it immediately overwhelms the battery or 5V regulator when it turns on.

Mode 3: Battery has hit low-voltage threshold but not charged back up over hysteresis yet, panel is charging battery when lit, load is off and will remain off until battery charges up to 3.6V. If the battery doesn't charge at all due to the panel being dark, the battery charger may go into a low power mode and needs a certain input from the panel to turn back on again, see the data sheet.

Mode 4: Battery has gone above hysteresis voltage of 3.6V and load has turned back on. Battery voltage is determined by panel input vs load output. If panel > load, battery will charge until full (actually this is Mode 1), and if panel < load, battery will discharge until empty, or some variation between charging & discharging based on sunlight fluctuation. If you want the battery to get less wear, make the panel larger. If you want the load to remain off until the battery is fully charged rather than partly charged, then maybe feed the HBO pin into your comparator as a reset.

That's how it should work, but you have oscillation everywhere. You don't describe what the load is, and it sounds like it could be much larger than the battery or even panel + battery together can support. Either that or there's something wrong with the 5V regulator, which since it's the comparator rail could mean when the load is on, somehow 5V glitches, the comparator gets confused, the load turns off, 5V recovers, repeat. As far as I can tell the only thing the 5V regulator powers is the comparator, not the load? At the very least you need to replace the load with a simple resistor (say 1kohm) that draws small current relative to capabilities of the battery charger and battery capacity, until the rest of the circuit seems to work as desired. You might try pre-charging the battery on a bench supply (with both V & I limits set appropriately).

There could be other problems, like signal integrity, you forgot to add a detail from the data sheet somewhere, something is feeding back in an unexpected way. Please try the suggestions above and report more information about the parts not on the schematic and we'll see if we can help more. You'd probably get more people looking at it if your schematic was easier to read, like get rid of all the jumpers and optional parts and show how you actually have it wired, show the comparators as triangles with +/-, make the net names clearer e.g. VLOAD is really the battery voltage so call it VBAT+ or something (VLOAD would be the other side of Q2 where the load is), and so on. Maybe a photo of the setup.

  • \$\begingroup\$ Thanks Matt for your answer. I was testing the system with the bench power supply (5V). The battery I am using is 190mAh lithium Ion. In my first test I wasn't aware of the load which i connected. It was 2.5W which is greater than the battery +the P.S then I changed it to 0.25W; then it seem to work. Comparator was not going crazy. Also the oscillation was gone. When I connected 0.25W load then I performed two test one with P.S connected and one without P.S. \$\endgroup\$ May 26, 2014 at 9:08
  • \$\begingroup\$ First Test with P.S==> Battery was charging to 4V as set at the comparator. When the voltage reached to 4V the Mosfet turned ON and was discharging to the Load. At this point it wasn't actually discharging from battery it was supplying the load from the P.S and battery was still charging but very slowly.I understand this is happening because Output of Ltc4071 is directly connected to the battery and to the switch. \$\endgroup\$ May 26, 2014 at 9:13
  • \$\begingroup\$ In the next test I removed P.S and just let the battery to discharge to see if it would stop at 3.4V. When the battery voltage level reached to 3.4V the switch closed and then it was charging up again. I guess this is happening because of the charge stored in the capacitor, am i right? then when the voltage reached to 3.7V it started to discharge again and process repeated. Is is normal what is happening? So now what I was thinking of using NMOS as a switch between charging Ic and battery to disconnect battery when 4V is reached? NMOS will be feed from the comparator output.will this help? \$\endgroup\$ May 26, 2014 at 9:18
  • \$\begingroup\$ How can I reset the comparator with the HBO pin of LTC4071? \$\endgroup\$ May 26, 2014 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.