Battery voltage sensor / voltage divider


(Sam Foster) #1

The battery charger module we’re using doesnt have any fancy way to read
the relative charge of the battery, so for now we’re using a simple 48k/33k
voltage divider to give us a < 3.3V value we can read on one of the Photon
board’s analog inputs.

With the code Puna wrote [1] I did some quick testing with my
not-terribly-accurate bench power supply and got these mappings:

3.3V -> 5.51
3.4V -> 5.52
3.5V -> 5.53
3.6V -> 5.78
3.7V -> 5.98
3.8V -> 6.04
3.9V -> 6.12
4.0V -> 6.15
4.1V -> 6.48
4.2V -> 6.54

I’ve not plotted it but that looks like a reasonable curve, and should let
us pick a threshold to take some action before the circuit on the
lithium-polymer battery itself cuts us off

/Sam