MCP73831 - at the end of LiPo charging, the charging diode (STAT output) flashes - Page 1
Forum section: electronics / beginners

author: bipolunipol
author_rank: Contributor
timestamp: March 07, 2022, 06:54:53 am
content: Hello!I built a LiPo charger based on the MCP73831T-2ATI/OT.The battery is 120mAh, it has PCM and looks like this:And below is a circuit diagram:I set the charging current to 106mA (9.4k resistor) - according to the battery datasheet, it can be up to 1C.Now I have such a problem. Sometimes, let's say 30% of the time, charging the battery does not finish correctly with the LED turning off. The STAT LED starts flashing and the flashing frequency changes randomly. Below is an oscillogram of how the STAT state changes:And this is the situation with the wires going to the battery (voltage at the battery input):I thought it was the battery's fault. However, I checked it on 4 batteries - one from one manufacturer, three from the other. This problem has always been...I even changed the MCP73831 chip - still the same.Why is this happening?

author: m3vuv
author_rank: Super Contributor
timestamp: March 07, 2022, 12:41:59 pm
content: i get the same with tp4056 moduals ,also my ebike charger does the same,presume its hysterysis,if thats the correct word?

author: Peabody
author_rank: Super Contributor
timestamp: March 07, 2022, 04:10:01 pm
content: After the charger terminates the charging cycle at 4.2V, it's supposed to stay off until battery voltage drops below 4.1V, at which point it starts charging again. I can't tell what's going on from your scope pictures, but it may be that if your microcontroller turns back on, and other things are being driven, there may be enough current draw to start the charging again. You would have to experiment by disconnecting load items from the battery, and see if it stops the blinking.

author: bipolunipol
author_rank: Contributor
timestamp: March 09, 2022, 04:14:04 pm
content: Thanks.I physically disconnected the microcontroller and then the same...I also checked with another phone charger - the same.Regarding the hysteresis - I did the test when the charging was successful (the STAT LED was not blinking). I connected the load resistor and the charging restart is at ca 4.06V. So the hysteresis is.What else could I check?

author: Peabody
author_rank: Super Contributor
timestamp: March 10, 2022, 05:13:11 am
content: I don't really know. I would just suggest you scope the battery voltage and the input voltage when the STAT light is blinking, and see if either of those produces fluctuations similar to STAT.

author: bipolunipol
author_rank: Contributor
timestamp: March 12, 2022, 01:03:28 am
content: It probably turns out that the problem was the microcontroller. As I showed in the schematic, the STAT output is connected to one of its pins. That pin had an internal pull up. And through that pull up, the battery continued to charge, despite the MCP73831 chip cutting off the charge. When the voltage reached the value at which the PCM was working - we got the described effect (PCM was cutting off the battery connection, MCP73831 was behaving as if the battery was not connected, which was manifested by random flashing).But now I have a problem - if I remove the internal pull - up, I can't detect the moment of charging. Because when the USB charger cable is disconnected - there is a GND potential on the STAT pin and the circuit thinks that charging is still going on...So how can I solve the detection problem? I thought of connecting the detection pin to +5V line from the USB socket, before the MCP73831 chip. But then I don't have any protection against static electricity and bad voltage, so I guess it will be easy to damage the microcontroller, right? So what could be an alternative, proper solution?

author: Peabody
author_rank: Super Contributor
timestamp: March 12, 2022, 01:58:52 am
content: Quote from: bipolunipol on March 12, 2022, 01:03:28 amI don't understand that at all. The STAT pin is an output. How could the battery continue to charge through it? Have you looked at Table 5.1 in the datasheet?QuoteAgain, I don't understand what any of this means.QuoteAccording to the datasheet, STAT is floating when USB power is disconnected.QuoteIf USB is connected and powering the charger, then STAT will go active high when charging terminates. But the battery can also be charged when USB is disconnected, and STAT will be floating at that point. Have you tried it with the LED and its resistor removed, so that just the internal pullup is involved? That should work. The MCU pin will be high unless STAT is active low, which is when it's charging. But it seems your original circuit should have worked too.I would also ask why you need to know when charging is complete. Is your USB power not great enough to power both the charger and the load? If it is, then a load sharing circuit would let you do both at the same time and would be completely automatic:http://ww1.microchip.com/downloads/en/AppNotes/01149c.pdfYou would need a mosfet, a schottky diode, and a resistor.

