Author Topic: USB + LiPo to 3.3V - Schematic help?  (Read 2369 times)

0 Members and 1 Guest are viewing this topic.

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
USB + LiPo to 3.3V - Schematic help?
« on: February 13, 2020, 02:11:27 am »
I like to power my microcontroller projects from USB powerbanks, but increasingly find myself wanting something a bit more efficient, maybe using LiPo batteries, and using an LDO to drop to 3.3V volts seems wasteful.

Edited: now at version 2.

As Peabody mentions below, my first schematic using MCP73831 would charge a LiPo, but would not be powered by one.  Therefore, here is the edited schematic:

It is in public domain, and obviously Open Hardware, but I am such an uncle bumblefuck, I could use some more help with this. :-[
The project is hosted at EasyEda.

The buck-boost converter is based on TI Webench design report, which indicates this should be about 90% efficient at typical 100mA - 600mA project loads.
The LiPo charger circuit is based on MCP73837, and basically straight off its datasheet.

Charging current I = 1000 [V] / R7 [Ohm], with 1 kOhm ≤ R7 ≤ 20 kOhm.  With R7 = 47 kOhm, I is about 0.213 [A] ≃ 210 mA.
R8 sets the minimum charging current the same way, except 5 kOhm ≤ R8 ≤ 100 kOhm.

My idea is to make this into a small module, that anyone could make/build/sell, for powering 3.3V microcontroller projects from LiPo cells.  I am not going to sell anything, but I haven't seen this kind of a module yet, and it'd really solve my needs with 3.3V logic projects.
I do intend to design the board, too, and the components should be easy to source from LCSC/Mouser/Digikey, so that anyone could make these modules if they want.
« Last Edit: February 13, 2020, 10:49:23 am by Nominal Animal »
 

Online beanflying

  • Super Contributor
  • ***
  • Posts: 7361
  • Country: au
  • Toys so very many Toys.
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #1 on: February 13, 2020, 02:20:55 am »
Take a look at these existing holder/supplies too might be some ideas to be gained https://www.aliexpress.com/item/32870411748.html?spm=a2g0s.9042311.0.0.27424c4dtKDbx4

Coffee, Food, R/C and electronics nerd in no particular order. Also CNC wannabe, 3D printer and Laser Cutter Junkie and just don't mention my TEA addiction....
 
The following users thanked this post: Nominal Animal

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2008
  • Country: us
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #2 on: February 13, 2020, 05:58:11 am »
I don't understand your circuit.  You have USB directly powering the charger and the regulator, but how does the battery power the regulator when USB isn't plugged in?

It's possible the MCP73871 would be a better choice if you want to charge the battery and power the device at the same time.  It has a "load sharing" circuit built in.



 
The following users thanked this post: Nominal Animal

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #3 on: February 13, 2020, 07:21:44 am »
I don't understand your circuit.  You have USB directly powering the charger and the regulator, but how does the battery power the regulator when USB isn't plugged in?

It's possible the MCP73871 would be a better choice if you want to charge the battery and power the device at the same time.  It has a "load sharing" circuit built in.
Ah, now I understand.  According to its datasheet, MPC73871 is stable without a battery load, so it can essentially act as a "switch" between USB and a LiPo, like I want to.

In the various LiPo charger circuits, what I missed, is that the battery (and not the battery charger chip like in my schematic) is parallel with the load; undervoltage protection et cetera between the battery and the load.
 

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #4 on: February 13, 2020, 10:48:37 am »
Indeed, the MCP73871 should work much better, and the datasheet seems straightforward enough for even I to implement.  :)
Thanks, Peabody!

I replaced the schematic in the first post with version 2, with MCP73871.

Any suggestions? Recommendations? Criticisms?
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2008
  • Country: us
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #5 on: February 13, 2020, 04:57:09 pm »
First, it's generally better to include revised attachments in later posts so the responses to the original first post will still make sense to people seeing them later.

As to your circuit, the load sharing function included in the MCP73871 is described in more detail in Microchip's application note:

http://ww1.microchip.com/downloads/en/AppNotes/01149c.pdf

