Battery life calculation - depending voltage levels
Determining the remaining battery charge (State of Charge) from its voltage is tricky; the discharge curves aren't straight lines, and for some chemistries, the first part of the discharge curve is very flat and this makes the battery voltage almost independent of the battery's charge level.
Also, the discharge curves vary depending on temperature, age, and load current.
You can get a very rough estimate of remaining charge looking at a battery's voltage at a known, constant discharge current by checking the discharge curves in the battery's documentation and implementing a calculation based on the linear part of the chosen curve (if any).
If you need a prediction of State of Charge that is more-or-less accurate, you can use a Fuel Gauge IC, which keeps track of &quot;what goes in and what comes out&quot; and derives a State of Charge from that.
This Application Note provides further reading, should you want any.