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

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

    • Felipe on September 18, 2013 at 1:27 pm
    • Reply

    my name is Felipe and I have a question.
    I need use the MCP, but I need put a resistor between VBAT pin and Bat pin. Because this resistor, I am having problems with charge. The current of charging is lower than the ideal.
    You ever had this problem?

    1. Whats the reason for having a resistor between VBAT and the battery?

        • Felipe on September 18, 2013 at 7:13 pm
        • Reply

        I will use my electronics in an environment with flammable gases. Is a norm in Brazil use this resistor.

        Sooner, I saw problem with my current of charge, its lowering very fast, in 15 minutes go to 150 mA, when my prog resistor is configured to 300mA. I need solve it before. I no have capactors in my charge circuit, after add I return with notices.


        1. Hmm, well, you won’t be able to get more current through the resistor unless you reduce the resistance or increase the voltage, but increasing the voltage would be a bad idea. The charging IC is not designed to have a resistor in series with the battery.

    • Petr on October 31, 2013 at 9:48 am
    • Reply

    Hi Zak,

    I am trying to understand MOSFETs and I’ve got some issues understanding your load sharing schema: the Q1’s Vgs starts from -0.3 V (from its datasheet) and we use Schottky with say 0.4 V forward voltage drop (you compute that it can go as high as 1.15 V!). Now when the USB power of 5 V is attached then the gate has say 5.00 V and the source has 0.4 V less (because of the D1 voltage drop), i.e. 4.6 V. That means the Q1 switch is closed because Vgs is -0.4 V (thanks to the D1). When the switch is closed the current flows from USB directly to battery and destroys it. That’s first issue. Now say we disconnect the USB, the Q1’s gate voltage is zero then. The Q1’s source voltage is unknown, it’s probably flying somewhere because it’s connected to the load only. But the load can have low input resistance so we may suppose the voltage of Q1 source is zero as well. Now the Q1 is open (because Vgs = 0 V) thus the current from battery cannot flow to the load. That is the second issue.

    I probably missed something crucial but in my eyes this schema cannot work both with and without the USB power connected. Please enlighten me, thanks in advance!

    1. Hey,

      2 problems: You’re doing an extra step when working out Vgs and forgetting about the internal MOSFET diode.

      When working out the Vgs, you only do Vgs = Vg – Vs (5V – 4.6V = 0.4V (not -0.4V)). That means the P-MOSFET is open/turned off when USB power is applied.

      When USB is disconnected, with a high or low load resistance, the MOSFETs internal diode will conduct and the source voltage becomes Vs = Vbat – Vf (4.2V – 0.6V = 3.5V). Then Vgs = Vg – Vs (0V – 3.5V = -3.5V) which will close/turn on the P-MOSFET and bypass the internal diode.

        • Petr on October 31, 2013 at 12:03 pm
        • Reply

        Oh, the Vgs error I made is obvious, thanks for correcting that. As for the MOSFETs internal diode – I indeed haven’t realized it can be used for passing the voltage from drain to source (all usual schematics connect voltage to source, not drain, you know 🙂
        Thanks a lot for the explanation!

        BTW, the Vgs can be as low as 2 V (for almost discharged battery) so we need a MOSFET with a rather low Vgs threshold, right? I suppose those with min 2 max 4 V Vgs(th) (like IRF9450) cannot be used for this. I’ll need to find a smaller one than I have here.

        Could this load sharing be done with a N-channel MOSFET by any chance? I have a bunch of those handy… 🙂


        1. No problem 🙂

          A LiPo/LiIon battery should never go as low as 2V, that makes it a dangerous battery. Absolute minimum should be 2.4V, but no less than 3V is preferred.
          Vgs(th) of the IRF9450 is a little too high, it might work, but the Rds will be quite high. An N-MOSFET could probably be used, but not as a replacement, a complete circuit redesign would be needed.

            • Petr on October 31, 2013 at 12:52 pm

            FYI, the Vgs as low as 2 V is true for battery with about 2.6 V (I subtracted the Vf already) which is indeed slightly less than the preferred LiPo/LiIon voltage but still quite possible. The Vgs(th) of the Q1 should definitely be lower than 2 V.

            I am searching for a P-channel MOSFET with low Vgs(th) on Ebay now. Pity the AO3401 in SOT-23 are not easy to solder on universal PCB…

          1. Ah I see. FDD6685 might be OK, it’s in a larger SMD package so it shouldn’t be too hard to solder some wires to it. All the good stuff are SMD these days.

  1. After building this circuit, I think the MOSFET in the schematic is backwards. Source should go to VBAT, Drain should go to output.

    1. No, if it was wired like that then there would be a short from USB to the battery; current will pass through D1 and the internal diode of the MOSFET into the battery.

        • Daniel on November 13, 2015 at 5:02 pm
        • Reply

        It looks backwards to me too. The mosfet will conduct whenever the gate voltage is lower than the source voltage right? so when Vin is not connected, wont both the source and the gate voltage be 0 causing the fet to stay in the “off” position?

        1. When the MOSFET is off and Vin is removed the MOSFETs internal diode will conduct, bringing the source voltage to the battery minus the internal diode drop. If the battery is at 4.2V the source will be around 3.6V, meaning Vgs will be -3.6V causing the MOSFET to turn on and bypass the internal diode.

            • Daniel on November 13, 2015 at 10:13 pm

            Ok so when Vin is plugged in and the mosfet is off, would current still flow from the battery through the internal diode?

          1. No, because the voltage at the source will then be higher than the battery voltage, blocking any current through the internal diode.

            • Daniel on November 13, 2015 at 10:43 pm

            Ok that makes sense, Thanks!

    • Lili on November 26, 2013 at 10:51 pm
    • Reply

    I have built this circuit and tested on both veroboard and a PCB. I have a problem when the USB is unplugged that there is a small (~0.5V) voltage that appears on the USB pin. I was wondering what causes this? I am using the same components as shown in the charge circuit with load sharing image.

    1. The small voltage is caused by the reverse leakage current of the schottky diode. It’s nothing to worry about since available current is so small (<1mA).

      • Philip on March 13, 2017 at 10:40 pm
      • Reply

      This is a bit of a late reply, but I built this and ran into the same issue as Lili. I think it’s caused by the internal structure of the MCP73831/2, although I can’t find anything in the datasheet to confirm.

      I tried removing the diode while running on battery, and the voltage still shows up on the VDD pin. I replaced the diode and lifted the VDD pin, and the voltage went to 0.

      Depending on the MOSFET you use, this shouldn’t cause a problem with operation of the switching (it doesn’t for me), but I had a detection circuit with VBUS driving the base of an NPN BJT, and there’s enough current to turn it on even with the USB unplugged. Zak’s voltage divider design is probably more workable.

    • Dustin on January 9, 2014 at 5:02 pm
    • Reply

    Hello, Was curious if you could use this chip for say 2 cells in series? I’m wanting a 2 cell rechargeable battery pack that can be plugged into usb when needing to charge as well as turn on off when there is a load present.

    1. No, the IC only supports single cells. If the cells are in series then you will need a voltage booster since USB is only 5V and 2 cells go up to 8.4V.

  2. Zak, thanks a million for your excellent article on load sharing. This detailed info was surely missing from the AN1149 application note 🙂

    I am using the same concept for my designs too, you can also check the PMV32UP P-Channel MOSFET from NXP, almost same low Rds, cheaper price.

  3. … and PMV16UN for the N-channel.

    I just saw your AVR setup too. That’s an excellent design, well done. I would really appreciate if you could answer some questions I have, that would help me a lot.

    a) for extra input protection, maybe a reverse-biased 2.5V zener diode should be connected to the output of the R2/R3 voltage divider. I know that USB power is already protected but who knows… however, in the case of an external (e.g. wall) 5V source I think it is essential.

    b) are R4 and R8 and R10 really essential ? I see them in some designs, not in others, and I cannot really understand their purpose on limiting current to a MOSFET gate.

    c) is it possible to use the same P-channel MOSFET for Q2 and Q4 by putting it above R1 and R9, respectively ?

    Thanks a lot again !

    1. Though PMV32UP and PMV16UN don’t have any ESD protection (the 2 back-to-back zeners between gate and source). I like the extra protection 😛

      For anyone reading this, we’re referring to DIY Digital Wristwatch.

      a) If the USB voltage goes over 6V (max pin voltage is VCC + 0.5V so 3V) R2 will limit the current a fair bit. I don’t think it really needs the extra zener. You could instead change the ratio of the 2 resistors, 56K and 39K would work at 5V and be able to go up to a little over 7V before the output goes over 3V, but by then you’ve probably damaged the charger IC since its absolute max is 7V.

      b) Well, MOSFET gates are like little capacitors. When turning them on and off you need to charge and discharge them and with no resistance you’ll get large, but short, current surges which can damage stuff over time. Gate resistors can also be used to reduce ringing and EMI.

      c) (I guess you meant Q3 not Q2, since Q2 is already a P-MOSFET. LS1 instead of R1 and R8 instead of R9)
      No, Q3 and Q4 can’t be P-MOSFETs. The purpose of Q3 is to level convert the controllers’ 2.5V output up to the battery voltage level so Q2 can be turned off. You’d have to use the same level conversion technique with Q4 if you change it to a P-MOSFET.
      MOSFETs need to have their gate voltage at close to its source voltage to turn off, the source voltage for Q2 and Q4 (if it was a P-MOSFET) would be whatever the battery is at (3V – 4.2V) and 2.5V from the controller wouldn’t be enough to turn it off.

      1. Thanks a very lot Zak, for your prompt answers, everything is perfectly clear. As far as the MOSFETs are concerned, the extra protection feature is really important so I am thinking of buying some strips of them too !

        In my last question I was referring to the microcontroller setup you are showing on this post (not in the wristwatch post), so we were talking the same thing 🙂 I have a few questions on the wristwatch schematic as well and I will post them there. Your help is mostly appreciated !

        1. Lol oops, I had completely forgot about that part of the post >.< Though Q2 and Q4 still need to stay as N-MOSFETs because the 2.5V from the microcontroller won't be able to turn P-MOSFETs off.

          1. Yes, absolutely true 🙂 You’ve been mostly helpful for me to understand those MOSFET secret details !

            I also looked at the similar DMP2035U part from Diodes, same price, better max VDS (-20V) and lower RDSon (23 mOhms).


          2. They can only handle a few amps so a few mOhms isn’t really going to make much of a difference. I’ve been using DMG6968U and DMP1045U just because I’ve brought a load of them so at the moment they’re my small-general-whatever-use-them-for-anything MOSFETs 😀

    • Marcello on February 23, 2014 at 11:14 pm
    • Reply

    Hello there. I need to charge two Li-Ion batteries that are both powering a device; I was already planning and building a circuit with 73831 when i came upon your “addendum” and thought it’d be very useful. I only have to modify the circuit a little, and i was wondering if you could tell me if it is right or not. Since i have to charge two batteries i simply doubled the 73831 part including the MOSFET, so that every battery (slightly different in mAh and wear) would charge independently. The only thing i didn’t double is the final part with D1, R2 and C3 cause it would be redundant. Basically it’s a twin charger circuits, meeting at the MOSFET sources to power the device. Do you think it could work?

    1. Your idea should work for charging, but I’m not sure about discharging. One battery might end up charging another at an uncontrolled rate (especially if you partially charge the batteries so they’re all at different voltages), adding a diode just after each MOSFET source should fix that. Actually, if you add the diodes then there’s no need for the MOSFETs since they’re only acting as super low voltage drop diodes.

    • Marcello on February 26, 2014 at 3:07 am
    • Reply

    You’re right, but now I realized my problem is slightly different: since the device’s pcb is already being powered by Vcc when its jack is connected, what i’d need is only to disconnect the batteries while they’re being charged. I thought of simply removing D1, cutting off the direct power-to-load; there shouldn’t be problems about +5V going to the load since there’s no flow of current through the MOSFET, am i right? (but i’m keeping C3 and R2).

    1. D1 is to stop the battery from keeping the MOSFET turned off when VCC is removed, if the MOSFET is always off then it will just act like a normal diode because of the body diode.

        • Marcello on February 27, 2014 at 4:33 pm
        • Reply

        I know, but i meant to remove D1 entirely along with its line, because I don’t need the load to be powered directly by Vin. I only need Q1 to stop the battery powering the load, my only doubt is: would there be some current going to the load when Q1 shuts the battery?

        1. Ah right, yes, current will pass through the MOSFETs body diode to VCC because there is no higher voltage to block it (normally from D1). A second P-MOSFET after Q1 with source connected to Q1 source, drain to VCC and gate to Vin should fix that, though.

            • Marcello on March 6, 2014 at 2:58 am

            Uhm, but in this case i’d have a double voltage drop from the battery.. alternatively i found a minirelay laying around, i’ll see if i can use it, wish me luck..
            Anyway, thanks for your time.

          1. The MOSFETs will only have a few millivolt drop, they turn on when Vin is removed. Though a relay would work too 😛

  4. Thanks for the great article. I wish I had this when I was starting my design — it would have saved me a lot of time.

    I’m curious — in the microcontroller circuit, why did you use Q2 and R4? Wouldn’t the microcontroller’s open-drain output serve effectively the same purpose? Were you worried about the current? From what I understand from the MCP73831/2 datasheet, we’re looking at around 500µA out of the PROG pin, so this should not be a problem I think?

    1. R4 is because the gate of a MOSFET is like a small capacitor, there will be large current surges when turning the MOSFET on and off, the resistor limits the current to a safe level. Though really, since the MOSFET isn’t going to be switched often and the DMG6968U gate capacitance is only 151pF it’s probably OK to remove R4.
      Q2 is used because of the ESD diodes giving a max pin voltage of VCC (2.5V) + 0.5 = 3V, setting the pin to High-Z will connect the PROG resistor to 2.5V via the ESD diode and you’ll still get current passing through. If the controller is running without the regulator then it should be OK to remove Q2 and just use the controller output.

      1. Right — the body diodes. I always forget about those. Ok, I understand now. Luckily for this transistor Rdson doesn’t really matter, so a really cheap one like a BSH111 (5Ω Rdson) should do fine.

        Thanks for explaining!

    • Milan Adhikari on April 16, 2014 at 8:46 am
    • Reply

    Hello Zak,

    Thanks for the article its really good one to read when someone is starting with such design. I have a concern about powering the load. Now we are powering the load with 4.2V but what do I have to do in order to provide 5V to the load? Do I have to step up 4.2 V to 5V?

    1. Yup, you will need a 5V boost converter like NCP1402.

    • Hiren on April 16, 2014 at 12:35 pm
    • Reply

    Thank you for the idea.

    • Roy on June 4, 2014 at 8:48 am
    • Reply

    Hi Zak,

    Why not use a diode instead of Q1. No current will go into the battery, from the USB input, because this voltage level is higher than the charge voltage of the battery charger. What is the disadvantage in doing this using 2 diodes instead of a diode and a FET?

    Nice explanation of the circuit itself.


    1. Diodes have a relatively large voltage drop. When the MOSFET turns on current will bypass the diode, so instead of the ~250mV drop of a Schottky diode you get ~3mV drop of the MOSFET (assuming 30mΩ Rds and 100mA).

        • Paul on February 1, 2018 at 2:18 pm
        • Reply

        Exactly what I was wondering. I was going to use just a diode…

    • Bernhard on June 12, 2014 at 9:05 pm
    • Reply

    Hello Zak,

    Thank your for your excellent article. I was searching for ages on the Microchip Website because it was missing some part like the MCP73831 only with an extra disable or shutdown input. I also came to the solution using a MOSFET on the PROG pin. Since I am no Expert on MOSFETS I startet searching and found your blog.

    My Question is: Why not skip R10 and Q4 and connect R8 directly to the gate of Q3. My guess is that this might cause a current to flow from Bat+->R9->PD7->body diode->VCC->R2->R3->GND?

    I am planning to use this for a LPC but I guess the principle with the body diode is the same.

    Best Regards,

    1. Yup, the battery voltage will pass through the MCU internal diodes and kind of fight with the 2.5V regulator trying to bring it up to battery voltage, but not much bad stuff will happen because of the limited current through R9. Also because of the diode and everything the gate voltage will probably be clamped at 2.5V + diode drop, so you’ll end up with around 3.2V at the P-MOSFET gate which won’t be enough to turn it off (3.2 – 4.2V = -1Vgs). R2 and R3 aren’t touched.
      Q4 is to level shift the 2.5V up to battery voltage so the P-MOSFET can turn off. Removing the 2.5V regulator will mean you don’t need all the level shifting stuff since everything will be at the same level.

    • Eric on July 22, 2014 at 2:43 pm
    • Reply

    Great write up. Confirmed a plan I had in mind for using p channel MOSFET for source switching.

    Question: when the battery is charging, I just want the load circuit turned OFF, not powered by usb. To achieve this, I can simply omit the wire from usb to load (and the Schottky diode), right?

    1. Yup, but you will also have the swap the drain and source of Q1 so current doesn’t go through the internal diode to the load.

        • clovis on February 4, 2017 at 5:42 pm
        • Reply

        2 years late but whatever…..i will try and hope you are still there.
        I need a battery backup to power a SIM800L, BUT Sim800L needs from 3.2V to 4.2V supply.
        I am thinking of swapin drain and source and replacing D1 with a buck converter (from 5V to 4.0V). So the fet will open when there is 5V at Vin and will open when there is 0V.
        There will be no reverse current on Q1 when battery is fully charged (4.1V or 4.2V). And there could be reverse current on Q1 when the battery is charging (but TP4056 will try to keep B+ at 4.2 so there should be no rever current at Q1)

        What do you think?

        Can you see other solution to this?

          • clovis on February 4, 2017 at 5:46 pm
          • Reply

          sorry forgot to say that I have also replaced MCP73831/2 by TP4056 pcb (it has a B+ hole to connect the plus terminal of the battery).

            • clovis on February 5, 2017 at 11:32 pm

            i have another idea.
            what if i make just as you did, but use a buck converter to 4.2V instead of the diode. The mosfet will open since battery will be at most 4.2V and because of mosfet resitance.
            the load circuit consumes around 110mA typical and 2.1A pick (SIM800L making a call). When 2.1A is needed current will flow from the battery if the converter can’t. handle. What do you think?
            Do you have any suggestion?

          1. I’m still here 😛 Hmm, using a buck converter instead of the diode should work, but I don’t think the part about the current coming from the battery if the converter can’t handle it will work too well. The output voltage of the converter must drop to whatever voltage the battery is at before current is drawn from it. Different converter ICs will react differently to being overloaded. It would be best to just use a converter that can handle the peak current draw.

            Also, don’t swap drain and source if you plan on supplying power to the load, though a diode or converter, as current will uncontrollably flow into the battery via the MOSFETs body diode :P.

            • clovis on February 8, 2017 at 9:34 am

            thanks for the advice. Yeah, did not see this, Battery will suck whatever current the converter could supply when the other side is at higher voltage (I was unconsiously assuming the electrons would prefer to go to load first 🙂 and only some lost ants take left turn to the battery).

            I search for buck converters on ebay and some of them does not have reverse current protection.
            Maybe i will have to use a 9V power supply to the converter, use the converter to step down to 4.8V and use a diode after the converter. And use the same converter to supply to the TP4056 (it is supposed to accept from 4.5V to 5.5V).

            If I use a 5v power adapter (which can source up to 5.5V) using diodes will be dificult to keep in SIM800L acceptable voltage range at 100mA and at 2.1A. And because many buck converters have voltage dropout abouve 1V at 2A, converter + diode will be very close to the minimum voltage SIM800L can accept.

  5. Like this ?


    1. That would be correct.

  6. I would like to thank you once more, especially for the new diode leakage current section !

    I couldn’t explain the relatively large (1.1V) gate voltage I was getting, now it makes perfect sense 🙂 my load sharing circuit is now fine tuned thanks to this brilliant post.

    The only issue that I found is that the charging led remains on when the battery is not connected 🙁 however, I can live with it, since I have no idea how to turn it off in that case.

    check also my implementation of a magnetic switch (for the regulator that goes after the load sharing circuit), you may find it helpful for new projects : https://www.youtube.com/watch?v=zG1mUlXUgnc

    1. Good to hear 😀
      That magnetic switch looks pretty interesting, could definitely be useful.

  7. Nah, sorry, forget the last thing, I found it : it’s because of the voltage divider for sensing battery voltage which pulls VBAT to ground when the battery is disconnected…


    1. That, and the capacitor is like a very small battery, you’ll probably find that the LED is actually turning on and off very fast as it charges the capacitor then it discharges through the divider.

      1. Is it possible to go for larger resistor divider values (20K/68K) ?

        1. Since it’s just the battery voltage being measured (not a fast changing signal) you could try 1M + 1M with a 100n capacitor in parallel with the bottom resistor, though high value resistors will pick up noise like from touching the middle of the divider with your finger.

          1. I will !

            Now, when the magnetic switch is off, the battery consumes 100uA on the switch IC itself, another 50uA on the 20K/68K divider, and something more is unexpectedly leaking to the ADC input (MCU is turned off). Not bad, but it can be better.

    • João Ferreira on October 22, 2014 at 4:02 pm
    • Reply


    I would like to use this circuit to power a automatic watering system. But instead of being powered via USB or AC adapter, i would like to use a solar panel as voltage source.
    I was thinking in a 5v solar panel, but my concern is about current. If the battery is charged and the watering system is in off state, the solar panel would be constantly trying to send current to the system, right?

    1. Current can’t be pushed into the system, the system decides how much it wants. It’s the voltage you need to check, but I haven’t used solar panels much so I’m not sure how they behave.

    • Khue on November 23, 2014 at 5:10 am
    • Reply

    Hi Zak, thank you for this tutorial. I wasn’t sure before about the load sharing part of the circuit I needed to add. I’m trying to build a power supply for a 3.3V microcontroller. The power supply will be able to take an input of either 120VAC or 5V-18VDC. I have my schematic here: http://imgur.com/ACvB1Yk . In LTSpice, 3.3V out when there is a power input, but when I disconnect input power to the Battery Manager, my output is way lower than 3.3V. Do you know what’s wrong?

    1. I don’t think LTSpice simulates the MOSFET body diode for Q1 unless you manually add it in. The body diode is needed to get the MOSFET to turn on, without it Vgs would be 0V and the MOSFET would stay off.

    • Marc Singer on May 1, 2015 at 7:42 pm
    • Reply

    Nice post. It has been very helpful.

    FYI, I implemented your design using an ON-Semi NTLJF3117P which is a small package containing both the p-fet and the schottky diode.

    One of my goals is to reduce the current of the system when it is idle. My hunch is that if I increase the pull-down on VBus that the leakage current won’t really change. The voltage on VBus when there is no USB power will, but not the current. Is this right?

    1. Glad you found the post useful 🙂 The NTLJF3117P schottky already has very low leakage, about 600nA @ 4.2V (equivalent to a 7M resistor). A 50K pull-down results in 29.79mV @ 595.74nA, doubling it to 100K results in 59.15mV @ 591.55nA. So yeah, voltage pretty much doubled but current didn’t change much. Because of the already very low schottky leakage the pull-down resistance doesn’t really have much effect unless you start going into the megaohms range (but then the MOSFET could turn on from noise etc). You could use a less leaky normal diode instead of a schottky, the part about D1 mentions that you can have a drop of up to 1.15V across the diode if the supply voltage doesn’t go below 4.75V.

        • Marc Singer on May 1, 2015 at 10:01 pm
        • Reply

        I’ve been staring at the datasheet for the 3117 for some time and I don’t see the numbers you’re showing. Are you reading the graph? Is there another source for this information?

        1. I’m looking at this graph http://www.onsemi.com/pub_link/Collateral/NTLJF3117P-D.PDF Page 7, Figure 15. Typical Reverse Current

            • Marc Singer on May 2, 2015 at 12:44 am

            You threw me with ‘@4.2V’.

            I’m seeing 0.03v on Vbus with a 44K pull-down and a battery voltage of 4.175V. This makes the leakage 680nA and the equivalent resistance be 6.1MOhm.

            Your eyes are keener than mine.

    • Marc Singer on May 1, 2015 at 9:19 pm
    • Reply


    I’ve been trying to understand your comment about ‘sane gate voltage.’

    With Vbus, Vg is VBUS and Vs is VBUS – Vf of the diode. Vgs is going to be positive which will guarantee that the FET will be off.

    With no Vbus, Vg is going to be Vleak=Ir*R2 where Ir is the reverse leakage current through the diode and R2 is the Vbus pull-down. Vs is going to be close to Vbat depending on Rdson and the forward drop in the body diode, but the conductance of the fet is going to be much more efficient than the body diode drop once the fet is on. So, worst case Vgs is Vleak-(Vbat -Vf) which is going to be dominated by the battery voltage unless Vleak is really high.

    I think your comment is about making sure that Vleak isn’t so high that it competes with Vbat-Vf. So, when you say a target for Vg is 1V you are saying that you want it to be no more than 1V. Even at Vbat of 3V, Vgs will be at least -1.6V when Vg is 1V.

    IOW, the sane gate voltage is being evaluated when there is no Vbus. Yes?


    1. Yup, everything you wrote there is correct, although the Vleak calculation is a little off – example 10uA leak and 1M pull-down ends up at 10V.
      The ‘sane gate voltage’ is for when Vbus is removed and ‘target voltage’ would indeed mean ‘no more than’.

        • Marc Singer on May 2, 2015 at 12:56 am
        • Reply

        Sure. As the pulldown is weakened (value of R2 increased) then Vg approaches Vs and eventually the fet won’t turn on when Vbus is removed. I think that for the case where Vg < Vs, the calculation for for Vleak is a reasonable approximation.

    • itanium on May 13, 2015 at 12:02 pm
    • Reply

    Can I use AO3401 for Q1?

    1. Yeah, an AO3401 should work fine.

  8. Hi Zak,
    I used lithium-ion charging for the first time on my last project (DIY Game and Watch -> http://www.instructables.com/id/DIY-Game-Watch/). I didn’t have problems with load sharing as I designed the software to have an auto shutdown so it drew very little current (5uA) and could charge without any problems.
    On my new project I want my circuit to stay active and it will draw somewhere in the range of 6mA which will be enough to stop the charger from shutting down hence why I found your excellent description explaining how you deal with it.
    Now, I had come up with a much simpler idea but I wanted to run it buy you to see what you think.
    The USB supply is 5v and I would take this to the charging IC and to my circuit via a diode like you have, which will give me a voltage of around 4.3v to 4.4v. I would connect the charger to the battery as normal, but then from the battery I was going to have another diode going to my circuit which would give a voltage of around 3.5v to 3.6v (4.2v – diode drop) while the battery is charging.
    I was thinking that this would mean that the battery would not supply any current to my circuit as it’s voltage would be lower than the voltage coming from the USB (less the diode drop). Would this work or would I end up sharing the current between the USB and the battery?

    1. Nice looking project there 😀
      Yeah, your idea will work. The main purpose of the MOSFET in my design is to get rid of the diode voltage drop, there’s still a diode from battery to main circuit since it’s part of the MOSFET, but the diode is bypassed when the MOSFET turns on. You can also remove the pull-down resistor since that’s just to make sure the MOSFET turns on when USB power is removed.
      As long as the battery voltage minus diode drop is less than the USB voltage minus drop then no current will be drawn from the battery.

    • Andrew Hannay on May 25, 2015 at 4:55 pm
    • Reply

    Cheers. I simulated it online just to confirm it worked, which of course it did, it just seemed too simple 🙂

    • Frank on September 6, 2015 at 12:30 pm
    • Reply

    Hi Zak,

    Thanks for the awesome tutorial!
    I’d been playing with something similar but without succes and I now understand why it wasn’t working.

    I was wondering if you happen to know of any compatible through hole mosfets as an alternative to the DMP1045U-7?

    Any advice would be much appreciated!

    1. Through-hole P-Channel MOSFETs with a low enough Vgs seem to be quite hard to find, though these should be good for up to about 1A – FQPF27P06, SPP15P10PL, NDP6020P

        • Frank on September 20, 2015 at 3:14 am
        • Reply

        Thanks so much!
        Just ordered a FQPF27P06 for testing.

        • nico on November 21, 2016 at 7:06 pm
        • Reply

        In the datasheets


        I see that all mosfets you mentioned can handle > than 10A… Am I reading something incorrectly or why would you say “up to 1A”?

        1. Hey Nico, up to 1A because the Vgs can be as low as 2.4V (Vgs will be at whatever voltage the battery currently is), which is not enough for much more current without a significant voltage drop across the MOSFET. See the On-Region Characteristics and Output Characteristics graphs in the datasheets.

            • nico on November 24, 2016 at 6:01 pm

            Oh of course, you’ re right. Thanks for clarifying.

            Well, it would be too good to be true but, maybe introducing a regulator between the battery and the drain?
            The would also allow for a MOSFET with higher VGS, right?
            But would it interfere with other aspects of the design leading to breaking?

          1. Yeah you could add a boost regulator, but don’t boost the voltage too much (try to keep it at 4.2V) otherwise D1 won’t conduct when USB power is applied and you’ll end up drawing power from the battery while it’s trying to charge. See the first paragraph under the load sharing schematic and the paragraph about D1.

            • clovis on February 6, 2017 at 10:38 am

            why? From NDP6020P datasheet

            RDS(ON) Static Drain-Source On-Resistance V(GS) = -2.7 V, I(D) = -10A ====> 0.059Ohms Typ and 0.07Ohms Max
            RDS(ON) Static Drain-Source On-Resistance V(GS) = -2.5 V, I(D) = -10A ====>0.064Ohms Typ and 0.075Ohms Max

          2. Oh oops, you’re right about the NDP6020P, that should be able to handle 10A or so. I must have missed that link at the time o_o.

    • JCB on November 25, 2015 at 2:06 am
    • Reply

    can i to flip the mosfet(source conected to battery and dreno conected to load), and replace D1 with a 3,8V LDO regulator with reverse current protection…
    because i need the voltage of charge from 3,3 to 4.2V


    1. That won’t work. The orientation of the MOSFET is very important and shouldn’t change, you’ll end up damaging the battery if it’s wrong. Just stick the regulator on the output of the load sharing circuit.

        • JCB on November 25, 2015 at 8:25 pm
        • Reply

        But i have a problem.
        I need 3,8V on my load, and when battery is supplying the load the 3,8V LDO regulator don´t work.. The BUCK/BOOST regulator is very expensive to my project.
        Do You have a suggestion?

        thanks for your attention

        1. If you must have 3.8V then you will need a boost of some sort since the battery voltage can go down to around 3V. A buck/boost is kinda expensive as you say, so you could use just a boost to up the voltage to 4V or so then use a 3.8V linear regulator after the boost.

            • JCB on November 25, 2015 at 8:45 pm

            Thanks so much ZAK

            I will search for a nice boost and LDO

    • JCB on December 7, 2015 at 7:54 pm
    • Reply

    Hi Zak

    Can i insert a diode between pin 4 of MCP and the mosfet gate?
    I want to reduce the voltage on load when the supply is conected.

    thanks for your attention

    1. It would be best to swap out D1 with a diode with the voltage drop you want (or multiple diodes in series if 1 isn’t enough). Make sure the total voltage drop doesn’t go above 1.15V, see the section about D1 on working out the max drop.

    • chris on January 17, 2016 at 5:35 pm
    • Reply

    I’m a beginner, so my question might be a bit odd 😉
    Can I use an other DMP1045U instead of the D1 diode? Drain connected to VIN, Source to VCC and Gate as well to VIN.
    To avoid the voltage drop of the diode and at the same time, make sure no (only minimal) current flow to the USB input in case it is running on battery?

    1. Nah, I see what you’re trying to do, but it won’t work in this case 😛
      Vgs needs to be less than about -1.2V to turn on, but with USB connected it will be 5V – 4.2V = 0.8V, meaning it will be off. And then when USB is removed it’ll turn on because 0V – 4.2V = -4.2V!

    • Gokku on February 2, 2016 at 11:13 am
    • Reply

    Hey Zak,

    thanks a lot you tutorial and answers are awesome.
    I want to use the shematic for powering a Raspberry Pi. So I need 5.2 Volts at the output and I will need arround 2A because I have a touch panel. So my question is when I use a USB adapter everything is fine because Raspi gets the supply via the wall adapter. But whe I plug off the suplly Raspi gets suplly from Battery and only 4,2V right? So I need a booster no? is there any booster which can handle 2A (or little more) and still gives out 5.2V?

    1. Yeah, you’ll need a boost regulator for the battery since it outputs 3V-4.2V. You could try this one – http://www.aliexpress.com/item/J35-Free-Shipping-DC-DC-Boost-Converter-3V-Up-5V-to-9V-2A-USB-Output-Voltage/32338265996.html It’s adjustable so be sure to measure the output voltage before connecting it to the Pi.

        • Gokku on February 9, 2016 at 10:18 am
        • Reply

        ok thanks a lot. i have ordered one of these: adafruit powerboost 1000 basic
        which should also work.

        I ordered the same Mosfet which you use in your shematic and the MCP73831. Now I bulded up the shematic….but it doesnt work.

        How can I measure the Mosfet? without any supply it should be “open” between gate and source/drain and “closed” between drain and source no? or cant I measure without any supply?

        Can I add my EAGLE files somewhere?

        Thanks a lot again.

        1. Put your multimeter into voltage mode. When the battery is attached and USB is disconnected the MOSFET should be closed/have low voltage drop (less than 0.1V) across the source and drain and open/larger voltage drop (more than 0.5V) when USB is connected.
          Google “file host” and upload the EAGLE files to one the websites.

    • Diya Dinakaran on April 2, 2016 at 3:37 pm
    • Reply

    Please clarify; whether the wiring of Q1 (as per the component symbol) is right or wrong ?

    1. All diagrams and symbols in the post are correct.

    • nico on April 23, 2016 at 7:37 am
    • Reply

    Hi zack,
    Thanks for your info about the “load sharing circuit”.
    I’m also going to build the circuit. I have just one question about the D1 diode.
    I have to set the voltage for the load to 4.2V max during the normal operation (when the main
    power supply at 5V is connected) since my load works from 3.4 to 4.2.
    I see you use the B130law and ,reading the datsheet , it gives me 0.38V of forwad voltage.
    This gives me 5v-0.38 =4.62V which would burn my load.
    I dont want to use any step down/up conversion since my load works perfectly between 3.4 to 4.2 V (lipo at 3.7V will power it when main DC power fails)
    Could you please suggest wich diode I can use or maybe add to the circuit ?
    The current of the load is 1A max.

    1. You could put multiple diodes in series, but you also need to make sure there isn’t too much drop otherwise the internal MOSFET diode will begin to conduct preventing the battery from fully charging. You should also measure the voltage drop at the loads minimum current, as the drop goes down as the current goes down, at 10mA the drop will be about 0.17V.
      An easy, but not very efficient way that could work would be to use a zener regulator/clamp just before D1.

    • nico on April 28, 2016 at 8:13 am
    • Reply

    Ok ZaK,
    Thanks for reply. I thing I should put a DC-DC boost converter and I found one from Linear Technology (LT3759).

    About the kind of battery to charge : I’m going to charge a Lipo 2200mAh since I want about 1A in both case (load under Main power or battery ). Do you think there’s a limitation with this circuit?
    thanks a lot again

    1. This load sharing with the LT3759 should be fine with 1A, though maybe swap D1 for a diode with slightly higher current rating otherwise you’ll be pushing it to its max.

    • Neo on August 5, 2016 at 11:23 am
    • Reply

    Hi Zak,

    Thanks for the nice blog. I have one question, is it safe to connect STAT directly to the MCU I/O pin? Should there be a resistor in between to prevent from possible over current? Especially the high state of MCP73831 is 5V.



    1. Hey Neo, the MCP73832 (two) either pulls the STAT pin LOW or leaves it floating, it doesn’t get connected to the 5V supply rail. Connecting the MCP73832 STAT pin directly to an I/O pin is safe. MCP73831 (one) STAT will need some level conversion, a single current limiting resistor is not the best idea as it will still try to pull the MCU 3.3V rail up to 5V, a voltage divider or transistor would be better.

  9. Hi,
    I have one question, see if you can help me

    I would like to use this circuit in a Arduino Project that uses a 3.3V microcontroller that I will build standalone.

    It’s necessary in the end of the circuit to build a Voltage Regulator? Or I can connect directlly in my microcontroller.?

    Thanks Diogo

    1. Hey Diogo, you will need a regulator as the charging circuit can output 5V when charging or up to 4.2V when running from the battery.

    • Lucas on September 5, 2016 at 9:45 pm
    • Reply

    What happens when you are out of USB power, and the battery voltage gets too low?
    This circuit has cut down voltage?

    1. No, there is no undervoltage protection in this circuit, the battery should have that built-in to it.

    • Boyd Roberts on September 25, 2016 at 7:46 am
    • Reply


    Can this c code be modified to upload to Arduino? If not, how do I get the c code onto the chip?

    The are many AC varieties on the microchip website. Which one is recommended? Thanks.

    Everything else should be a piece of cake!


    1. Hey Boyd, yea the code be modified to run on Arduino, you will need to change the PORT write stuff to digitalWrite(), PIN read stuff to digitalRead(), printf to Serial.Print() etc…

      Which AC variant to use will depend on what IC package you want and the charge voltage of the battery (4.2V – 4.5V). You probably want the SOT-23 package and charge voltage of 4.2V, so that’s the MCP73832T-2ACI/OT.

    • danny on October 19, 2016 at 11:06 pm
    • Reply

    Hi Zak

    I have the mcp73831en a circuit for making environmental parameters, but a sound is perceived when charged using the solar cell.

    help me please

    1. This Lithium charger is only designed for a steady 5V supply, which a solar cell won’t be able to provide. You’ll have to come up with some completely different circuit.

    • bharath hs on February 14, 2017 at 2:15 pm
    • Reply

    hello zak,

    could you please tell me if the irlml6401 mosfet works for this circuit. also with the same load sharing components can i use some other Charging IC other than MCP7381, like TP4056 IC??

    1. Heya, IRLML6401 and TP4056 should work fine.

    • Anuj on March 19, 2017 at 9:41 pm
    • Reply

    Hi , Zak

    It’s a great article.

    I didn’t understand the calculation of the R2. The Diode you have chosen is D130LAW which has a leakage of 1mA and can be increased with increase in temperature. However I am going to use this http://www.farnell.com/datasheets/1916075.pdf?_ga=1.255267275.251839788.1488841003

    It has leakage current of 0.2uA @ Vr = 10v.

    How to calculate the R1 at this small current? My Load current is 100mA (Max).

    The transistor should turn ON, even at 4.2 and at 3.2V as well. How to calculate the values? I am using the same MOSFET which you used DMP1045.

    1. That diode has a leakage of around 60nA @ 4.2V, which is an effective resistance of (4.2 / 0.00000006) = 70MΩ. To have a gate voltage of 0.4V when USB is unplugged the maximum resistance of R2 is 0.4 * 70,000,000 / (4.2 – 0.4) = 7.4MΩ. However, 7.4M is really high which will cause other problems, 100K for R2 will be fine.

    • Srikanth on April 27, 2017 at 7:16 am
    • Reply

    Hi Zak ! Thank you were much for your informative and useful article. I am using this design for a LiPo powered wireless sensor network and need to ensure very low power consumption. I have teh following questions :
    1. A major issue would be the reverse leakage of D1 which will require a 100 K or even lower R2 for ensuring Q1 turn on. I have a large stock of IN5819 but they have a large leakage of 1mA so i’ll need a very small resistor say 10 K. That would leak around 330uA of power when my circuit is battery powered.My question is – why not use a IN4001 instead of a schottky diode which has a leak of <30uA. The forward voltage drop is max 1.1 V (at high currents ) and 0.7 V typically at lower currents and that is within the acceptable 1.15 V max drop as per your calculations.

    2. I am not sure I understand the following statement "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." How can you use 100 K when calcs ask for max 6.56K

    3. I will need the MCU to measure LiPO voltage and have a 3.3V LDO after the mosfet. Will the Q4 & Q3 circuit in the MCU loadshare you have described cause a current drain when standing by PD7 is low if I turn off the internal pull up. It appears not.

    4. Finally If I use a IN4001 for D1 and use just a shottky diode instead of Q1, I will lose a usable battery life of around 0.3 V but can use a 3V LDO instead of 3.3V as my circuit can work on 3V forward. Would that be a good idea ?

    Thanks once again


    1. Hey Srikanth,

      Hmm, yeah I’d think a 1N4001 will work fine. I used a schottky mainly because the app note used one to reduce power losses.

      The 100K limit is if you were to use a very low leakage diode, where the calculated resistor value comes to over 100K. Using a resistor that’s too high of a value will cause the MOSFET to turn back on too slowly, and can cause issues with the gate picking up a charge and not being able to get rid of it quickly enough, making the MOSFET turn off even when USB is not plugged in.

      Q3/4 will not draw any current when the Q4 input is LOW. PD7 should be configured as an output HIGH/LOW and no pullup.

      Yeah, you can use another diode instead of the MOSFET and resistor, then whichever power source has the higher voltage will be the one used to power the circuit.

  10. Hello Zak,

    Can you please confirm the charge circuit with load sharing is correct, I think you have D and S swapped of Q1. The mosfet in current configuration will act as a diode, isn’t it?

    Let me know your thoughts


    1. Hey Hemal, The MOSFET orientation is correct. The diode will not conduct if the voltage at the drain (battery side) is lower then the voltage at the source (circuit side). If VUSB is applied to Q1 gate and (VUSB voltage – D1 Vf drop) is higher than (Vbat – Q1 Vf diode drop) then the diode will not conduct. Vusb would have to go down to around 4V before anything starts to happen.

      When VUSB is removed the MOSFET will turn on and the diode is bypassed.

      1. Ah, I see it now. You are right.
        Thanks for clarification

    • Ta Mak on July 24, 2017 at 12:06 pm
    • Reply

    Hi Zak ,

    This article is really helpful . So thanks a lot .

    I’m intend to use the “load sharing circuit ” to my system . My circuit would draw about 4.5 A . So I’m planning to use Q1 P – Mosfet “NDP6020P ” and where the circuit has a big value of current to be drawn I intend to use a diode that has the ability to draw similar current so I choose ” VS-30EPH06PbF ” – this is the data sheet http://www.vishay.com/docs/94018/vs-30eph06p.pdf” where it is the available in my area .

    I’ve reviewed the Vsd of “NDP6020P ” which is between 1.1 and 1.3 , while Vf of the diode is about : 1.34 . So the (Vsource – D1 VF) is above (Vbat – Q1 VSD) .

    I have to mention that the source I’m using is 5v power supplier instead of using USB because of the current limit required.

    So I hope to get your advise about my assumptions .
    Do using these chips would be compatible ?
    I’m also thinking about not using C3 , Is it harmful ?
    What about the values of R2 ?

    Thanks a lot

    1. Hey Ta, your MOSFET and diode component choice is great, no issues with using those.
      C3 can be removed without a problem.
      Since the reverse leakage of the diode is very low R2 can be anywhere from 1K to 100K, I would go for 10K.

    • Olf on September 12, 2017 at 11:52 pm
    • Reply

    Hi Zak,

    thanks for the great article. Possible dumb question: You write “You should make sure that your charging power source can supply enough current to charge the battery as well as power the circuit.”.
    My load regularly draws more current than the charging source can provide (ca. 2A dynamic load vs 900mA charger, I have a voltage regulator connected between the load sharing circuit and the load), so the load operation pauses for regular charging periods.

    However, during operation I want the circuit to do the following:
    The 900mA supply is connected most of the time, so the load should draw power from the battery AND the supply simultaneously to decrease battery discharge, until the load is deactivated for a charging period, or the supply switches off (full load draws from battery).

    Is this possible with your circuit? It looks like Q1 just shuts down the battery connection when the supply is connected, and when the load draws more than 900mA, the supply voltage drop opens Q1 again (Maybe not too healthy for the supply though).

    I think I could do the simultaneous load sharing with the MCP73871 directly, but I want to avoid hand-soldering a QFN package, also its max current is too low for me…

    Thanks 🙂


    1. Hey Olf, drawing power from 2 different voltage sources at the same time can be quite tricky (http://www.ti.com/lit/an/slva250/slva250.pdf though that’s with 2 of the same voltage). If you know when the large current draws are going to happen then you could code the microcontroller to shut off the charging power source (P-MOSFET on the 5V input) so the circuit switches to the battery, then once it’s finished reconnect the charger.

    • Florian on November 2, 2017 at 9:15 am
    • Reply

    Hey Zak, nice work! But one Question left: Is there a mistake with the MOSFET Q1 in every Picture? I think because of the bypass diode of the MOSFET a current will flow to the Load in each case. With or without 5V-USB plugged in… I think the MOSFET has to be inserted left pin to the right and the right pin to the left (gate stays where it is).

    Hope you can answer my question.

    Many Thanks

    1. Hey Florian, the MOSFET orientation in the schematics is correct. As long as the source voltage (load side, will be at around 5V with USB) is higher than the drain voltage (battery side, max 4.2V) then no current will flow. If the MOSFET is flipped then USB power will flow straight into the battery through all the diodes, bypassing the charging IC and over-charge the battery at an uncontrolled rate (fire will be a likely outcome).

    • Stefan on November 4, 2017 at 9:42 pm
    • Reply

    Hey Zak,

    Great article! I have implemented the circuit as you suggested, and it seems to be working fine. However, I noticed somewhat strange behavior.

    In my implementation Vin is directly connected to a USB Mini B connector, which in turn is connected via USB cable to a smartphone battery charger. All the values presented below are obtained with load disconnected. When the battery is not connected, Vin is 5.05V, while Vbat (on MCP73831) is 4.3V. As soon as I attach an empty battery (~3000mAh 18650 LiIon), Vin drops to ~4.2V and Vbat to ~3.5V. While Vbat is slowly increasing over time, Vin stays at ~4.2V. At times, Vin goes to ~4.7V while Vbat goes to ~4.5V, then they go back to previous values. I understand that Vbat is affected by the charging cycle, but I could not figure out why would Vin (USB Vbus) be any different from 5V… Any thoughts?

    Thanks in advance.

    1. If Vin is dropping then that would either mean the power source can’t provide enough current or the cable you’re using can’t handle the current, causing the voltage to drop a little. Try a few different cables, the shorter the better.

  11. Hi,

    I am new to all this, so I am probably wrong, so:

    I want to replace D1 with another p-channel mosfet – call it Q2. Connect drain to Vin, gate to ground and source to VCC.

    If there is no battery, source will be zero, gate will be zero, Vin will be positive, the body diode will conduct and eventually Q2 will turn on.

    If there is a battery and vin is disconnected Q1 will start to conduct, Q2 will turn on, but it doesn’t matter – it still isn’t leaking current backwards.

    If there is a battery and Vin is connected, Q1 will be off, the body diode in Q2 will conduct and eventually it will turn on.

    Would this work?

    1. Hmm, no I don’t think that will work. When there is a battery connected and VIN is disconnected Q2 will be on allowing current to flow through R2, wasting battery power. Q1 will have a voltage at it’s gate, likely turning it off so all current will be flowing though the body diode. It also means the USB connector will be powered, which will back-power an unpowered USB device if connected, possibly damaging it or just shortening battery life even more.

  1. […] battery charging circuit uses a Microchip MCP73832 along with some additional components for load sharing, where the battery can charge without the rest of the watch interfering with […]

  2. […] Power supply: Adafruit PowerBoost 500C with 2500mAh LiPo battery and load sharing circuit. […]

Leave a Reply to Zak Kemble Cancel reply

Your email address will not be published.

Are you human? *