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 4176 times
MD5: C50476A4F66D332D6DBD29BEC05D13B4

loadShare.c (2.71 kB)
Load sharing code example
Downloaded 2915 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.

      • Raj on June 19, 2021 at 11:29 pm
      • Reply

      If I am not wrong, Vbat is always going to be connected to load via parasitic diode of Q1 irrespective of Charger is ON or not.

      So when charger is ON, battery is charging and discharging at the same time, isn’t it ?

      1. No, current will not flow through the diode when the voltage at the load side of the MOSFET is greater than (Vbat – diode drop).

    • 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!

    • Mario on March 23, 2019 at 12:52 am
    • Reply

    Hi there, thanks for the this great post!

    I have a question. I want to use this circuit with the exact same components in the image above: MCP73831 DMP1045U, B130LAW. Just to clarify, should I use a R2 less than or equal to 6.56K according to your calculations? The thing is that you use a 100K resistor in the image, so that’s confusing. Thanks again!

    1. Hey Mario, yes, it is rather confusing! I really need to update the article sometime. Use a resistor of no more than 6.56k. In fact, it would be better to use a different diode too, as the one I used as an example has really poor leakage specs, PMEG2010AEJ is a good one (<10uA @ 4.2V), then R2 can be 100k.

        • Jarni on July 29, 2019 at 4:43 pm
        • Reply

        “No more than 6.56k” is not compatible with “can be 100k”.

        1. R2 should not be over 100k, otherwise things like placing your hand near the circuit can cause things to mess up. 6.56K is for a diode with 200uA leakage, like the B130LAW. If we were to use a BAT60JFILM with a much smaller 1uA leakage, then R2 would be calculated to ~1.3M, which is much higher than 100k.

    • Vaibhav on April 3, 2019 at 11:39 am
    • Reply

    hey I its really a very help full post but i have one small query , In datasheet of MCP73812 , it is mentioned that
    Input Supply VDD range is from 3.75 to 6V and with this in
    Output regulated Voltage it is said that it will give 4.20 V provided VDD=[VREG(Typ)+1V] where Vreg = 4.2V , that means VDD must be of minimium 5.2V , than why it is mentioned as 3.75 to 6V

    1. If VDD is less than 4.2V then it will just charge the battery up as best as it can to whatever VDD is, minus a little bit. I usually use 5V USB which doesn’t have any problems charging to 4.2V, I guess the +1V would be the absolute worst case, based on temperature and things.

    • Daijoubu on May 21, 2019 at 4:56 pm
    • Reply

    The MCP73871 has built-in load sharing and handle solar input as well, built-in USB charging functionality is limited to 500mA IIRC otherwise it’s max 1A, assembled module can be found for $3-4 from China

    1. Yes! Though, the MCP73871 does have a few disadvantages:

      Battery discharge current is limited to around 1A.
      Higher battery discharge leakage.
      Harder to solder QFN package.

      It doesn’t look like the MCP73871 has any extra stuff for solar, so it still needs extra circuitry for that, which be added to the MCP73831/2 as well in that case.

    • Jens Müller on May 23, 2019 at 5:08 pm
    • Reply

    Hello Zak, thanks for the article. It helped me a lot!

    Because of a lack of space I have to use as few components as possible. Are there any components (except the led), which can be omitted? For example the datasheet says to C2: “Bypass to VSS with a minimum of 4.7 μF to ensure loop stability when the battery is disconnected”. Does this mean if the battery is permanently connected C2 can be omitted? How about C1 and/or other components?
    My Setup: 5v USB in, 50mah LiPo with PCB, 50-150mah System Load.

    Thanks and best regards

    1. Hi Jens, I wouldn’t completely remove C2, section of the datasheet says about the battery and wires being inductive and a capacitor helps compensate for it. It also says that 4u7 is good for 500mA charge current so using a lower value like 1u should be ok for your setup and will allow for a physically smaller capacitor (0402? be careful of DC bias with physically small caps, an 0402 1u cap will probably be around 300n with 4V across it). I would also keep C1 as you’ve got a long, inductive charging cable, 1u should be fine again here for lower currents. Hope that helps!

    • Matthew Fredregill on June 13, 2019 at 9:32 pm
    • Reply

    I am using the MCP73831, 5v input load, charging a tiny 150mAh 3.7v li-ion. I have the circuit set up to deliver 100ma charge current. but I am having some issued. I thought the voltage cutoff of this chip was 4.2v but when I connect my meter to the battery It keeps rising all the way up to 4.7 volts. Then the Stat LED begins to blink really fast. My li-ion has built in over charge protection I am just worried that I am going to damage something. Do yo have any suggestions as to why the voltage is rising so high? When I dissconect the 5V input power my meter shows the voltage dropping very fast and settles out at 4.18v on the battery.

    1. Sounds like you’ve got the MOSFET wired backwards, connecting the USB 5V to the battery through D1 and Q1 body diode. See if it charges properly with Q1 removed.

    • Matthew Fredregill on June 13, 2019 at 10:28 pm
    • Reply

    I should have mentioned I am just using the basic wiring diagram from the spec sheet of the IC. It wired the same as the first picture in your post (basic charging circuit)

    1. Ah right, in that case you’ve either got a bad chip or a short somewhere.

      • Matthew Fredregill on June 13, 2019 at 10:31 pm
      • Reply

      The only differece is instead of 4.7 uF caps I am using 10 uF caps. Seems like a simple circuit I do not know what could be causing my issues.

    • Sener on July 13, 2019 at 4:18 pm
    • Reply


    This is most complete design I have seen lately, congratulations. Not only the author’s informative write-up with extreme knowledge but also his contributions in the people’s posts. Thank you all including who has also contributed by their posts.

    I have also a question although it’s been a long while after this article. Hopefully I would get some feedback.

    Since I need 5V output, I wanted to add step-up using PAM2401. (It would be also maybe TPS61200).
    My question is about how to connect the step-up next to the Load-sharing.
    I guess, I should bypass step-up somehow if the USB power is connected. And it needs to be connected to the target circuit.
    But, output of the step-up is also sharing that same output after all. Would that cause any issue?

    Thank you very much from now.

    1. Hey Sener, thank you 🙂
      Placing the boost regulator between the output of this circuit and the supply input of your circuit could work, however you’ll need to test it as different chips react differently when the supply voltage is greater or equal to the desired output voltage, it might stop oscillating and you could end up with less than 5V (small drop through internal MOSFETs/diodes), or the output could be very noisy. Also, the PAM2401 has a max input voltage of 4.75V, but absolute max of 6V, so be careful with that one.

    • Sener on July 13, 2019 at 4:22 pm
    • Reply

    Addition to my previous post;

    For example, that circuit?


    For a reference, I took that image from here;


    1. Oops, this got caught in spam. Containing on from my reply to your other post, you will have to prototype and test it really, it’s difficult to say for sure.

    • baytree on July 21, 2019 at 7:32 pm
    • Reply

    I’m pleased to discover this because I have the difficulty described – trying to charge a LIPO battery (using a wireless charger) while the load remains connected. When the battery is completely flat, it is hard to get it to charge. I can’t disconnect the load because it is all encapsulated. However, there is no requirement for the load to continue to be powered while it is being charged. In this case, would it be possible to omit the Schottky diode? Also, the power source is a 4.2V wireless charging unit rather than a 5V USB port – does this matter? Thank you

    1. Hi baytree, yes removing the diode will cause the load to turn off when a charging power source is connected. Using a 4.2V power source will probably mean that the battery will never fully charge, maybe up to around 4V. The charging status LED might also never turn off since the battery will never reach the 4.2V target. You’ll have to test it!

    • Michel on July 24, 2019 at 11:47 am
    • Reply

    Quick question: is there any reason you chose 1V as the target Gate-Source voltage? Or am I getting this wrong?

    1. Hey Michel, 1V was a semi-arbitrary value I chose. It needs to stay low enough that the MOSFET doesn’t turn off when the USB cable isn’t plugged in, at both the maximum and minimum battery voltages. For example, if the gate voltage is 2.5V, then Vgs with a fully charged battery would be 2.5 – 4.2 = -1.7V, and the P-MOSFET will be on. When the battery is low, Vgs would be 2.5 – 3.0 = -0.5V and the MOSFET will be off, and current will pass through the internal diode creating a ~0.6V drop.
      A lower gate voltage will turn the P-MOSFET on harder, which is important if you’re passing high currents. Different MOSFETs will also have different gate threshold voltages.

    • Ben on August 28, 2019 at 5:19 am
    • Reply

    Hi Zak, really good article! I have an MCP73831 and have made the same LiPo charging circuit as seen in the datasheet (500mA) and I’m particularly interested in making an ultra-low power project that won’t exceed 500uA when in sleep mode (charging circuit still attached). I’m afraid the schottky diode will produce too much leakage current combined with the rest of the project. How would you go about making an ultra-low power battery charger with load sharing, or as low as possible? the LiPo is 3.7V @ 1000mAh

    Thanks for your time!

    1. Hey Ben, using a better schottky diode would be the best thing to do! BAT60JFILM and ZLLS410 are some that have less than 1uA leakage.

        • Ben on October 22, 2019 at 3:20 pm
        • Reply

        Hey Zak, I ended up using the BAT20J Schottky and DMP1045U Mosfet in the end, and it work brilliantly. Ended up pulling about 40uA through the charging circuit and a low power regulator with stop 2 mode on an STM32L431. Would just like to thank you again for the awesome article, the load-sharing worked flawlessly.

    • Ross Herbert on December 8, 2019 at 8:19 am
    • Reply

    Hi Zak,

    I have some queries regarding the operation of the load sharing portion of the circuit.

    I have built a Li-on charger based on a TP4056 charging module (performs a similar function to the MCP73837) using the p-chan mosfet load sharing arrangement as in your project and as per http://ww1.microchip.com/downloads/en/appnotes/01149c.pdf

    The document shows that the p-chan mosfet is wired with the positive of the battery connected to the drain ( D) terminal and with the source (S) connected via the load to ground. This is opposite to the normal connection for a p-chan mosfet switch. See http://www.learningaboutelectronics.com/Articles/P-channel-MOSFET-switch-circuit.php
    In order for the p-chan mosfet to turn ON the Gate must be negative wrt D and the S is connected via the load to the positive voltage.

    To my thinking the mosfet is not actually doing any switching at all – whether the load is powered from the USB +5V or the 3.7V Li-on battery.

    When the load is powered from the USB supply the p-chan gate (G) is biased OFF (G more +ve than D) and the D – S channel is open and D1 by-passes current direct to the load.

    At the same time the p-chan body diode has +5V at the cathode and 3.7V at the anode meaning it is reverse biased and non-conducting thereby isolating the battery from the load. This means the Li-on battery is free to be charged via the charge controller IC independently.

    When the USB supply is removed the Li-on battery +ve is connected to the D and S is connected to -ve via the load – the reverse to that required for a p-chan switch. While it is true that the G is now biased to -ve via the 100K resistor this is hardly of any importance because the D and S have incorrect polarities to that required for the channel to switch ON. What does matter is that the p-chan body diode is now biased ON and load current is now supplied via this path.

    Is my reasoning correct or have I got things wrong regarding mosfet operation?

    1. Hi Ross, “In order for the p-chan mosfet to turn ON the Gate must be negative wrt D”, no, all that matters is G and S (not D). When USB is plugged in, G will be at 5V and S will be at (5V – D1 Vdrop) = ~4.5V, so Vgs is +0.5V and the P-MOSFET is off (current can’t flow through the body diode either since Vbat is below 4.5V after the D1 Vdrop). When USB is removed G will be close to 0V and S will be at (Vbat – Q1 internal diode Vdrop) = ~3.8V which gives a Vgs of -3.8V and the P-MOSFET turns on, this also removes the internal diode drop which then turns the P-MOSFET on even harder.

    • Kian on February 12, 2020 at 2:48 am
    • Reply

    Hi Zak,

    I am building the charge circuit with load sharing mentioned in this article and plan to use the DMP1045U MOSFET together with a BAT20JFILM. The BAT20JFILM has a leakage of 0.65uA, give R2 a value of about 6M.

    Should I just use R2 to be 100K in this case or should I choose another diode with a higher leakage so that R2 does not exceed 100K?

    1. Hey Kian, using 100k for R2 is what you want. The main reason for this 100k limit is so that any charge that builds up at the MOSFET gate can be quickly removed, higher resistances will slow it down.

    • kenneth on March 19, 2020 at 10:51 am
    • Reply

    Hi Zak,

    Great and informative blog post and I can’t believe I only see this now.

    I am working on a project where I need load sharing for a high current application (around 5A max). The idea is that when this is needed a 5V adapter can be connected and the battery is for more low power usage. I have looked at the common load sharing chips like BQ series, but they all have MOSFETs internally integrated and therefore most chips only handle input current around 1A/2A.

    I like to give this circuit a try but wanted to ask what your experiences were, with a somewhat higher current application. I have quickly looked at some MOSFETs and diodes and came up with these.

    diode: WNS20S100CB
    mosfet: Si3483DDV

    These components are a little bit overkill I think

    thank you for this nice blog post.



    1. Hi kenneth, thanks! I’ve only used this design in projects drawing up to around 300mA, using a DMP2035U MOSFET and PMEG2005EB diode. Your chosen components look fine though. 🙂

    • Nick on May 1, 2020 at 3:38 am
    • Reply

    Hi Zak, thanks for this! Super helpful, working great with DMP2045U and B130LAW. Dumb question about the LED on the stat pin– is there a simple way to stop it from constantly blinking when no battery is connected (and the pin is High-Z)? If I hook up a bicolor LED where low = red, high = green would I still get a blinking when high-z?

    1. Hey Nick, the LED flickers because it’s trying to keep the output capacitor charged, like a battery, but since it’s so small it quickly discharges again. Adding a larger capacitor should at least reduce the flickering. To completely get rid of flickering you’ll need to add some circuitry that waits for the STAT pin to be low for at least 100ms or so before turning on the LED, maybe an RC filter? A bi-colour LED will flicker a single colour since current needs to flow in the opposite direction for the other colour, but high-Z means no current, unless you use the MCP73831 then it will flicker between the 2 colours.

    • Mario on May 17, 2020 at 12:09 am
    • Reply

    Hi Zack, I have a question regarding using this configuration but instead of wall wart I want to use a solar panel for charging 3000 mAh li-ion and powering Arduino Uno with peripherals ( about 60 mA current consumption ). I am using this charger https://wiki.dfrobot.com/Solar_Power_Manager_5V_SKU__DFR0559#More_Documents. Do you think this could work with solar panel?

    1. Hi Mario, if the load sharing circuit receives 5V from the solar charger then everything should work fine.

        • Mario on May 17, 2020 at 1:59 pm
        • Reply

        Thank you for your fast reply! My understanding is to connect the Vsolar to the GATE of the P-Mosfet and SOURCE to the output of this charger, which is 5V. Below 4.4 V from the Solar panel the charger module won’t charge anymore, so my goal is when the solar panel’s drops below 4V, the P-Mosfet to be turned “on” – charger output will then be connected to the load and when there is above 4V up to 6V (as my panel Voc is 6V) the mosfet will be turned “off” disconnecting the charger output from the load allowing the solar panel to power the load. Correct me if I am wrong, I need a P-Mosfet with VGSth of -1V at least in order to turn it on ( Vgate – Vsource, when Vsolar drops to 4V will be = -1V ) . Will this work https://www.onsemi.com/pub/Collateral/NTD25P03L-D.PDF ?

        1. I’m not sure what Vsolar is? Maybe a diagram showing how you’re thinking on connecting things up will help.

            • Mario on May 17, 2020 at 7:18 pm

            Hi Zak, this is how I would like to wire the things up : https://drive.google.com/file/d/1S4ftVssY6O9EekAm2JnoUH4uD1SDZwst/view?usp=sharing

            For selecting a suitable p-mosfet do I need to look for a VGSth = -0.6 V min to turn ON the mosfet to allow the output from the charger to flow to the load, based on this: Voltage at Source will be 5V, I am calculating the voltage from the solar panel when it drops to 4.4V as this is the minimum the charger can accept, so 4.4V at Gate – 5V at Source = -0.6 V ? When the solar panel’s voltage rises to above 4.4V the mosfet needs to be turned off to allow charging the battery without being connected to the load.

            Then there is the issue with the load powered when the mosfet is off from the solar panel directly, as 6V will be too much to supply Arduino Uno and 16×2 LCD, can I use for D1 1N4007 silicone diode to drop the voltage at the load to around 5.3V, but untill the mosfet switches to battery output 4.4V – 0.7V from the diode = 3.7V which won’t be enough to power the Arduino. I am really confused if this is actually the right approach to find a way how can the battery be charged with load sharing from a solar panel.

          1. You have S and D the wrong way around in your diagram, but the symbol is correct (source goes to load) and don’t forget the internal diode. The MOSFET threshold voltage is only when a small current begins to flow, usually around 250uA. You need to look at the “On-Region Characteristics” and maybe “Transfer Characteristics” charts in the datasheet to figure out how much Vgs you need to get the current that you want. If the solar panel is at 4.4V and the charger is outputting 5V then the Vgs will be (Vsolar – D1 Vf – 5V) = (4.4 – 0.5 – 5) = -1.1. However, this doesn’t include the MOSFET internal diode since that makes things a little bit weird. There’s also a transition point where the MOSFET will only be partially on. But yeah, this circuit isn’t really suitable for what you want, you need some kind of active control to decide when things should turn on and off. Surely your solar module already does all of this, which is why it has a 5V output?

            • Mario on May 18, 2020 at 10:06 am

            The the other option I am thinking of that could be much easier to implement is to measure the Vsolar from the Arduino’s analog pin and when it drops below 4.4V to turn ON a logic level P-Mosfet and possibly another P-Mosfet (switched ON by the Arduino) to allow the Vsolar to go through MT3608 booster when the voltage is less than 5V in order to power the load. Can this work ? I have found that the same thing was asked for the same charge IC (CN3609) in this thread: https://electronics.stackexchange.com/questions/169611/solar-battery-charger-with-load-sharing and the solution is to use a comparator, but if the Arduino voltage measure at the analog pin can be implemented wouldn’t it be much easier overall?

            Another question why the SOURCE of the mosfet needs to be connected to the load instead to the 5V output from the charger?

          2. The comparator method is probably easier and more reliable, no need for any extra software and will start working from the moment power is applied. In your set up it probably doesn’t matter which way around drain and source are connected, depending on the 5V boost regulator (is it ok if 6V is applied backwards into it?). However, in the original load sharing circuit if the source is connected to the battery then an uncontrolled amount of current can flow from 5V USB through D1 and the MOSFET internal diode and into the battery, likely damaging it and possibly overcharging it.

            • Mario on May 25, 2020 at 7:34 pm

            Hi, after some experiments I have come up with this circuit: https://i.imgur.com/xN9pCfu.png ( its 3065 charge module).
            The following voltages were measured with my DMM, when the logic level p-mosfet (AP4435GJ) was turned off, so that the charger module ( and the battery ) were disconnected from the load and only the solar panel was providing power to the load. Till this moment I still haven’t made the voltage reader from the Arduino’s analog pin to monitor the panel voltage and decide whether to turn ON or OFF the mosfet through the digital pin.

            Is it absolutely necessary to connect the DRAIN of the mosfet to the charger output, instead of SOURCE? As I have understood when the mosfet is off the body diode will prevent current going back to the charger from SOURCE TO DRAIN ? I have checked the schematic of the charger module and I didn’t see any diode implemented to block that current, but the battery is firstly connected through the battery protection IC then to the voltage booster. Will this cause problems if I leave the SOURCE connected to the charger? When I tried to wire it the opposite way – DRAIN to charger, SOURCE to load the mosfet didn’t respond to whether the gate was HIGH or LOW, it seemed it was always ON – letting the charger to be connected to the load no matter if the VGS was -4.5V for turning it ON or 0V for turning it OFF. When it was connected SOURCE to charger it worked as it should. I also tried with another unit from the same type mosfet and got the same results. I was thinking of doing it charger output – > schottky diode -> SOURCE connected and DRAIN to load, but I don’t want to have a voltage drop ( mainly because I am using the charger regulated output of 5V as a external analog reference for the Arduino to measure solar panel’s voltage, therefore controlling the GATE from the GPIO.)

            I cannot understand how the LI-Ion charging stops. So I have made a test to see at what voltage the charger’s charging LED turns OFF. Below 4.2V at SOLAR IN the charging stops, when the mosfet is OFF and the measured current at SOLAR IN was 0, but as soon as the mosfet turns ON, the voltage of the solar panel tend to rise above 4.2V and the charger’s LED turns ON with measured current at SOLAR IN 30mA for that test. Is this charging process turns on when there is a voltage greater than the battery voltage (at the moment) or there is an input current threshold that needs to be satisfied in order to charge? Here is the datasheet: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjtiKjl08_pAhXMgVwKHZIZCroQFjAAegQIBBAB&url=https%3A%2F%2Fraw.githubusercontent.com%2FSeeedDocument%2FLipo_Rider_Pro%2Fmaster%2Fres%2FDSE-CN3065.pdf&usg=AOvVaw0zhQb1VmJeOx0QQoo9YATp. I am asking this as my concern is that if I turn ON the mosfet to allow battery supply at Vsolar < 4.1V ( when there is clouds or not enough current is produced from the panel to supply the load) the voltage of the panel rises and the charging starts which will charge and in the same time discharge the battery ( not sure if there is going to be issue if the charging current is less than the current drawn from the battery, as no overcharging could occur)

    • George on May 20, 2020 at 5:24 pm
    • Reply

    Thanks to your blog post, I’m looking at adding the load sharing function to the inexpensive “18650 Battery Shield” which is the subject of Andreas Spiess’ Youtube video #250. The board layout isn’t conducive to doing this, but if I can get it to work, I’ll do a video on it so everyone can have a cheap “powerbank” for Arduino-like stuff that lets you draw more than 60 mA, power the load while charging the battery, and which won’t shut down if the load current is too low. In effect, a UPS for Arduinos up to maybe an amp.

    But with reference to Mario’s project to have load sharing in a solar lithium charger, it seems to me this is a much more difficult problem because the power source isn’t either fully on or fully off. The voltage and available current from a solar panel wanders all over the place, and in particular, the voltage changes a lot when you go from no load to pretty much any load. So if you test the input voltage with a comparator or MCU, and decide it’s high enough, it drops below the trigger level the instant you apply load to it. And in fact even the battery also behaves that way. So it seems there’s a strong tendency to oscillate.

    I was hoping there was a standard load sharing circuit for solar chargers that we could add to our projects, but I’ve never seen one. Only the MCP73871 seems to have figured it out, and it appears to be available only in QFN, which does me no good. And even that chip also has a safety charging timeout – just in case.

    If you find a workable solution for solar, I hope you’ll do another blog post on it.

      • Mario on May 25, 2020 at 7:40 pm
      • Reply

      Hi George, yes my tests conclude that the voltage from the solar panel drops when it cannot provide enough current for the load and as soon as the mosfet turns ON to allow battery supply, the solar voltage rises as there is only the charger module hooked on it. I have one possible workaround in my head that can be implemented with a code, but I need to make some test to confirm if it is actually going to work. I can’t believe that there is such limitation if you want to have a solar li-ion powered project.

      • George on June 3, 2020 at 11:12 pm
      • Reply

      Well I finally got the video done, with a thanks to Zak Kemble at the end:


      But I still wonder if there is a load sharing circuit that works for solar power. I know the MCP73871 is supposed to do that, but I would want something made up of discrete parts that we could add to circuits.

    • Felix Jen on August 8, 2020 at 5:30 am
    • Reply

    Hey there! Thanks for this awesome post! I’m planning on doing something similar in my next circuit.

    It’s going to a high power though with the load either drawing 50mA at times and 450mA at times. I know my USB power is capped to 500mA, so how does this circuit split the 500mA power budget? Is the system load prioritized, with the battery only getting 50mA when load draws 450mA?

    I know this is how other Dynamic Power Path Management chips like the MCP73871 do it, prioritizing “system load.” Does this circuit replicate that effect though?

    1. Hi Felix, the circuit does not monitor or control how much current is being drawn (apart from the battery charging current). You could add some current monitoring and make it stop or adjust charging current if the system current is too high (a comparator or opamp to control the RPROG pin or something).

      It mainly depends on how closely you want to follow the USB spec and what the USB power source does when the current draw hits 500mA. They’re supposed to cut off power, but this rarely happens and are usually fine with 1-2A.

      At the moment if power is cut off then the charging circuit will just switch to battery. If the power source does not have a hard limit, then the supply voltage will begin to drop instead. The load sharing will use the supply with the highest voltage (after diode drops etc), or a bit of both if the voltages are close enough.

    • SAFA24 on May 25, 2021 at 11:02 am
    • Reply

    Hi there great work !!
    In my project im using an LTE module , wifi module and MCU ; and its powered by usb and battery as well sme like u mentionned before , so to power my modules i will need to use LDOs to drop down voltage so basing on ur design do i need to connect VCC to each LDO and obtaining the desired voltage is that possible (Ps im going to use MIC29302WU as regulators ) hope u undrestand what im saying thanks .

    1. Heya, yes, VCC should go to your regulators.

  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 to Zak Kemble Cancel reply

Your email address will not be published.

Are you human? *