author: bipolunipol
author_rank: Contributor
timestamp: March 12, 2022, 02:29:00 am
content: Quote from: Peabody on March 12, 2022, 01:58:52 amI have presented it in the figure below

author: Peabody
author_rank: Super Contributor
timestamp: March 12, 2022, 02:53:37 pm
content: It's still not completely clear why it doesn't work, but I think the current is not flowing through the STAT pin. It's flowing from VDD through the LED. If that's the problem, you could disconnect the LED so STAT is only connected to the MCU with its internal pullup enabled. Or, you could leave the LED as is, and insert a diode into the line from STAT to the MCU, so current will flow only to pull down the MCU pin when the charger is charging, but never the other way. That's the only time STAT is low. If charging is completed, or if USB isn't connected at all, STAT will either be high or Hi-Z, and the MCU pin will be high, but no current will flow.If the diode doesn't fix it, then that will at least eliminate one possible cause of the problem.

author: bipolunipol
author_rank: Contributor
timestamp: March 13, 2022, 10:29:07 am
content: Thank you.I connected an ammeter between the battery and the charging system. I measured the current when the MCP73831 chip stopped charging.- According to the previous, my first diagram - the current flowing to the battery after cutting off the charging was still 2.3mA.- When I connected the diode according to your recommendations - after cutting off the charging, the charging current is 3.12 uA.The problem seems to be resolved.Now I just wonder why there was so much current with my wrong diagram. Even if it were to flow through the pull-up resistor, it would not be that big. Maybe it was important that after charging the battery, the microcontroller is powered with 4.16V (battery voltage), and the STAT output is 5.1V after the charging is finished (STAT = 1). Maybe this voltage difference caused the current to flow through some port protection circuits?

author: Peabody
author_rank: Super Contributor
timestamp: March 14, 2022, 04:19:51 am
content: Yes, I think that's likely the explanation. Each GPIO pin on the MCU has a diode from that pin to the Vcc pin. Any voltage differential greater than about 0.65v will result in current flowing, and you have almost a full volt. And it's not flowing through the pullup resistor. The diode is a direct connection.Note that the MCP73832 has no high drive on the STAT pin. It is open drain. So it's either HI-Z or low. But adding the diode accomplishes the same thing.Well I hope it works for you now.Edit: Actually, I think current flows through both the pullup resistor and the protection diode.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 14, 2022, 05:55:14 am
content: FYI, the last waveform is almost certainly FM broadcast interference from a nearby transmitter. Reduce scope bandwidth (20MHz or whatever) when you don't need it, use short probe leads, good grounding, work on a ground plane, etc. Multiple turns of the probe cable through a thick ferrite bead may help too.Tim

author: bipolunipol
author_rank: Contributor
timestamp: March 15, 2022, 06:16:05 am
content: Quote from: T3sl4co1l on March 14, 2022, 05:55:14 amYes, in fact I have got an FM radio antenna approximately 300m awayThanks, I'll apply these tips.Quote from: Peabody on March 14, 2022, 04:19:51 amBut in this case, such a diode can also be useful? Because even if the STAT pin in the MCP73832 is in a high impedance state, current will flow from the USB through the diode LED1 and the resistor R2?

author: Peabody
author_rank: Super Contributor
timestamp: March 16, 2022, 02:11:40 am
content: Quote from: bipolunipol on March 15, 2022, 06:16:05 amYes, I think so. Tha datasheet suggests you would have either the LED or a connection to an MCU, but not both. But if you have both, then I think you need the diode.