A Lithium Battery Charger with Load Sharing

You may have found that charging your project’s lithium battery while at the same time trying to use your circuit didn’t quite workout, with problems like the circuit not turning on and the battery never finish charging. Even an LED can cause the battery to never finish charging.
This article goes through creating a battery charger with load sharing (also known as power-path) that can properly charge the battery and have the main circuit run normally. The charging IC we’ll be using is the popular MCP73831/2 from Microchip for single-cell Li-Po and Li-Ion batteries with a maximum charge current of 500mA. We’ll also be adopting the load sharing design from Microchip app note AN1149.


Issues when not using load sharing
During the preconditioning and constant-current charge phases the charger IC will limit current supplied to the battery and load. If this limit has been set to 40mA and the load wants 30mA, only 10mA will be left to charge the battery. If the load wants 50mA then 40mA will come from the charger and 10mA from the battery, which will discharge the battery rather than charge it. If the battery is already dead then the load will be starved of current, causing the voltage to drop, the load probably won’t operate correctly and the battery won’t charge.

During the constant-voltage charge phase the charger will normally wait until the current through the battery is below a particular percentage (usually 7.5% of the set charge current) and then finish charging. If a load is present the current will probably never go below this level and charging will never seem to finish.

Charger IC variations
There are a few variations of the charging IC, MCP73831/2 means MCP73831 and MCP73832. The only difference between these two is the charging state output (STAT pin).

Charge state MCP73831 MCP73832
Shutdown Hi-Z Hi-Z
No battery present Hi-Z Hi-Z
Preconditioning Low Low
Constant-current fast charge Low Low
Constant voltage Low Low
Charge complete – standby High Hi-Z

There are also variations which set how the battery is charged in relation to when and how long to precondition, fast charge and so on. AC, AD, AT and DC are the 4 types. The AC type seems to be the ‘normal’ type that is used in the IC datasheet. More information about each charging phase can be found in the app note above.

Basic charge circuit
This design is the minimum required for the MCP73831/2 to charge a lithium battery (well, R1 and LED1 could also be removed), but problems will arise when charging and connecting a load to the battery, as discussed above.

Charge circuit with load sharing
Adding load sharing only requires an additional 3 components. When USB power is applied this circuit will turn off Q1, and as long as (Vusb – D1 VF) is above (Vbat – Q1 VSD) then the load will instead use power from USB through D1. This allows the battery to charge normally without any outside disturbances.

Q1 is a P channel MOSFET. When USB power is applied Q1 will turn off and stop current flowing from the battery to the load, effectively disconnecting the battery. The load will then use power from USB through D1. The MOSFET you choose should have as low RDS(on) as possible to minimize power loss, should be able to handle the current your circuit is going to draw from the battery and has a VGS(th) between 0V and -2.4V.

D1 is to prevent current flowing from the battery into the charging power source. D1 should be a schottky diode that can handle the loads’ maximum current draw. The forward voltage drop doesn’t matter too much, but lower the better to reduce power loss when powered by USB. The absolute maximum drop is (VINmin – (VBATmax – VSD) = VFmax), the USB 2.0 standard specifies 5V±0.25V, most lithium batteries charge to 4.2V and internal MOSFET diodes have a drop of around 0.6V, so (4.75 – (4.2 – 0.6) = 1.15). This maximum forward voltage drop is so the source (load side) voltage of Q1 doesn’t go below the drain (battery side) voltage, otherwise the internal diode of Q1 will begin to conduct which will interfere with the battery charging. Reverse current leakage of schottky diodes might be a problem if ultra low power consumption is needed.

R2 is to make sure Q1 turns on and connects the battery to the load when the charging power source is removed.

C3 is an extra decoupling/bypass capacitor.

Another important point to think about is the reverse leakage current of D1, which could be up to a few hundred microamp (schottky diodes are very leaky).
This leakage current will create a small voltage at the MOSFET gate which, if high enough, could cause the MOSFET to not turn back on properly when the main Vin power is removed.

To see if Q1 is turning on properly place a voltmeter across Q1’s drain and source pins and it should read a few millivolt depending on load and the MOSFET’s on resistance, e.g. with a load of 100mA and RDS(on) of 50mΩ then the voltage drop should be 5mV.

To minimize the gate voltage you can either use a diode with lower leakage current (which will also improve battery life) or reduce the value of R2, or a bit of both.

To figure out what value R2 should be to keep the gate voltage to a sane level (lets go for a Vtarget of 1V) we first workout the effective resistance D1 has at the batteries’ max voltage:
Our example diode has a leakage (IR) of 200uA @ 4.2V (you can find leakage info in the datasheet for your diode, or you can measure it yourself by applying a voltage backwards across the diode and measuring the current).