But the basic idea is that without such a circuit the charger is providing power to both the load and the battery, and may not be able to detect that the battery has been fully charged, and fire may result.  The load sharing circuit lets USB power both functions independently so charging may continue to proper termination even though the load is still drawing current.

The module in the Andreas Spiess video does not have load sharing, which is why he concludes that "charging and discharging at the same time", as he calls it, can only take place at low load currents (i.e. - at currents less than the charging shutoff current).  Maybe someday the module makers in the Far East will switch over to including load sharing in their charger modules.

Your decision to use a switching regulator may not be the most efficient if the load current is small.  That's because switching regulators are typically not very efficient at very low currents.  Also, you aren't really dropping all that much voltage to get from a maximum of 4.2V down to 3.3V, so a linear LDO might work fairly well.  Again, it depends on how much current you want to provide for.

I do need to raise the question of your Q1 and Q2 mosfets.  The only purpose I can see that they provide is reverse polarity protection.  But that's not really a risk with microUSB, and certianly not coming out of the regulator.  So I don't think you need them.  You may want to include some protection at the USB port, but that would be some kind of transorb device, not a mosfet.


 
The following users thanked this post: Nominal Animal

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #6 on: February 13, 2020, 10:23:42 pm »
But the basic idea is that without such a circuit the charger is providing power to both the load and the battery, and may not be able to detect that the battery has been fully charged, and fire may result.  The load sharing circuit lets USB power both functions independently so charging may continue to proper termination even though the load is still drawing current.
According to the datasheet, MCP73871 has a different "Y" topology: IN+VPCC, OUT, VBAT.  I thought this would eliminate that problem?  Then again, that appnote does explicitly name MCP73871, but uses a different circuit to MCP73871 datasheet.  :-//

There are four situations I wanted the circuit to handle:
  • Powering via USB without a battery present at all
  • Powering via USB with a fully-charged battery present
  • Powering via USB and charging the battery at the same time
  • Running on battery power
In the first two cases, VBAT is completely disconnected.  In the third case, the current to the battery is monitored, as is battery voltage and the thermistor.
In the fourth case, the battery voltage is monitored for undervoltage lockout.  I am pretty sure I could do this with lots of jellybean parts; the voltage references (precise 4.2V for the maximum and something slightly above 3.0V for the undervoltage lockout) would be the hard part.

Is there really no single-chip solution for this?

It really looks like I'm better off with just two parallel inputs (separated from each other, so one does not power the other, only the circuit), so that users can plug in another power pack when the other is going out, and charge using a proper charger out-of-circuit.  That's not optimal, but if there really is no single-chip solutions, that works better for me than trying to work out the weirdnesses of charge controllers.

Your decision to use a switching regulator may not be the most efficient if the load current is small.
I am targeting 100mA to 600mA practical load range, with 800mA-1000mA peak or hard limit.  A microcontroller with a display, basically.  At this current range, the design report from TI Webench claims 90%-94% efficiency depending on the voltage.

I also want it to be able to be powered from USB directly.  In that case, the power loss isn't a problem, but turning it to heat in the LDO is.  A typical wall wart provides about 5.2V, so at 500mA the LDO is dropping almost two volts, becoming an one-watt heater.  In a small, especially small plastic enclosure, that starts pushing things.  The microcontrollers I use typically only consume 20mA-100mA (so third of a watt or so), and most of the rest is a display module -- but those display modules have the surface area to convect and radiate the heat away.  The LDO, not so easy.

I do need to raise the question of your Q1 and Q2 mosfets.  The only purpose I can see that they provide is reverse polarity protection.  But that's not really a risk with microUSB, and certianly not coming out of the regulator.  So I don't think you need them.
Q1 is there only if pads instead of an USB connector are used for powering.  In particular, it is often easier/better for these hobby projects to cannibalize an USB cable, and solder the wires directly (although I tend to do that only when the device is tethered).
Q2 is there to protect this circuit from being backfed by whatever it is supposed to power.

Your points and criticisms are well appreciated, Peabody.  I wonder if I am better off with a dual 5V USB power interface without charging circuitry, or if I should try to design a "triangle" circuit to do this properly:


