Friday, 9 October 2015

[Q] Low Power Battery State Sensing



Hi, I'm looking for a very low resource way of measuring power draw over a time interval. I'm looking to measure the power draw as various pictures and videos are displayed on the screen to get an idea of how much power the various components of the phone draw. I've done some looking and I've found this: http://developer.android.com/referen...ryManager.html. Particularly, I noticed Charge_Counter, Current_Average, and Energy_Counter. My issue is that while I have a bit of a programming background (more like a hobby), I have no idea where to start with this. I have some background in Python, Labview, linux scripting, and very little C and .NET, so I understand some of the basic concepts of programming, but anything beyond that is something I would have to pick up. I have virtually no experience in Android programming (other than a few Cyanogenmod compiles from source - as anyone who has been around long enough has :D ).

I wouldn't need a gui for this, so something like a script would work great. It can (maybe should) be able to be executed via ADB, and needs to be universal - working across modern devices. The app/script I'm envisioning would perhaps poll the battery for a power level, wait a specified time - 2 min, 5 min, 10 min, 1 hour, something like that - then poll it a second time, get the delta, and divide by time to get an average power. Other than those two polls, I would want the app/script to have no interactions with the processor. The greater the accuracy, the better, and if no root is possible, that would be my choice. I would prefer to keep the phones as stock as possible.

My questions are:
- Is something absolutely universal (or mostly universal among newer devices - say 1 yr old or less) possible (no root)?
- Since it needs to be universal, would Java be a good choice of programming language? Or perhaps this can be accessed via the command line (script)?
- How accurate would a method like this be? How do the phones know the instantaneous current, power level, etc? Is it basically a shunt resistor, measuring the V across?
- How much time would it take (generally) for a noob with no Android experience to get a working demo? Days, weeks, months?

Thank you for your time.



No comments:

Post a Comment