Page 1 of 1

LiPo powering and charging

Posted: Sat Nov 02, 2019 6:44 pm
by kesterlester
I have a few pyboards. I am mostly interested in advice relevant to LiPo powering of the PYBLITEv1.0 (since that is the board I have built into a project) however most of the posts on this forum relate to powering either the PYBV1.0 and the PYBV1.1 which were subtly different in their use of the VBAT pin.

My understanding (correct me if I am wrong) is that those three boards differed as follows:
  • PYBV1.0:
    • The VBAT "label" (on the schematic) existed for RTC backup trickle powering only.
    • Physically VBAT was brought out of the board on a pin one row inward of X22.
    • No label or pin was called VBACK, VBACKUP.
  • PYBLITE1.0 and PYBV1.1:
    • The VBAT "label" (on the schematic) was re-assigned to serve as the label for the rail on which full-board power input from a LiPo would come. FETs were added to protect LiPo from over-charging by VBUS
    • Physically VBAT was brought out on a new pin two rows inward of X23.
    • A new schematic label "VBACKUP" was created (sometimes also called VBACK on labelled images of the board) to cover the RTC backup trickle powering role previously done by VBAT.
    • Physicsally VBACKUP was brought out on a pin one row inward of X22 -- i.e. in the same location as VBAT had previously emerged. This means that though the *name* of this pin had changed from VBAT to VBACKUP, its physical role had remained the same: RTC powering.
It is very clear to me that the PYBLITE1.0 and PYBV1.1 design intends to allow a LiPo to be able to power the board and not be damaged by VBUS.

What is very much less clear to me, however, is whether the newer PYBLITE1.0 and PYBV1.1 design intends also to be able to CHARGE a LiPo that has been connected if USB power has also been provided.

There are few clear statements about this on the forum. Some of those I have found appear to be contradictory, while others don't make clear enough which board versions they are talking about or are vague. My PYBLITE1.0 project normally is normally powered by a big LiPo connected to VBAT. Thus far, whenever I've wanted to charge the battery, I disconnect it, charge it externally, and while it is being charged I can power (or program) my PYBLITE1.0 via USB. Occasionally I have both connected at once, and indeed, the LiPo doesn't explode or overcharge. So far so good.

However, when I remove the LiPo and connect USB power, and then measure the voltage on VBAT I see only 0.72 volts, while V+ measures about 4.38V (which I imagine means VBUS is a diode-drop higher, or so).

I don't really understand why VBAT is so low in such a scenario.

PYBLITEv1.0b's schematic makes the statement statement that "Q1 prevents VBUS (5V) from overcharging Lion / Lipo batteries". I therefore imagined that the circuit (which I admit I don't understand) involving Q1, VBAT, V+ and VBUS intends to leave VBAT as high or as close to VBUS as it can, while ensuring that it nonetheless does not exceed some safe limit (4? I can't see a value written down anywhere) -- so that charging of the battery could take place via USB. However my LiPo is certainly not going to charge if all it sees is 0.72 volts. So either (a) LiPo charging via USB is not something that that circuit is intended to alllow, or (b) the circuit behaves differently if it senses a LiPo battery present.

I would be grateful if anyone could help explain:
  • whether VBAT on the PYBLITEv1.0 or PYBv1.1 is intended to be able to allow USB->LiPo charging (or not)
and
  • If it is not, then what extra circuits or solutions do people tend to add on to their projects so that LiPos connected via VBAT do get charged when the user plugs in a microusb cable ....
Thank you!

Re: LiPo powering and charging

Posted: Sun Nov 03, 2019 6:46 am
by chrismas9
There is no on board Lipo charger and no connector pins to add one without soldering directly to a diode or IC pad.

Q1 acts as a diode. When Vbus is absent the Pyboard is powered from the main battery (VBAT). Initially power goes through the body diode. If VBUS is disconnected resistor R22 will turn on the P channel MOSFET and reduce the voltage drop to almost zero to get maximum life from the battery. As soon as VBUS is powered R22 will turn off the MOSFET and power will go through either the Q1 diode or D1 depending on which voltage source is higher. If VBAT is Lipo then VBUS will take over and V+ will be approx 4.4V due to diode drop. If VBAT is 6 or 9V battery then Q1 diode will conduct and V+ will be approx 5.4 or 8.4V.

To charge your Lipo you will need a small Lipo charger board such as the ones Adafruit and Sparkfun sell. They have 3 connections - 5Vin, GND and BAT.

Connect 5Vin to VBUS, either Anode of D1 or pin 5 of U4 which is unpopulated on the back.

Connect GND to GND.

Connect BAT to VBAT, pin 1 of the JST battery connector J10.

Set the charging current to suit the battery rating, typically 0.5C, eg 500mA for a 1000mAh battery. Size the battery so the charger can supply the Pyboard current (typically 20 to 100mA depending on model and workload) and still have current to spare for charging. I would suggest a minimum of 500mAh and 250mA charge rate for PYB and 350mAh charging at 150 to 175mA for PYBlite.

Don't set the charge current higher than the battery spec to compensate for Pyboard load as the Pyboard load may drop to a low value, eg during sleep.

Re: LiPo powering and charging

Posted: Sun Nov 03, 2019 4:10 pm
by kesterlester
Thank you, christmas9, that's very helpful. I hope others will find it useful too.
Best wishes for the rest of your weekend!