Essentially, whenever there is 4.5V or higher potential at USB input, LiPo is disconnected from the load.  LiPo is also disconnected from the load if the voltage across it drops below 3.3V.  So these would basically be two MOSFETs there.  The LiPo is either disconnected (from load, and no USB present), connected to the charger only, or connected to the load only.
If connected to the load, LiPo uses a LDO to 3.3V (okay to drop to 3V at the low end).  When USB is connected, the LiPo is only connected to USB via a charger, and USB provides the power to the load via a buck converter.  (Any buck regulator with better than 66% efficiency will generate less heat than a linear regulator, as the input is 5V and output 3.3V nominal here.  Something around 90% efficiency at 100-500mA, with peak current capability around 800-1000mA, would be optimal.  It's somewhat more about generating minimal waste heat -- so that this can be used in small plastic enclosures --, than about being as efficient as possible.)

To me, this seems a fairly straightforward problem, and one that would be very common with USB-powered gadgets.
« Last Edit: February 13, 2020, 10:38:17 pm by Nominal Animal »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2008
  • Country: us
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #7 on: February 14, 2020, 04:23:26 am »
I believe the MCP73871 will handle all four of the items on your list.  That's exactly what the load sharing circuit is for, and it has that circuit.  I don't know what in the datasheet makes you uncertain about that.  It seems to me the circuit in the datasheet should work fine.  The Functional Block Diagram shows that the OUT pin, which powers the load, can be sourced from the IN pin or from the battery.  The "ideal diode" mosfet is the equivalent of the mosfet shown in the app note, and it isolates the battery when USB is plugged in.

The app note covers an external load sharing circuit for chargers which don't have it built in, such as the 73837 described there, or the 73831.  It doesn't mention the 73871, which already includes the load sharing circuit.

 
The following users thanked this post: Nominal Animal

Offline JackJones

  • Regular Contributor
  • *
  • Posts: 229
  • Country: fi
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #8 on: February 14, 2020, 04:53:33 am »
MCP73871 does indeed work, it's my go to charger IC. And I do agree with the polarity protection, I wouldn't really consider them needed here.

One thing you should add though is battery protection, even if you plan on using protected cells. What I usually use is LC05111CMT mostly because it has integrated MOSFETs. The package is a bit annoying though I have to admit. Or you could go with the bog standard DW01 chip + 8205A MOSFETs which seems to be found in practically every product.

https://www.onsemi.com/pub/Collateral/LC05111CMT-D.PDF
 
The following users thanked this post: Nominal Animal

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #9 on: February 14, 2020, 05:32:10 am »
I don't know what in the datasheet makes you uncertain about that.
Because I am an idiot, and thought the appnote referred to 73871 (which I use in version 2), but it refers to 73837 which does not have the load sharing internal circuitry.  Just read '37 as '71 when looking at the appnote, really.  Thanks for clearing it up, though!

One thing you should add though is battery protection, even if you plan on using protected cells. What I usually use is LC05111CMT mostly because it has integrated MOSFETs. The package is a bit annoying though I have to admit. Or you could go with the bog standard DW01 chip + 8205A MOSFETs which seems to be found in practically every product.
Right, thanks.

I am convinced, and removed Q1 from the input.  I do intend to keep Q2 on the output, as there are situations where the 3.3V rail might be powered from elsewhere, and I don't want to get burned by that again; kind-of case 5 in my earlier post.  For 0.37€ at Mouser in singles, I want it.



I did look into how complicated the discrete circuit would be, if one wanted to use a LDO from the battery, a buck/step-down converter from USB, and the necessary load sharing and protection between the two.  Among others, I considered an LD39150 LDO with NCP300 undervoltage detector connected to the inhibit pin, so that under the NCP300 voltage, the current draw on the depleted battery would be on the order of 2µA.

There is nothing theoretically difficult here, but a lot of practical design issues that really need an experienced EE to make this kind of circuit right.

However, the TPS63070 design report indicates at least 82% efficiency at zero load from 3.0V to 3.3V, and at 100mA-600mA load, between 89% and 93%.  This means, roughly, that if the LiPo voltage is 3.7V or higher, and the current draw is at least 100mA, then the switcher is more efficient.  Otherwise, the LDO is more efficient.  I don't see the added complexity (compared to the circuit with MCP73871 charger and TPS63070 buck converter) and BOM is worth it.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2008
  • Country: us
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #10 on: February 14, 2020, 05:54:59 am »
The load sharing circuit, if not included in the charger, consists of a mosfet, a diode and a resistor.  So it's not all that big a parts burden if you need to add it to a circuit.  But with the 73871, it's already there.

On the battery protection issue, I guess I would just use protected batteries and not bother to duplicate the protection.  But that's just me.

I still don't understand how the output mosfet gives protection against anything but polarity reversal.  If the gate resistor is connected to ground, the mosfet is going to be on, and it will pass current equally well in either direction, and isn't going to block anything.  To turn it off, the gate would have to be equal to or above the source voltage.  That's why it protects against polarity reversal.

 
The following users thanked this post: Nominal Animal

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #11 on: February 14, 2020, 08:07:19 am »
I still don't understand how the output mosfet gives protection against anything but polarity reversal.
Oops, right again.  I need to add a pair of PNP transistors (say, a DMMT5401 as used on R'Pi's), to complete it into an ideal diode:


 

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #12 on: February 14, 2020, 11:01:52 am »
And I now discovered TI TPS82084, which is 90% efficient at loads between 1mA and 10mA, and 93%+ efficient at loads between 10mA and 1800mA, converting from 4.5V-5.7V to 3.3V, and is CISPR 11 class B compliant, according to TI Webench and its datasheet.  Total BOM cost from Mouser, in singles, is 4.04€.  It is also available at LCSC.

The only problem is that it is an 8-pin microSIP (µSIL, 2.8mm × 3.0mm) package, that kinda requires a reflow oven to solder.

It is supposed to be able to accept input from Vout up, but I am not sure about the efficiency there.  In any case, here is the schematic (based on the TPS82084 datasheet and TI Webench; only one of the resistors differs), with optional backfeed protection (in case the 3.3V is externally powered).
« Last Edit: February 14, 2020, 01:29:47 pm by Nominal Animal »
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #13 on: February 14, 2020, 02:24:42 pm »
 :popcorn:  :)
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2008
  • Country: us
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #14 on: February 14, 2020, 04:55:04 pm »
I still don't understand how the output mosfet gives protection against anything but polarity reversal.
Oops, right again.  I need to add a pair of PNP transistors (say, a DMMT5401 as used on R'Pi's), to complete it into an ideal diode:

