1 Reply Latest reply on Jul 11, 2016 1:45 PM by Intel_Alvarado

    A method of reading battery voltage on Ubilinux (and Yocto)


      A few days ago I discovered a way of obtaining the current battery voltage on both Ubilinux and Yocto with no extra hardware required. I've not seen any reference to this method elsewhere, so I thought I'd post it.


      The battery voltage is read by the "basincove" adc, part of the hardware on the Edison. It can be accessed through sysfs, with the device located at /sys/devices/platform/bcove_adc/basincove_gpadc. It is operated by setting /path/to/basincove_gpadc/channel to 1, then writing 1 to /path/to/basincove_gpdac/sample. The result of the ADC conversion is then returned in /path/to/basincove_gpadc/result. This is (I believe) a 10-bit value, representing a voltage between 0 and 4.5v.


      I've uploaded a proof-of-concept here