JonnyAlpha wrote:Ah yes I posted a similar question on the Arduino Forum to monitor the battery supply to the Arduino and then thought about it a bit more and realised that the Arduino would only ever read 5v voltage it was being supplied from the 5v regulated supply provided by the L298N Motor Driver board.
That's correct, you have to measure the battery voltage before the regulator, since the voltage after the regulator will always be the same. Since you're using a 10Ah battery I'll assume it's LiPO. For radio control use we typically refer to a chart like this to determine remaining capacity after a run. The percentages are approximate but close enough.
Code: Select all
100% 4.2V
90 4.13V
80 4.06V
70 3.99V
60 3.92V
50 3.85V
40 3.78V
30 3.71V
20 3.64V
10 3.57V
Fully charged will be 4.2V and it will be considered depleted at 3.3~3.4V. You'll get better longevity if you don't go below that, or store it for periods of time fully charged. The best storage voltage is around 3.7~3.8.
Another thing to consider when monitoring remaining capacity is the load. Unlike other batteries lithium cell resting voltage is a good indicator of charge remaining. A NiCad or NiMH laying on your desk will read ~1.2V whether it's 80% charged or 30%, after a rest period they always return to their "nominal" voltage. But a Li-ion (LiPo) resting voltage will vary according to charge level.
Say for instance you wanted to monitor remaining capacity of a 40C 10Ah LiPo, which is theoretically capable of a 400A burst due to the low internal resistance. If you're drawing a continuous 40A~50A out of it the voltage will slump some, so it would need to rest for a minute or two in order to get an accurate reading of the remaining capacity. But LiPo's have such low internal resistance that a 2A~4A load on a 40C 10Ah pack wouldn't pull the voltage down very much at all, so you could get a pretty accurate reading while it was under load.
If you have a fairly constant load, like powering a RPi, you could work out how the loaded voltage corresponds to the resting voltage and use those values to determine capacity remaining. With radio control however the load varies a lot, you might be drawing 50A one minute, then only 5A the next, so the only way to get a reasonable value is to let the cells rest for a couple minutes before measuring the voltage.