Can you explain the function of the DMMT5401 here, or point me to an explanation?
 

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #15 on: February 14, 2020, 05:04:53 pm »
See Ideal diode based on DMG2305UX + DMMT5401.  It is used on some Raspberry Pi models and Hats.
 

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #16 on: February 15, 2020, 11:34:45 am »
Madness continues, now based on MCP73871 and TPS82084 (1.61€ and 2.45€ in singles at Mouser as of 2020-02-15):


This should be surprisingly efficient compared to an LDO; at a 3W load, only about 0.2W should be wasted as heat (94%+ efficient).  Even at small loads like 10mA, this should be 90%+ efficient.  This should allow this to be used in plastic enclosures, like handheld gadgets.  Of course, the chips are tricky to solder for a bumblespork hobbyist such as myself.  :-\

(This also means that a 710mA load at 3.3V only draws 500mA from the 5V input, if there is no battery, or the battery is full. Nice.)

The reverse polarity protection is gone.  I can trivially add it (the ideal diode configuration mentioned above) to the circuits that need it, no need to push it on everyone.

The TPS82084 enable pin (EN) could be connected to OUT using a 100k:47k voltage divider; then, at 3.2V, the voltage at EN pin would drop below 1V, and the converter would shut down, with smaller than 5µA quiescent current into VIN.  This would act as the secondary battery undervoltage cutoff; the MCP73871 already has an undervoltage lockout.  Should I do that?
« Last Edit: February 15, 2020, 11:47:14 am by Nominal Animal »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2008
  • Country: us
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #17 on: February 15, 2020, 03:28:32 pm »

