Charging, Protection, and USB-C
USB-C is a connector, a power-negotiation protocol, and a trap for anyone who forgets two resistors.
🎯 By the end you'll understand
How a lithium cell is charged — constant current, constant voltage, termination — and what each phase is protecting. How the MCP73831 programs its charge current with a single resistor, and why the current you program is very often not the current you get. What a protection IC actually does, why it is not a charger, and why a "dead" lithium pack reads zero volts and is not dead. And the USB-C detail that has killed more first prototypes than any other single mistake: the two 5.1 kΩ resistors that tell a source it is allowed to turn VBUS on, and why leaving them out produces a board that charges perfectly from every cable you own and not at all from the ones your customers own.
KEY INSIGHTThe cable does not decide; the resistors do
"It charges fine." It did — from the old USB-A charger on the bench, through an A-to-C cable, every time, for three weeks. The first person to plug it into a modern laptop with a C-to-C cable reported a dead unit. Nothing was dead. The board had simply never asked for power.
A USB-A port is a promise: 5 V is present on VBUS the moment anything is plugged in, whether or not the device is capable of asking for it. USB-C removed that promise. A compliant Type-C source keeps VBUS off until it detects a sink, and it detects a sink by looking for a pull-down resistor — Rd, 5.1 kΩ to ground, on each of the two CC pins. No Rd, no VBUS, no charging, no enumeration, no symptom other than a device that appears not to exist. And because a legacy A-to-C cable carries its own pull-up in the C plug, an A-to-C cable will happily light up a board that has no Rd at all. Your bench passes. Your customers fail.
There are three independent subsystems in the two square centimetres around a USB-C jack, and confusing them is the source of most charging bugs. The connector and its CC resistors decide whether 5 V arrives. The charger IC decides how the cell is filled: constant current, then constant voltage, then stop. The protection IC decides when to disconnect the cell entirely because something has gone wrong. None of the three can do another's job, and a design that is missing any one of them will still appear to work on a bench.
HOW IT WORKSCC/CV charging, and one resistor that sets the current
A lithium-polymer cell is charged in two phases with a hard stop.
Constant current (CC)
The charger pushes a fixed current into the cell and lets the terminal voltage go wherever it goes. The cell's voltage rises along its charge curve. This phase carries most of the charge — roughly 80 % of the capacity — and it is fast because current, not voltage, is the constraint. The current is chosen as a fraction of capacity: 0.5C for a 1000 mAh cell is 500 mA, which is the usual comfortable rate for a pouch LiPo.
Constant voltage (CV)
Once the terminal reaches the float voltage — 4.20 V for standard LiPo chemistry — the charger clamps the voltage there and lets the current fall. It falls asymptotically, because the cell's internal resistance and diffusion set the rate at which the last charge can be absorbed. This phase is slow and delivers the last 15–20 %.
Termination
When the current in CV decays below a threshold — a few percent to a tenth of the programmed current, depending on the part you order — the charger stops entirely and does not trickle. This matters: leaving a lithium cell held at 4.2 V indefinitely accelerates ageing. A charger that "keeps it topped up" is damaging it.
Preconditioning, below the floor
Below roughly 2.9 V the cell is deeply discharged and may have internal damage. A well-behaved charger drops to a trickle — of order 10 % of the programmed current — until the voltage recovers past that threshold, then switches to full CC. If it never recovers, the cell is genuinely dead and forcing current into it is the way people set fires.
The float voltage tolerance is not cosmetic. Charging to 4.25 V instead of 4.20 V measurably shortens cycle life; charging to 4.15 V measurably lengthens it at the cost of a few percent of capacity. This is why a charger IC's regulated output tolerance — a fraction of a percent on a decent part — is the specification you check first, and why "just use an LDO set to 4.2 V" is not a charger.
Beacon's charger is the MCP73831: a five-terminal linear single-cell charger in a SOT-23 package with a status output, a battery terminal, a supply terminal, ground, and a program pin. Its charge current is set by one resistor from the program pin to ground:
IREG = 1000 V / RPROG
The units matter: put 1000 volts over the resistance in ohms and you get amps. RPROG = 2 kΩ gives 500 mA; 10 kΩ gives 100 mA. The part is specified over that 2 kΩ–10 kΩ range, so 500 mA is the maximum this device programs and 100 mA the minimum. Beacon uses 2 kΩ, which is 0.5C on its 1000 mAh cell.
Now the part that catches people. The MCP73831 is a linear charger: it drops the difference between VBUS and the battery voltage across a pass transistor, exactly like the LDO in Lesson 4.2, and dissipates it as heat inside a SOT-23. The power is (5.0 V − Vbat) × Ichg. With a deeply discharged cell at 3.0 V and a programmed 500 mA, that is one watt in a package whose thermal resistance to ambient is on the order of 230 °C/W. One watt would put the die 230 °C above ambient, which is impossible, so what actually happens is the part's thermal regulation loop folds the current back until the die settles near its internal limit.
Work it through. If the loop holds the junction near 105 °C in a 25 °C room, the allowed power is (105 − 25) / 230 ≈ 0.35 W, and the allowed current at Vbat = 3.0 V is 0.35 / 2.0 ≈ 174 mA. You programmed 500 mA and you are getting 174. As the cell fills and Vbat rises to 4.1 V, the dissipated voltage falls to 0.9 V and the allowed current climbs to about 386 mA. So the "constant current" phase of a thermally limited linear charger is not constant at all — it is a rising ramp, and it is steepest exactly where the datasheet's block diagram shows a flat line. The widget below simulates this; watch the CC segment slope upward.
If the package is going to limit you to under 200 mA for the first half of the charge anyway, programming 500 mA buys you very little and costs you a hot part, a hot board, and a cell being charged next to a 105 °C die — which is itself bad for the cell. Programming 300 mA (RPROG ≈ 3.3 kΩ) gives up almost nothing in charge time at low battery voltage and runs meaningfully cooler. The thermal-limit line, not the program resistor, is what actually sets your charge time. Compute it before you pick the resistor. Thermal resistance and die-limit figures here are illustrative values in the class of a small SOT-23 part; use your package's real θJA on your real copper pour.
CORE CONCEPTProtection is not charging, and a "dead" pack is usually fine
A protection circuit sits between the bare cell and the rest of the world, and its entire job is to open a switch when something exceeds a limit. Beacon uses the commodity pairing found inside nearly every small LiPo pack: the DW01A controller watching the cell, and the FS8205 — a dual N-channel MOSFET in a six-pin package, wired back to back so their body diodes oppose each other — doing the switching.
Three events, three responses:
| Event | Typical threshold | What opens | How it recovers |
|---|---|---|---|
| Over-charge | ≈ 4.30 V, release ≈ 4.10 V | The charge FET | Automatically when the cell relaxes below the release voltage |
| Over-discharge | ≈ 2.40 V, release ≈ 3.00 V | The discharge FET | When a charger raises the pack voltage — current flows in through the open FET's body diode |
| Over-current / short | ≈ 150 mV across the FET pair | The discharge FET | When the load is removed |
That over-current threshold is worth converting into an actual current, because it is the specification people quote without understanding. The DW01A does not measure current; it measures the voltage developed across the two FETs' on-resistance and trips at roughly 150 mV. With FETs at, say, 25 mΩ each, that is 150 mV / 50 mΩ = 3 A. Change the FET pair and you change the trip current — which means a pack's over-current protection is set by a resistance the controller never knew about. Two packs with the same DW01A can trip at 2 A and 6 A.
It has no reference for 4.2 V regulation, no current loop, no termination logic, and no way to stop a charger that is overcharging — it can only disconnect once the cell has already gone past 4.3 V. It is the last line of defence against a fault, not a charge controller. Similarly, a "protected cell" from a supplier is protected against abuse; it still needs an MCP73831 or equivalent in front of it. The two parts solve disjoint problems and a design needs both.
And the practical consequence that will save you an afternoon: a pack in over-discharge lockout reads 0 V at its terminals. The discharge FET is open, so a voltmeter across PACK+ and PACK− sees nothing, and the obvious conclusion is that the cell is dead. It is not — the cell itself is sitting at 2.3 V behind an open switch. Apply a charger and current flows in through the open FET's body diode, the cell voltage rises past the release threshold, the DW01A closes the switch, and the pack "comes back to life". If you throw away every LiPo that reads 0 V you will throw away a lot of good cells. (If it reads 0 V and does not recover after several minutes on a charger, then it is genuinely dead, and forcing it further is not worth the risk.)
HOW IT WORKSUSB-C for a 5 V sink: the two resistors, in full
Forget Power Delivery for a moment. Beacon does not negotiate; it wants 5 V at up to half an amp, which is the simplest thing a Type-C connection can do. Even that requires participation.
A Type-C receptacle has two configuration channel pins, CC1 and CC2, positioned so that whichever way the plug goes in, exactly one of them is connected through the cable to the source. The source puts a pull-up resistor Rp on its CC pins and watches the voltage. An unconnected CC pin sits at the pull-up rail. When a sink is attached, the sink's Rd = 5.1 kΩ pulls that pin down into a defined window, the source concludes "a sink is present, on this orientation", and only then does it enable VBUS.
The Rp value on the source side is a three-level current advertisement, read by a sink that bothers to look:
| Source Rp | Advertises | What a dumb 5 V sink should do |
|---|---|---|
| 56 kΩ (to 5 V) | Default USB power | Draw no more than 500 mA (USB 2.0 rules); this is also what a legacy A-to-C cable presents |
| 22 kΩ | 1.5 A | May draw up to 1.5 A |
| 10 kΩ | 3.0 A | May draw up to 3.0 A |
Beacon never reads the advertisement — it programs 500 mA and stays inside the most pessimistic case, which is the correct engineering shortcut for a device whose maximum draw is half an amp. If you ever want more than 500 mA you must either measure the CC voltage with an ADC or comparator, or add a Power Delivery controller, and at that point USB-C stops being a connector and becomes a protocol stack.
No Rd at all — dead with every C-to-C cable, perfect with every A-to-C cable. Found in the field, weeks later. One resistor bridging CC1 to CC2 — neither pin is pulled to ground, so no compliant source ever enables VBUS; also destroys orientation detection. Found immediately if you test with a C-to-C cable, never if you don't. Rd on only one CC pin — works in one plug orientation and not the other, which arrives as an intermittent bug report about a "loose connector". The nastiest of the four, because it is reproducible only half the time. The wrong value (10 kΩ, or a 5.1 kΩ that is really 4.7 kΩ because that is what was in the drawer) — falls outside the specified window, so some sources detect it and some do not, and you discover the split across your fleet rather than on your bench. Rd is 5.1 kΩ with a ±20 % tolerance; 4.7 kΩ happens to fall inside that window, 10 kΩ does not.
Two more details around the jack. The CC pins also carry VCONN, the supply that powers the electronics inside an e-marked cable — a plain 5 V sink neither provides nor needs it, and 5.1 kΩ to ground on both pins is the whole of your obligation. And VBUS is an exposed pin on a connector a human will jam a cable into: it needs transient protection. Beacon uses a small TVS array (the canon specifies a PRTR5V0U2X-class part) across VBUS and the data lines, plus 22 Ω in series with D+ and D−. Those series resistors are an EMI and ESD measure that is fine at USB full speed — the ESP32-C3's native USB Serial/JTAG runs at 12 Mbit/s — and would be a mistake on a high-speed 480 Mbit/s link, where they would wreck the 90 Ω differential impedance. Fit them as populatable 22 Ω / 0 Ω footprints and decide with a measurement: USB 2.0 requires the driver's total source impedance — transceiver plus series part — to sit between 28 Ω and 44 Ω, and Espressif does not publish the C3 transceiver's own figure. A transceiver near 20 Ω needs the 22 Ω to reach the window; one already matched internally is pushed out of it by the same part. Lesson 2.9 fits the footprint for exactly this reason.
SEE ITCharge and connector lab
Wire the CC pins, pick a cable, program the charge current, and set the cell's starting voltage and the room temperature. The widget decides whether VBUS arrives at all, then simulates the whole charge — preconditioning, constant current with thermal foldback, constant voltage, termination — and reports what actually happened. Start by removing the CC resistors and plugging in an A-to-C cable, because that is the configuration in which the bug hides.
Four experiments worth running. One: set the CC pins to "no CC resistors" and the cable to C-to-C — nothing happens, and no amount of fiddling with RPROG helps, because you never asked for power. Switch the cable to A-to-C and it charges perfectly. That pair of results is the bug in the opening, reproduced. Two: with everything correct, set the cell to 2.20 V and watch the protection lock the pack out until the charger drags it above the release voltage. Three: keep RPROG at 2 kΩ (500 mA programmed) and compare the time to termination at 25 °C and at 40 °C — the hot room costs you more than an hour, and the programmed current never once appears on the graph. Four: raise the over-discharge threshold to 3.00 V and go back to Lesson 4.1's discharge curve: you have just made the protection IC, not the regulator, the thing that strands your capacity.
IN PRACTICESharing the battery node: the load, the charger, and termination
There are two ways to wire a system that runs from a cell and charges from USB. The honest way to describe the difference is by asking where the system's current comes from while charging.
| Simple: load on the battery node | Power path: load on a switched node | |
|---|---|---|
| Parts | MCP73831 + protection. Two ICs. | A power-path charger (MCP73871, BQ24075 class) or a charger plus a load switch and ideal-diode logic. |
| While charging | The load draws from the same node the charger is filling. The charger cannot tell load current from charge current. | The system runs from VBUS; the cell sees only charge current. |
| Termination | Corrupted by the load. If the load is comparable to the termination threshold, the charger may never terminate. | Correct, because the charger measures only what enters the cell. |
| Dead-battery boot | The system will not start until the cell has enough charge to run it. | Runs from USB immediately, with a dead cell. |
| Cost / pins / area | Minimal. | More expensive, more pins, more board area. |
Beacon takes the simple topology, and it is worth showing the arithmetic that makes that defensible rather than lazy. Termination fires when the current entering the battery node falls below roughly 7.5 % of the programmed 500 mA, which is 37.5 mA. Beacon's average load is 38 µA — three orders of magnitude below the threshold. Even during an active window the load is 40 mA for 45 ms, which is a 0.075 % duty cycle and contributes 38 µA of average error to a 37.5 mA decision. The load is invisible to the termination comparator, so the simple topology is correct for this device. Change the design so it runs a display or a motor while charging, and the same topology silently stops terminating and cooks the cell.
Two smaller decisions live in the same corner of the schematic. The reverse-battery PMOS from Lesson 2.6 sits between the pack and the system so that a JST connector inserted backwards does nothing rather than something expensive. And a VBUS-sense divider into a GPIO lets the firmware know it is plugged in. Beacon does not use VBUS to trigger OTA — the canon puts OTA behind holding the button at wake (Lesson 4.9) — but knowing that the cell is charging is still useful, because the battery-voltage reading in the advertising payload means something different while a charger is attached, and a dashboard that does not know that will report a fleet of tags at suspiciously healthy voltages.
BEACONBeacon: the charging subsystem, as built
Everything in this lesson lands on about a square centimetre of Beacon's 35 × 25 mm board:
| Element | Choice | Why |
|---|---|---|
| Connector | USB-C receptacle | R6 requires it. No Power Delivery, no negotiation. |
| CC pins | 5.1 kΩ from CC1 to GND and 5.1 kΩ from CC2 to GND | Two resistors, both orientations, every cable type. |
| Transient protection | PRTR5V0U2X-class TVS array on VBUS and D± | The connector is the one place a human touches the board. |
| Data lines | 22 Ω in series with D+ and D− | Acceptable at the C3's full-speed native USB; would be wrong at high speed. |
| Charger | MCP73831, RPROG = 2 kΩ ⇒ 500 mA programmed | 0.5C on a 1000 mAh cell. R6's 500 mA. |
| Protection | DW01A + FS8205 | Over-charge, over-discharge, over-current. Commodity, cheap, well understood. |
| Cell | 1000 mAh LiPo on JST-PH 2.0 | R1's six months comes from this capacity (Lesson 4.3). |
| Reverse protection | PMOS in series with the pack | A reversed JST is otherwise a destroyed board. |
The honest charge-time expectation for that BOM: with a cell at 3.0 V in a 25 °C room, the thermal ceiling holds the current near 175 mA at the start and lets it climb toward 380 mA as the cell fills, so the constant-current phase takes several hours rather than the two you would compute from 1000 mAh ÷ 500 mA, and the constant-voltage tail adds most of another hour. Budget six hours to full from empty and you will not be disappointed. Anyone who reads "500 mA charger" off the BOM and promises two hours has read the program resistor and not the package.
Lithium cells must not be charged below 0 °C — doing so plates metallic lithium onto the anode, which permanently reduces capacity and can eventually short the cell internally — and charging above roughly 45 °C accelerates degradation. The MCP73831 has no thermistor input; its larger sibling the MCP73833 does. Beacon therefore has no hardware interlock: plug it in at −5 °C and it will charge. The board has an SHT40 two centimetres away that knows the temperature perfectly well, but the charger runs autonomously whenever VBUS is present and the firmware has no switch in that path to open.
The mitigations, in order of honesty. R9 already constrains Beacon to a 0–45 °C indoor environment, so the requirement and the limitation happen to coincide — which is a real answer for a 25-unit indoor pilot, and must be written into the operating instructions rather than left implicit. The proper fix is a Rev B change: a load switch between VBUS and the charger's supply pin, gated by firmware that reads the SHT40, or a charger with a thermistor input. Do not pretend the first answer is the second one in a design review.
WEAKNESSWhere this bites
Your desk has A-to-C cables because your chargers are old. A-to-C cables carry their own pull-up in the C plug and put VBUS on the pin unconditionally, so they mask every CC mistake there is. The test that matters is a C-to-C cable from a modern laptop or a PD charger, in both plug orientations, and it takes ten seconds. Put it in your bring-up checklist (Stage 6 builds that checklist properly) and it will never happen to you. Leave it out and it will happen to you at scale, in the field, where the failure mode reads as "dead on arrival".
RPROG = 2 kΩ sets the current the charger will regulate to if it is thermally able. A linear charger dissipating (5 V − Vbat) × I in a SOT-23 is thermally able only near the end of the charge. The specification you actually need is the allowed power for your package on your copper, and the current it implies at your lowest expected battery voltage and your highest expected ambient. If that number is uncomfortably far below what you programmed, the choices are a larger package, more copper, a switching charger, or an honest charge-time figure in the manual — but not a smaller program resistor, which changes nothing about the part that is limiting you.
DW01A-class protection is genuine and worth having, but it is the cheapest possible implementation and it protects against exactly three electrical faults at loose thresholds. It does not know the cell's temperature. It does not detect a swollen pack, an internal short developing, or a cell that has been over-discharged and left flat for months. It does not stop a charger that is regulating to 4.35 V because someone fitted the wrong part — it only disconnects after the damage is being done. And clone parts with the same silkscreen have thresholds that vary. If your product's risk story is "we have a protection IC", the risk story is thin. Cell selection, mechanical protection against puncture, a charge-temperature interlock, and an end-of-life policy are the rest of it.
KEY INSIGHTHow this connects
- Batteries: Chemistry, Capacity, and the Lies of mAh (4.1) — the discharge curve you saw there is the same curve run backwards here, and the protection IC's over-discharge threshold is one more cutoff line competing with the regulator's.
- Protection: ESD, Reverse Polarity, Overcurrent, and Inrush (2.6) — the reverse-battery PMOS and the TVS array on VBUS come straight from that lesson; this one gives them their place on the schematic.
- Sleep Modes and the Power Budget (4.3) — the 38 µA average is what makes the simple single-node charging topology safe here, and it is the number that decides how often a user has to find a cable at all.
- Wireless Fundamentals: dBm, Link Budget, and Antennas (4.5) — next: the other half of the stage. The cell is now full; the question becomes how far a milliwatt travels.
Power in, power stored, power out. With the input side settled, the rest of Stage 4 is about spending it on radio.
GLOSSARYKey terms introduced
- CC/CV charging
- The two-phase lithium charge profile: constant current until the cell reaches its float voltage (4.20 V for LiPo), then constant voltage while the current decays, then a hard stop at a termination threshold.
- Termination current
- The current in the constant-voltage phase at which the charger stops. A few percent to a tenth of the programmed current, depending on the part variant. Charging is stopped, not trickled — holding a lithium cell at 4.2 V ages it.
- RPROG
- The MCP73831's program resistor. IREG = 1000 V / RPROG, valid from 2 kΩ (500 mA) to 10 kΩ (100 mA). Beacon uses 2 kΩ.
- Thermal regulation
- A charger's internal loop that folds back charge current to hold the die below its limit. On a linear charger in a small package it, not the program resistor, usually sets the actual charge current for the first half of the charge.
- Rd / Rp
- The USB-C configuration-channel resistors. Rd is the sink's 5.1 kΩ pull-down, required on each CC pin; Rp is the source's pull-up, whose value advertises 500 mA, 1.5 A, or 3.0 A.
- Over-discharge lockout
- The protection IC's response to a cell below roughly 2.4 V: it opens the discharge FET, so the pack terminals read 0 V. The cell is not dead; applying a charger restores it through the FET's body diode.
- Power path
- A charging topology in which the system load runs from VBUS rather than from the battery node while charging, so the charger's termination sense is not corrupted by load current and a device with a flat cell can still boot.
- VCONN
- The supply carried on a CC pin to power the electronics inside an electronically marked USB-C cable. A plain 5 V sink neither supplies nor needs it.
ACTIVE RECALLCheck your understanding
Answer in your own words first, then reveal.
1A colleague reports that your prototype charges from every cable in the office but not from their new laptop. Nothing is broken. What is the fault, and what is the two-component fix?›
The board is missing its CC pull-downs, or has them wrong. A compliant USB-C source keeps VBUS off until it detects a sink, and it detects one by seeing Rd — 5.1 kΩ to ground — on the CC pin that the cable happens to connect. The office cables are legacy A-to-C, which carry their own pull-up in the C plug and therefore present VBUS unconditionally; the laptop is a proper Type-C source and sees nothing to power. The fix is two 5.1 kΩ resistors, one from CC1 to ground and one from CC2 to ground. Not one resistor between CC1 and CC2, which pulls neither pin down, and not one resistor on one pin, which works in only one plug orientation.
2You program an MCP73831 for 500 mA and measure 170 mA into a cell sitting at 3.0 V. Is the part faulty? Show the arithmetic.›
Not faulty — it is thermally regulating, which is exactly what it is supposed to do. It is a linear charger, so it drops (5.0 − 3.0) = 2.0 V across its pass element. At 500 mA that would be 1.0 W in a SOT-23 whose thermal resistance to ambient is around 230 °C/W, implying a 230 °C rise. The part's thermal loop instead folds the current back to hold the die near its limit: with a 105 °C die in a 25 °C room the allowed power is (105 − 25)/230 ≈ 0.35 W, and at 2.0 V of drop that is about 174 mA. As the cell charges toward 4.1 V the drop falls to 0.9 V and the allowed current rises to nearly 390 mA. The "constant current" phase of this charger is a rising ramp, and the program resistor only becomes the binding constraint near the end.
3A LiPo pack from a drawer reads 0.00 V. Explain what is almost certainly happening, and what you would do.›
The pack is in over-discharge lockout. The DW01A saw the cell fall below roughly 2.4 V and opened the discharge FET, so a voltmeter across the pack terminals sees an open switch, not a cell. The cell itself is behind it at something like 2.3 V. Applying a charger pushes current in through the open FET's body diode, the cell voltage rises, and once it passes the release threshold near 3.0 V the controller closes the switch and the pack behaves normally again.
What I would do: put it on a current-limited charger, watch for the voltage to appear within a few minutes, and then treat the cell as suspect rather than good — a cell that has sat deeply discharged for a long time has lost capacity and may have developed internal shorts. For a pilot unit that is fine after a capacity check; for a shipping product it is a cell to retire. If it does not recover at all after several minutes, stop and dispose of it properly rather than escalating the current.
4Beacon puts its system load directly on the battery node instead of using a power-path charger. Justify that with numbers, and state the design change that would invalidate the justification.›
The risk of a shared node is that the charger cannot distinguish load current from charge current, so its termination comparator can be fooled — either never terminating, or terminating with the cell not full. The threshold is about 7.5 % of the programmed 500 mA, which is 37.5 mA. Beacon's average load is 38 µA, roughly a thousandth of that, and even its 40 mA active bursts last 45 ms once a minute, so the time-averaged error remains 38 µA. The comparator cannot see it. The topology saves an IC, several pins, and board area on a 35 × 25 mm board, and costs nothing measurable.
What would invalidate it: any change that makes the load comparable to the termination threshold. A display, a motor, a always-on Wi-Fi mode, or simply a much shorter report period would push the average into the tens of milliamps and start corrupting termination. A second thing that would invalidate it is a requirement to operate with a flat cell while plugged in, which the simple topology cannot do — the system will not start until the cell has enough charge to run it. Either change means a power-path charger.