Your phone says 37% — but is that a measurement or a guess? Most battery meters start by reading the voltage, and for a Li-ion cell that is a bad way to count charge: the voltage barely moves while the charge falls from 70% to 20%. A proper fuel gauge does something else — it counts the charge flowing in and out, coulomb by coulomb, and only uses voltage as a correction. This guide works out coulomb counting on a 2600 mAh 18650 cell, sizes the sense resistor and the ADC, and shows how offset, internal resistance and cold weather each fool the reading — and by how much.
Figure 1: (a) Coulomb counting — the sense resistor turns current into a small voltage, the amplifier scales it, and the gauge integrates it into a state-of-charge reading, corrected by voltage and temperature. (b) The open-circuit-voltage curve is almost flat through the middle of the charge, so a small voltage error — or the sag from internal resistance — means a large state-of-charge error. (BQ27441-G1 figures are from the TI datasheet, SLUSBH1C; the OCV table is typical NMC at rest, 25 °C.)
Why voltage alone lies
State of charge (SOC) is the fraction of the cell's full charge that is left: SOC = remaining charge / full charge. The open-circuit voltage (OCV) of a Li-ion cell does track SOC — but on a curve that is steep at the ends and almost flat in the middle. A typical NMC cell at rest at 25 °C reads about 4.20 V at 100%, 4.06 V at 90%, 3.98 V at 80%, 3.92 V at 70%, 3.87 V at 60%, 3.82 V at 50%, 3.79 V at 40%, 3.77 V at 30%, 3.74 V at 20%, 3.68 V at 10% and 3.00 V at 0%. The flat region runs from 3.68 V to 3.92 V and covers 10% to 70% SOC — sixty points of charge in 240 mV. The slope there is (70 − 20)% / (3.92 − 3.74) V = 278% per volt, so a ±10 mV voltage error means about ±2.8% SOC, and in the flattest stretch (30–50%, 3.77–3.82 V) it is 400% per volt, or ±4% SOC per ±10 mV. That is bad, but it is not the ±10% per ±10 mV that some tables claim — the real slope is roughly a third of that. The deeper problem is that the curve shifts with chemistry, temperature and age (other good sources put 50% near 3.70 V, not 3.82 V), so a voltage reading can never be more than an estimate. That is why a fuel gauge counts charge instead.
Worked example — coulomb counting a 2600 mAh cell
Coulomb counting is bookkeeping: every milliamp-hour that leaves the cell is subtracted from the starting charge. SOC(t) = SOC₀ − (∫I dt) / Q_full, where Q_full is the cell's full capacity. Take a 2600 mAh 18650 at 3.7 V nominal, which stores 2.6 Ah × 3.7 V = 9.62 Wh. Run a 500 mA load for 2 hours: the charge used is 500 mA × 2 h = 1000 mAh, which is 1000 / 2600 = 38.46% of the cell, so the SOC falls from 100% to 61.5%. The gauge's job is to measure that 500 mA accurately, sample after sample, and add the samples up. Three things corrupt the sum: the measurement of the current itself, the drift of that measurement over time, and the value of Q_full, which shrinks as the cell ages. The next three sections take them in order.
The sense resistor and the ADC
Current is measured as a voltage across a small sense resistor in series with the cell. With Rsense = 10 mΩ, a 500 mA load gives 0.5 A × 0.01 Ω = 5 mV and burns I²R = 0.25 × 0.01 = 2.5 mW in the resistor; at a 2 A peak the same resistor gives 20 mV and 40 mW. Pick the power rating with margin: a ¼ W (250 mW) resistor runs at 40 / 250 = 6.25× margin at the peak, so it stays cool and its value stays put — use a 1% part, and take the sense voltage from Kelvin connections right at the resistor's ends, so the PCB traces and solder joints never add their own resistance to the reading. Now the ADC. A 12-bit ADC on a 3.3 V full scale has an LSB of 3.3 V / 4096 = 0.806 mV, and with the 10 mΩ resistor each LSB is 0.806 mV / 10 mΩ = 80.6 mA of current. The 5 mV signal at 500 mA is only 5 / 0.806 = 6.2 LSBs — the reading would jump in 16% steps. Worse, one LSB of error held for one hour is 80.6 mA × 1 h = 80.6 mAh, or 3.1% of the 2600 mAh cell. The fix is gain: a current-sense amplifier with ×100 gain turns 5 mV into 500 mV, so each LSB is now 0.806 mA, and one LSB of error for an hour is 0.806 mAh, or 0.031% of the cell. That is why real fuel gauges never feed the sense resistor straight into a bare ADC.
Drift — offset and self-discharge
Coulomb counting integrates, so a small steady error grows without limit — the gauge has no way to know it is wrong until the voltage corrects it at the ends of the charge. Take a 50 µV offset in the current-sense amplifier, a modest figure for a cheap part. Through the 10 mΩ resistor that looks like a phantom current of 50 µV / 10 mΩ = 5 mA flowing even when the load is off. Over 24 hours of standby that invents 5 mA × 24 h = 120 mAh, or 4.6% of the 2600 mAh cell — the gauge would report the battery nearly 5% emptier than it is, every day, until a full charge resets it. Real fuel-gauge ICs fight this with offset calibration and by re-learning the capacity at full and empty, which is why a gauge that never sees a full charge slowly loses its mind. The cell itself also leaks: Li-ion self-discharge is roughly 2% per month at 25 °C, which is 2600 × 0.02 = 52 mAh per month — small next to a 500 mA load, but it is real charge the gauge must account for, and it grows with temperature and age.
Internal resistance and cold weather
A fresh 18650 has an internal resistance of roughly 50–150 mΩ (new cells often 50–80 mΩ); take 100 mΩ as a working figure. Under load the terminal voltage sags by I × Rint: 50 mV at 500 mA and 200 mV at 2 A. Now read the SOC from the voltage table while the load is on. A cell truly at 50% (3.82 V at rest) reads 3.82 − 0.05 = 3.77 V at 500 mA, which the table calls 30% — a 20-point error. At 2 A it reads 3.82 − 0.20 = 3.62 V, below the 10% point, interpolating to about 9% — a 41-point error from a healthy half-full cell. This is the second reason voltage alone cannot be trusted: it is only valid at rest, after the cell has sat unloaded for an hour or two. Cold weather hits the other side of the equation — the capacity itself. NASA/COMSAT measurements on 18650 cells gave 0.98 Ah at 0 °C against 1.31 Ah at 25 °C, so a cell holds only about 75% of its room-temperature charge at freezing, and the 2600 mAh cell in our example delivers only about 1945 mAh before it is empty. A gauge that assumes 2600 mAh all year will over-promise runtime every winter; a good one measures temperature and derates Q_full.
A real fuel-gauge IC
Doing all of this in a microcontroller is possible, but a dedicated IC does it better. TI's BQ27441-G1 is a single-cell Li-ion fuel gauge built for exactly this job: it is pre-calibrated for a 10 mΩ sense resistor, has a 16-bit coulomb counter with a ±25 mV input range — so it can measure up to 25 mV / 10 mΩ = 2.5 A — and a 15-bit voltage ADC for the OCV correction. Its Impedance Track algorithm models the cell's impedance in real time and adjusts for aging, self-discharge, temperature and rate, reporting remaining capacity in mAh, SOC in percent and voltage in mV over a 400 kHz I²C bus, with a configurable SOC interrupt or battery-low alert. It sips power: 21 µA in sleep, 9 µA in hibernate and 0.6 µA in shutdown, against the 500 mA load it is measuring. The lesson for a DIY gauge is the same as the IC's design: Kelvin sense connections, a gain stage before the ADC, offset calibration, and a voltage/temperature correction that re-anchors the coulomb count at the top and bottom of the charge.
Second example — a 3000 mAh phone cell at 1.2 A
Change the cell and the load and the same arithmetic holds. A 3000 mAh phone cell at 3.7 V nominal stores 3.0 Ah × 3.7 V = 11.1 Wh. At 1.2 A it runs for 3000 / 1200 = 2.5 hours from full to empty, and after one hour it has used 1200 mAh, or 40%, so the SOC is 60%. The 10 mΩ sense resistor gives 1.2 × 0.01 = 12 mV and burns 1.44 × 0.01 = 14.4 mW — still fine for a ¼ W part. Without gain, one LSB of the 12-bit ADC is still 80.6 mA, and one LSB of error for an hour is 80.6 mAh, now 2.69% of 3000 mAh; the 50 µV offset still invents 5 mA, which is 120 mAh or 4.0% in 24 hours. The IR sag at 1.2 A is 1.2 × 0.1 Ω = 120 mV, so a cell truly at 50% would read 3.70 V under load — which the table would call roughly 13% SOC. Same cell, same gauge, same rules: count the coulombs, correct with voltage at rest, and never trust a loaded voltage reading.
Key points to remember
- Worked example: 2600 mAh × 3.7 V = 9.62 Wh. A 500 mA load for 2 h uses 1000 mAh (38.5%), so SOC falls from 100% to 61.5%. SOC(t) = SOC₀ − (∫I dt) / Q_full.
- Sense resistor 10 mΩ: 5 mV / 2.5 mW at 500 mA, 20 mV / 40 mW at 2 A — use a ¼ W, 1% part (6.25× margin at peak) with Kelvin connections. 12-bit ADC, 3.3 V full scale: LSB 0.806 mV = 80.6 mA per LSB with no gain, so the 5 mV signal is only 6.2 LSBs; ×100 gain gives 0.806 mA per LSB and 0.031% error per LSB-hour.
- Drift: 50 µV of offset looks like 5 mA of phantom current — 120 mAh, or 4.6% of the cell, in 24 h of standby. Self-discharge ≈2%/month = 52 mAh/month for a 2600 mAh cell. Coulomb counting needs a full-charge reset to stay honest.
- Voltage lies twice: the OCV curve is flat (10–70% SOC in 3.68–3.92 V, slope ~278%/V, so ±10 mV ≈ ±2.8–4% SOC), and internal resistance sags the reading — 50 mV at 500 mA makes a 50% cell read 30%, 200 mV at 2 A makes it read ~9%. Only a rested cell's voltage means anything.
- Cold: capacity at 0 °C is ~75% of 25 °C (NASA/COMSAT: 0.98 Ah vs 1.31 Ah), so the 2600 mAh cell delivers ~1945 mAh. BQ27441-G1 (TI SLUSBH1C): 10 mΩ sense, 16-bit coulomb counter, ±25 mV range (2.5 A max), 15-bit voltage ADC, sleep 21 µA, hibernate 9 µA, shutdown 0.6 µA, I²C 400 kHz.
- Second example: 3000 mAh phone cell at 1.2 A — 11.1 Wh, 2.5 h runtime, 60% SOC after 1 h, 12 mV / 14.4 mW on the sense resistor, 120 mV of IR sag, 4.0% offset drift in 24 h.