The TPS82084 enable pin (EN) could be connected to OUT using a 100k:47k voltage divider; then, at 3.2V, the voltage at EN pin would drop below 1V, and the converter would shut down, with smaller than 5µA quiescent current into VIN.  This would act as the secondary battery undervoltage cutoff; the MCP73871 already has an undervoltage lockout.  Should I do that?

It's also highly likely that the battery will have protection built in.  So it doesn't seem that a third undervoltage test would be needed.
 

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #18 on: February 16, 2020, 01:46:35 am »
It's also highly likely that the battery will have protection built in.  So it doesn't seem that a third undervoltage test would be needed.
Agreed.

I checked a few local sources (RC hobby stores, component shops), and all the flat 1S LiPos do have protection built in.  There are 18650 and similar cells for battery pack builders, but they're clearly marked as having no protection, so I think a note in the project documentation suffices.
 

Online beanflying

  • Super Contributor
  • ***
  • Posts: 7361
  • Country: au
  • Toys so very many Toys.
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #19 on: February 16, 2020, 06:55:03 am »
With Lipos in particular R/C ones we never ever run built on protection circuitry regardless of size so the bulk of loose flat cells not designed for equipment won't have any fitted.  Reason we don't run BMS is we would fry them in all but the smallest aircraft  >:D

18650's are a different animal with a chunk of them having BMS but a chunk not. Last time I went to a specialist retailer locally none of their cells had BMS fitted. Similarly I did a strip down on some locally sourced powerbanks to take out the 18650's and not only was their no BMS there was also no dedicated charger IC. Wonder why we get LiPo fires  :palm:

So if you are not fitting it put your note in a box and use RED type for the dummies  ;)

Or as an alternate leave it unpopulated on your board use a link to bypass or populate it?

Keep at it  :-+
Coffee, Food, R/C and electronics nerd in no particular order. Also CNC wannabe, 3D printer and Laser Cutter Junkie and just don't mention my TEA addiction....
 
The following users thanked this post: Nominal Animal

Offline Nominal AnimalTopic starter

  • Super Contributor
  • ***
  • Posts: 6265
  • Country: fi
    • My home page and email address
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #20 on: March 03, 2020, 01:56:12 am »
In an effort to keep the failure points to a minimum, I've managed to whip up a tiny cheap (<3€ in parts) board with just the USB-to-3.2V conversion.  It should be extremely efficient even at small currents, and be able to work down to 3.2V or so -- so basically from USB or from a single-cell LiPo battery.

It is also just 31mm by 11mm; tiny, even with the 2mm mounting holes (to be used with 2mm nylon standoffs).

It is not exactly the same layout as in the datasheet, and I am not at all sure how well this works in practice, and whether it spouts EMF everywhere or not.  I'm hoping to get a couple of boards made, and use an oscilloscope a friend has to check for noise. Maybe try some crude measurements with a wire loop sort-of-antenna.  According to the datasheet, the inductor inside the TPS82084 should be shielded.

Any suggestions, comments, or criticism on the board layout are welcome!  The schematic is literally from the TPS82084 datasheet, except with a 301k:100k resistor divider to get 3.2V output (instead of 200k:160k to get 1.2V); resistor divider obtained via TI Webench Power Designer.

(This board is also in Public Domain, in case someone wants to use it too.  Unlikely, but the idea matters to me :).)
« Last Edit: March 03, 2020, 02:00:12 am by Nominal Animal »
 

Offline aeberbach

  • Regular Contributor
  • *
  • Posts: 191
  • Country: au
Re: USB + LiPo to 3.3V - Schematic help?
« Reply #21 on: March 04, 2020, 05:11:55 am »
I'm following this with interest as I want to use a single 18650 to power a NRF52810, using all those nice GPIOs to decode a keyboard matrix to become a bluetooth keyboard. It will have a USB connection for charging only.
Software guy studying B.Eng.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf