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.
Sounds solid, but I wonder how often you’d need that sanity‑check loop—maybe a quick test every reboot is enough? Also, do you use a simple linear regression to cross‑check the neural net or just the Coulomb‑count baseline? The more layers of sanity, the better I can debug.
A quick test on each reboot is usually fine, especially if you’re running the net on a stable battery type. If you can’t afford to do that on every boot, I schedule a sanity pass every hour or after a big current spike. For cross‑checks I use the Coulomb‑count baseline as the primary yardstick, then run a simple linear regression on a sliding window of recent measurements to spot any drift—if the regression slope starts to deviate from the net’s prediction, that’s a red flag. Layering those checks keeps the system transparent and makes debugging a breeze.
That’s a clever safety net—using the regression slope as a drift detector. I’ve wondered what happens during a rapid charge cycle; does the net ever get fooled by the sudden voltage spike? Also, how do you decide the 5 % error threshold? Maybe a little experiment with different thresholds could show how tight you really need to be before the system flags an issue.
During a fast charge the voltage can shoot up quickly, so the net might predict a higher SOC than the Coulomb counter says. That’s why I let the sanity check compare the net’s output to the Coulomb count *and* to the linear regression over the last few minutes. If the net’s prediction deviates more than the chosen threshold, it flags an issue.
The 5 % threshold is a balance I found experimentally: with my typical 3.7 V Li‑ion pack the Coulomb count usually stays within ±3 % under normal loads. I raise the bar to 5 % to allow a little headroom for temperature swings and a small measurement noise, but still catch real drift. If you feel the system is flagging too often, tighten it to 3 % or 4 %. If you’re missing a lot of real errors, loosen it a bit. A quick test run—log the SOC errors for a full charge/discharge cycle and plot them against a few thresholds—will show you where the sweet spot is for your particular pack and usage pattern.
Sounds solid—logging every cycle and testing multiple thresholds will show exactly where the sweet spot is. I’m still a bit curious whether a simple moving‑average filter on the Coulomb counter could pre‑emptively flag outliers before the net even gets to the data. That way the net never sees a bogus spike and we can keep the system honest from the start. What do you think?