2016-06-18 23:34
Reading Power Values on a Banana Pi
Today I learned: The Banana Pi contains an AXP20 power management unit and the Linux kernel (or at least the Banian-provided one) has a working driver for it , thus making it very easy to read out the system's current voltage and current consumption:
#!/bin/zsh
printf "%.2fA @ %.1fV (%.1f°C)\n" \
$(( $(cat /sys/class/power_supply/ac/current_now) * 0.000001 )) \
$(( $(cat /sys/class/power_supply/ac/voltage_now) * 0.000001)) \
$(( $(cat /sys/class/hwmon/hwmon0/device/temp1_input) * 0.001))
I wrote two very simple munin plugins for these values: bananapi pm voltage and bananapi pm current
Note that the Ampere reading only reflects the current consumption of the board itself. The SATA connector is not accounted for, the USB ports might or might not be.