I would like to throttle the power output of an LED light when the battery level is getting low.
My initial approach was to measure the voltage and start throttling at about 3.7 V (which in my estimation is 20% left).
However, drawing high current from the cell drops the battery voltage considerably. At high currents, the voltage drops to 3.7 V already at 80% battery capacity.
Unfortunately, these are my observations and I do not have any math to actually calculate the remaining capacity. Basically what I need is a formula:
battery_level = f(battery_voltage, battery_temperature, battery_capacity, discharge_current)
Given this information, how can I determine the battery level? Am I missing something important?