I don’t know a way to see the battery’s voltage via kernel but you can try using a sensor to measure these values. Maybe something like this can be helpful for your project https://www.sparkfun.com/products/12052 . Also I believe that the chip can be accessed through I2C, take a look at section 3.5 of http://www.intel.com/support/edison/sb/CS-035274.htm . In that document you’ll also find more information on PMIC and the I2c bus. Let me know if this was helpful.
yeah, Diego confirmed what we all had pretty much suspected. with the arduino board it shouldn't be a problem, but with the mini board... hm, it still has digital inputs, or doesn't it? external ADC is small and cheap, in fact I could probably tap a line into the tiny voltmeter that sits in parallel on my battery-harness-gone-wrong-thing...
Yeah we could use an ADC but sure would be nice if the PMIC could be utilized as I'm assuming its built to do that whole calculation for us. Also the mini board has thermistor inputs (I think, J1??), so I am guessing they are thinking of eventually adding this. From my limited understanding to do the % meter correctly you need battery temp, as well as voltage, and the current. Anyway, sounds like lots of dev going on at Intel now on the Edison, hopefully this is a feature they will implement and expose with another library we can use in Yocto.
Sergio, looks like the mention of I2C in that intel doc is more FYI, I don't think that I2C access is exposed to us ...
interesting thought, you're right, definitely how e.g. a laptop uses all those multiple inputs to do proper battery monitoring.
I had always assumed the mini-board thermistor was more of a crude trigger/cutoff to shut down the charge circuit, if it hits a set value - we can't even pull actual temperature readings from it, as far as I could tell?
it's definitely frustrating that we have a device that:
- is definitely meant to be battery-powered (well, for some applications) and can be recharged
- can potentially have its system FS corrupted/trashed if improperly shut down (e.g. power cut)
- offers no (apparent) way to monitor battery state, if we wanted to provide safe shutdown when power gets low
(or is there some strange voodoo we don't know about, in the charging circuit, that handles this?!)
Just because it might help, as far as I can tell this is the data sheet for the PMIC in the Edison: TPS65910 | Power Management Multi-Channel IC (PMIC) Solutions | Power Management | Online datasheet I have no idea what I2C port it might be connected to, but the kernel is definitely communicating as it prints an error message to the debug UART when it powers down due to power cut off.
There's a Yocto recipe called "battery-voltage" which is included in the latest edison image as of today.
Typing 'battery-voltage' at command line with root access gives the following output:
Battery Voltage = 3920 mV
Battery level = 52%
Battery Voltage = 3910 mV
Battery level = 50%
I verified this with a multimeter. Just make sure that your LiPo battery charge management IC supplies VBAT to the Edison's VSYS. I am using BQ24074 which gives VSYS ~= VBAT when we are in regulation voltage range.
I hope it helps other folks!