An embedded battery SDK story about ambitious algorithms, stubborn breadboards, and the discipline of shipping anyway.
I spent a weekend implementing coulomb counting for my open-source battery monitoring SDK . The code is in production. The hardware doesn't actually work yet.
That sentence used to make me anxious. Now I think it might be one of the most useful things I've learned about embedded engineering.
The voltage-lookup-table problem
My SDK has been shipping state-of-charge estimation for months. The approach is simple: read the battery voltage, look it up in a curve like this:
4200 mV → 100% 3800 mV → ~50% 3000 mV → 0% (LiPo cutoff)
Enter fullscreen mode
Exit fullscreen mode
This works fine for a CR2032 coin cell that discharges in a smooth, predictable curve. For LiPo it's a disaster.
Three reasons:
1. The plateau region. Between 3.7V and 3.8V, a LiPo can have anywhere from 30% to 70% charge. The voltage barely moves. A 10mV measurement error becomes a 10% SoC error.…