Firstly, please implement a way to cut-off the discharge process when the battery is depleted. All common types of batteries (Ni*, Li*, Pb) will not take kindly a complete discharge (i.e. down to 0V) and some damage to the cells is probable in that case.
As for what depleted means, it depends on the chemistry of the battery. Most of the time, you could compare the cell/battery voltage vs a known minimal threshold value.
Examples:
- A 12 V Lead battery: 11.7V (car battery) - 10.5V (the usual IEC value of 1.75V/cell)
- A single LiPo cell: 3.0V
- NiMH: 1V
... and so on.
The useful battery capacity is dependent on the method used for the charge/discharge.
The IEC standard specifies something like: full charge, rest, 0.2C discharge, rest, full charge
As you see, there is the question of 0.2C discharge, which greatly suggests the use of a constant current load. In this case, the available battery capacity (in A*h) is just a question of multiplying the discharge current by the discharge time (i.e. how much time it took to go down to the threshold voltage.
If you don't want to use a constant current load, then you should either
- log the discharge current through your light bulbs load and integrate current over time
or
- approximately measure the current drawn by the load, measure the time it takes to discharge and hope for the best by a simple Capacity = Current * Time, with maybe some approximating (min, max) factors. This method supposes that the current doesn't change drastically when the battery voltage goes from max/nominal to min; which may be a reasonable assumption or not.
Cheers,
Dan