RD = VBATmax / IR
RD = 4.2 / 0.0002
RD = 21KΩ

So now we can treat D1 and R2 as a voltage divider, we just need to workout what value R2 should be so that the voltage at the MOSFET’s gate meets our Vtarget.

R2 = Vtarget * RD / (VBATmax – Vtarget)
R2 = 1 * 21000 / (4.2 – 1)
R2 = 6.56KΩ

So when using a diode with a leakage current of 200uA @ 4.2V, R2 must be no more than 6.56K to keep the MOSFET’s gate at 1V. I’d recommend not going over 100K for R2.

This also means D1 and R2 will be leaking a total of 152uA from the battery (I = VBATmax / (RD + R2)).

It’s probably a good idea to do these calculations for VBATmin (around 2.4 – 3V) too.

Charge circuit with load sharing and additional microcontroller
Here’s an even further modified charge circuit. A microcontroller can be used to sense when USB power is applied, when the battery is charging, enable/disable charging, control charge rate and measure the battery voltage. This information could be displayed on something like an LCD.

Pin I/O Pull-up Info
PD3 (5) Input Enabled Charger STAT pin sense. LOW means the battery is charging.
PD6 (12) Input Disabled When USB power is applied this pin will go HIGH.
PD4 (6) Output Controls charging.
PD5 (11) Output Controls charging.
PD7 (13) Output Setting to HIGH will turn the level shifter and Q3 on which will allow current to flow through the divider. Once an ADC reading has been taken this should be put back to LOW.
ADC3 (26) ADC Measure voltage. Internal 1.1V should be used as the reference voltage.

Charge rates

Q2 Q5 Charge
Off Off Disabled
On Off 100mA (10K)
Off On 370mA (2.7K)
On On 470mA (2.7K || 10K = 2.126K)

R2 and R3 voltage divider also serves as R2 100K pull-down resistor for Q1 in the first load sharing schematic.

Only the MCP73832 should be used in this case, using MCP73831 will drive the STAT pin HIGH with 5V when the battery finishes charging which will exceed the microcontrollers’ max pin voltage of VCC + 0.5V (2.5 + 0.5 = 3V max).

loadShare_20140613.c (3.68 kB)
Load sharing code example
Downloaded 2680 times
MD5: C50476A4F66D332D6DBD29BEC05D13B4

loadShare.c (2.71 kB)
Load sharing code example
Downloaded 2004 times
MD5: 2D0DC4BCC9047756554131EBCE4773CF


  • You should make sure your circuit can run on the full voltage range of the battery (usually 3V-4.2V, but sometimes down to 2.4V) as well as 5V from USB.
  • You should make sure that your charging power source can supply enough current to charge the battery as well as power the circuit.
  • When charging at high currents be sure to have large enough PCB traces to dissipate the heat from the charging IC. Heat comes from the ground pin (VSS).

March 9th 2014 – Added info about D1 reverse leakage and working out required R2 resistance.
June 13th 2014 – Updated microcontroller schematic to use more suitable BJTs instead of MOSFETs (cheaper, easier to find). Also added adjustable charge rate.


4 pings

