If we wanted to take a .NET enabled device (in general),
and power it using a battery (not thinking about the limitations for the moment)
what would be the best way to measure the power of that battery?
I found that there is some support in the .NET micro framework to request
battery status, but I’m not sure to which battery that refers.
Connect the raw battery source with needed scaling resistors to one of the analog pins. It is that simple
The thing to watch out for is that figuring battery capacity from battery voltage is not always straightforward. Lead acid batteries have a fairly linear discharge curve so you can get a very good idea about the state of charge just from the battery voltage. Other chemistry’s are not so straightforward. LiPoly cells have a fairly flat discharge curve and then the voltage drops off a cliff. This makes it very difficult to get a true idea about capacity before it suddenly dies. There are also some battery management chips that keep track of charging/discharging current as well so they can calculate remaining capacity accurately.
Digging up this old thread because I just made a tutorial on voltage measuring with an anlog sensor - will perhaps be useful to others.