I have an interesting problem to solve. I am working on a product that runs on two AA-batteries - could be alkaline or NiMH (or Lithium or NiCd, but I'll neglect those if necessary). I can measure the battery voltage, I can also electronically detach the battery from the circuit for about 1ms and leave the device running from a strong capacitor and measure the open voltage of the battery in the meantime.
From this I can estimate the internal resistance of the battery and that gives me an idea whether it is Alkaline or NiMH.
Now the task: I want to predict how long my product will run on the current batteries. In other words: The display shall read something like "1h29 minutes remaining".
I don't know the batteries - they could be different any time the device is switched on. I do know the approximate average current drawn from the batteries (~200mA) and that there are no big peaks in there. I could start with some initial rough approximation and then refine during run-time.
I have thought about incrementally adjusting a software-model of my battery until it produces the same voltage results I measure and then predict the run time from there.
DO YOU KNOW ANY GOOD BATTERY MODELS to do that (could you provide links, search terms, etc...)? Most models I found were for bigger automotive batteries.
DO YOU KNOW ANY OTHER WAYS TO accomplish the task?
The most common way that batteries are tracked these days is with a "Battery Fuel Gauge" device. They typically monitor the charge going in when the battery is charging and then the charge going out when the device is in use. They have built in algorithms for battery types and some monitor temperature and factor that in as well.
Here's an article that talks about what's considered in the algorithms:
Suggest to take a look at battery manufacturers' data sheets, for example:
or closely related chip datasheet, like the TI TPS61070 boost/converter chip:
At first glance these have discharge curves that might be helpful.
Another idea is a Google image search on "AA battery discharge curve" -- that seems to bring up a lot of links that might be helpful.