Skip to comment form

    • Sebastian on April 30, 2018 at 3:25 pm
    • Reply

    Hi, very nice circuit. I was wondering how do you differentiate the “No battery” situation with the “Battery’s charge full” situation, when external USB power is applied. In both cases, MCP73832 status pin will give you the same information, and reading the battery level into the ADC will give you for both cases “reasonable battery levels” (When no battery is present, you’ll still have a 4.1V reading in the VBAT pin of the MCP73832).
    The only workaround I found is using the MCP73831 and reading with the MCU three-states (Hi-Z, H, L) using 2 pins.
    Any other simpler idea?
    This post was great.
    Desde Argentina,

    1. According to the MCP73831 datasheet it applies a continuous 6uA to the battery once it has finished charging. If the voltage rises above Vreg + 100mV (4.3V) then it determines that the battery is been removed. If it stays below that voltage then the battery is present. It’s possible to read the tri-state output using 1 ADC pin and external resistor, or just a single digital pin if the MCU contains both pull-up and pull-down resistors. Can’t get much simpler than that.

    • Andrew Meyer on July 16, 2018 at 4:26 am
    • Reply

    Hi and thanks so much for the detailed article. I’m a little confused about something you mention in the beginning:

    “When USB power is applied this circuit will turn off Q1, and as long as (Vusb – D1 VF) is above (Vbat – Q1 VSD) then the load will instead use power from USB through D1”

    Shouldn’t the node on the source of the mosfet be defined by Vbat – Q1VDS (not SD), or even just Vbat + Q1VSD? By convention, it seems that VDS = VD – VS, which would be a positive number and seems to describe the amount of voltage lost across the mosfet when current is going from drain to source.

    That said, I’m also looking at this datasheet (http://static6.arrow.com/aropdfconversion/c9282694b401720599c2315f8524a95bfe22c148/vp0106.pdf), which describes VSD as a negative number. This would make sense since VDS = -VDS, however the current in the “condition” column is also negative (ISD = -500mA) so now I’m really confused…

    1. Hey Andrew,
      When Q1 is off we’re interested in the MOSFET’s internal diode forward voltage drop, which is defined as Vsd. Vds is used when the MOSFET is on. But you’re right about the Vsd being a negative number in the datasheets, this article was written assuming the diode drop was a positive value. I’m not sure if I should change it to the correct calculation as I think most people always assume that diode voltage drops are positive?

      P channel things are always a confusing pain with their negative values, some datasheets show some parameters as positive numbers and other datasheets as negative…

    • José on July 31, 2018 at 10:47 pm
    • Reply

    Hi, thanks for this information! I have a couple of questions:
    1)Will the p-channel mosfet give reverse polarity protection too? it seems that it should, but im not sure…
    2)I found a diode with with around 2uA leakage, but according to the calculations i should use value for R2 around 6MEG. do you think it’s worth to do it this way?
    Thanks for your help!

    1. Hey Jose,
      1) No, if the MOSFET is on then current will flow backwards through it bypassing the diode, so no protection there. You’ll also probably damage the charging IC too.
      2) I wouldn’t use a resistor higher than 100K for R2, otherwise it won’t be able to get rid of any build-up of charge quick enough (like touching the 5V input with your finger) and the MOSFET might turn off.

        • José on August 1, 2018 at 11:19 pm
        • Reply

        thanks for your reply!
        wouldn’t the MOSFET be off if i reverse polarity with USB input disconnected? I ask you because i have seen a reverse polarity protection circuit that uses a reversed P-CHANNEL MOSFET like the one used here…

        1. Ah yes you’re right, I think it might work as reverse protection then, you’ll have to test it! I didn’t think about ground now being at the battery positive, applying a voltage to the MOSFET gate through R2 and turning it off. 😛
          Though the charging IC won’t have any protection as it’s directly connected to the battery.

            • José on August 2, 2018 at 12:36 am

            thanks! you are right, there won’t be protection for the IC.

    • Quiz on August 28, 2018 at 1:45 pm
    • Reply

    Hey Kemble,

    Thanks for the post, it’s very resourceful. I intend to build a circuit to do the same – to have an input voltage to charge the battery and have the same battery power the load when the input voltage is being removed. I will like to check something and maybe get your advise if possible.

    – I am using a 5V input, 3.7V battery, and a 3.3V load.
    – I will like to charge the battery at 4.2V to get the full charge.

    I read that the MCP73831/2 can take in VDD from 3.75V to 6V, depending on the voltage regulation(?) – Which I assume there are various model for different rating.
    Will it be possible for MCP73831/2 to have the step down as per my requirement? Otherwise, what will you advise – which resistor value should I focus to change, referring to the schematics that you have kindly provided?

    Appreciate your time, please advise me as I am still new to this.

    Best regards,

    1. Hey Quiz, what step down are you referring to? The MCP73831/2 has 4 battery voltage regulations to choose from (4.2, 4.35, 4.4 and 4.5V), make sure to use the correct one for you battery, usually 4.2V. If you want 3.3V for your circuit then you should add a 3.3V regulator at the output of the circuits described in this post.

    • A on October 21, 2018 at 7:23 am
    • Reply


    Apologies if I’ve missed some crucial point and this is a stupid question.

    It seems you’re using Q1 mostly for the internal diode than the switching capability: when the mosfet is turned on, no current flows from source to drain (instead, current flows from drain to source via the internal diode). And when the mosfet is turned off to prevent Vin from going into the battery, a diode could have had the same effect.

    So couldn’t you have used a simple diode in place of the mosfet (and ditch R2 as a bonus)? What is the benefit of using a transistor here?


    1. Heya, yes a diode will have the same effect, however you then have to deal with the diodes voltage drop of somewhere around 0.5V – 1V. Here we’re using the MOSFET to bypass the diode reducing the drop to almost nothing. When Vin is removed the MOSFET turns on, current flows from drain to source and the internal diode is bypassed (current can flow backwards through the MOSFET just as much as it can flow forwards).

        • A on October 23, 2018 at 10:30 am
        • Reply

        Ah, I see, I was assuming all the current would flow through the internal diode when the mosfet was turned on. Thanks!

    • Biggie on February 19, 2019 at 12:46 am
    • Reply

    Hi Zak, You write about the D1 leaking reverse current and possibly causing a voltage on the gate. I don’t understand how the same problem doesn’t apply to the voltage divider of the 2nd schematic with the micro controller to detect whether usb or battery power is used. Wouldn’t the reverse leaking current in D1 not also cause problems in pulling down the PD6 pin of the micro controller in that case?

    1. Hey Biggie, actually you’re right, the example schottky diode here has really crappy leakage specs – 200uA at 4.2V. This causes the output of the R2/R3 divider to be ~1.7V which is rather high and will most likely be read as HIGH by the microcontroller. A much better diode like the PMEG2010AEJ has a leakage of less than 10uA and won’t cause this problem.

      The diode reverse leakage can be (kind of) treated like a resistor, were 200uA at 4.2V would be equivalent to 21K. Then we have the R2 (47k) and R3 (47k) divider. The 21k diode in series with R2 makes a 68k resistor, then with the bottom 47k will give an output of ~1.7V. A leakage of 10uA would be equivalent to 420k, so the divider output will then be a much better ~0.4V.

        • Biggie on February 19, 2019 at 8:38 pm
        • Reply

        Thanks for your reply! Your 2nd paragraph perfectly explains what is going on and why, really helped. I was always under the assumption that (schottky) diodes don’t pass any reverse voltage. But you’re saying that even though the reverse current leakage might be tiny the voltage is basically passed unaltered even in the reverse direction? Normally this isn’t an issue since the current is minimal but I guess in the case of using MOSFETs the voltage is a big deal, even if the current is minimal?

        I am actually trying to slightly alter your charge and load sharing circuit. I have a situation where the load doesn’t run on 5V but needs 3.5V – 4.2V. The LiPo covers that perfectly but the Vusb will be regulated down to 4V. So in my case when the battery is nearly fully charged its voltage will be higher than the 4V of my ‘Vusb’ and my load will start using the battery while the wall plug is still connected. I don’t want that, I only want it to ever use the battery when the dedicated 4V line is not available. Can I simply take your circuit and add an identical MOSFET back to back? (i.e. source and source together and gates on same line) I was thinking that should be able to block current in both direction and prevent the load from using the battery whenever my battery’s voltage is greater than my Vusb?

        1. Even standard diodes have leakage, it’s just super small (1N4148 has a tiny 5nA at 5V). The current needs to have somewhere to go otherwise the voltage on the other side of the diode will remain unchanged.
          Yup, back-to-back MOSFETs should do the trick, in fact that’s how lithium battery protection circuits work so they can disconnect the battery if it’s discharged too low or overcharged.

        • Biggie on March 19, 2019 at 4:06 pm
        • Reply

        I recently revisited this project and put some more thought into selecting D1. In your answer you mention a diode with a reverse leakage of 10uA would be the equivalent of a 420k resistor. Which then would work nicely with R2 and R3 in producing the right output for the microcontroller. But wouldn’t that specific diode then cause problems for Q1 again?! If D1’s resistance is 420k that would mean ~3.4V at the gate of Q1, effectively turning it off (assuming Vbatt is 4.2V).

        I guess I can mess around with the values of R2 and R3 again to correct that, and also satisfy the microcontroller’s input limits. Is that the way to go? (R2 and R3 combined would then far exceed 100K though, is that a problem for Q1’s gate?)

        1. I think you might have gotten your resistors the wrong way around in your calculation 😛 420k + 47k + 47k would make ~0.7V at the gate.

            • Biggie on March 20, 2019 at 7:55 pm

            Oops, I guess I did. I think I somehow was thinking about the voltage drop across the diode as the gate voltage but it is the voltage across the resistor(s) that come after the diode. (at least when the load is battery powered). Anyway, thanks for the quick response!

    • Monisha on February 21, 2019 at 2:33 pm
    • Reply

    .iam using the same above reference with load sharing circuit in my project.is the ic have any reverse polarity protection?is it safe when we connect the battery in reverse ?

    1. The datasheet doesn’t say anything about reverse protection, so I guess not!

  1. […] However, that still means that you have to open the clock up to change the battery when it is out of power. A better alternative would be to include a power-sharing charger inside the case, so that the LiPo will charge up when the clock is plugged back into the power. A quick(ish) search of the internet turned up this 9V LiPo charger module, which is small enough to fit inside the case along with the battery. So that gave me the charger, but I needed to add the load-sharing part. A load-sharing charger will use some of the input power (input from the wall adapter) to charge up the battery, while the clock runs off the rest. It also needs to disconnect the battery from the clock as long as the clock is plugged in to the wall adapter, but instantly connect the battery to the clock as soon as it is unplugged from the wall adapter. This is actually pretty easy, and my circuit is basically the one described here. […]

Leave a Reply

Your email address will not be published.

Are you human? *