Gridkid & BatteryBelle
Hey BatteryBelle, I've been thinking about that old battery myth that voltage equals state of chargeādo you think that's really true, or are we oversimplifying it?
Hey, good question! Itās definitely a big oversimplification. A batteryās voltage does give a hint about its charge, but itās heavily influenced by temperature, load, internal resistance, and the chemistry itself. For a freshly charged Liāion cell youāll see a high voltage, but under load it can sag, and a depleted cell can still hold a surprisingly high voltage if itās at a high temperature or has a high internal resistance. So, while voltage is a useful quick check, itās not a reliable standāalone indicator of state of charge. If you want accuracy, you need a proper stateāofācharge estimator that factors in current, time, temperature, and the batteryās discharge curve.
Sounds about rightāvoltageās a hint, not the whole story. I guess that means a smart estimator has to juggle current, time, temperature, and the discharge curve all at once. Got any goāto models or tricks that do it well?
Absolutely, the trick is to treat it like a little detective. I usually start with a simple Coulomb counting model, because itās the easiest to implementājust integrate the current over time, subtract the charge thatās been lost to internal resistance. Then I layer on a correction factor from the temperature sensor; lithium chemistries drop about 2ā3āÆmV per degree, so a quick lookup table does the trick. The real magic comes from the discharge curve: I keep a small lookāup table of voltage vs. state of charge for the exact battery youāre usingāusually just a few hundred pointsāand interpolate. If you want to get fancy, run a Kalman filter that fuses all of those inputs; itās surprisingly stable and keeps the error under a couple percent even if the load swings wildly. And hey, if youāre feeling adventurous, throw in a tiny bit of machine learningātrain a neural net on your batteryās behavior over time, and it can catch those subtle drift patterns that a plain math model misses. But remember, the simpler the better for most hobby projectsāoverāengineering can turn your estimator into a black box that even you canāt debug.
Thatās a solid recipeāCoulomb counting plus a temperature tweak, then the discharge curve table. Iām still curious how big the lookup table gets for a 100āÆWh pack, though. Also, a tiny neural net sounds cool, but I worry about overāengineering and losing traceability. How do you keep the system transparent?
For a 100āÆWh pack youāre looking at about 200ā300 points in the lookup table if you want a 1āÆ% resolution. Thatās just a few kilobytes of flash, so itās trivial to store in an EEPROM or even on the MCUās RAM. You can compress it further by using a spline or piecewise linear interpolation, but most hobbyists keep the raw table for absolute transparency.
When you start pulling in a tiny neural net, the trick is to keep it as a blackābox layer that simply maps the same inputs you already haveācurrent, temperature, voltageāand outputs a correction factor. Store the weights in a humanāreadable format (like a CSV) and versionācontrol them. Make sure you log the input data you used for training and the resulting prediction error so you can audit it later. In short: keep the core model simple, document every change, and never hide the training data. That way the system stays traceable and you can debug it step by step.
Got itā200ā300 points is pretty manageable, and keeping the raw table makes the whole thing feel transparent. Iām still a bit nervous about the neural net being a blackābox, even if the weights are in a CSV. Do you ever run into trouble where the training data gets lost or the model drifts over time? Maybe a quick backup routine could help guard against that.
Yeah, the data can slip if youāre not careful. I always set up an automated backup that copies the training CSV and current model weights to a microSD card every few days or after each firmware update. That way, if the device reboots or the memory gets corrupted, you still have the lastāgood snapshot. And I keep a checksum next to it so you can verify nothing got garbled. On top of that, I run a quick sanity check on boot: feed a known current/temperature pair through the net and compare the output against the Coulombācount baselineāif itās off by more than 5āÆ%, the system flags an error and falls back to the plain estimator until you can reātrain. That keeps things transparent and stops the model from drifting unnoticed.