AXP209 battery monitor official script

Started by vazhnov, April 19, 2021, 12:40:17 AM

Previous topic - Next topic

vazhnov

Hello!

Is there are official way to monitor LiPo battery voltage/status on Olimex Allwinner boards in Linux? I found some "axp209.sh" for CHIP board, but it requires some polishing...

LubOlimex

I don't think we have such but you can find info about the battery under /sys/class/power_supply/axp20x-battery/ for example:

root@a20-olinuxino:~# cat /sys/class/power_supply/axp20x-battery/voltage_now
4192000
root@a20-olinuxino:~# cat /sys/class/power_supply/axp20x-battery/voltage_max_design
4200000
Technical support and documentation manager at Olimex

vazhnov

Good, as I see Armbian already uses it in /etc/update-motd.d/30-armbian-sysinfo:

function batteryinfo() {
# Battery info for Allwinner
mainline_dir="/sys/power/axp_pmu"
legacy_dir="/sys/class/power_supply"
...

lime2:~:% bash /etc/update-motd.d/30-armbian-sysinfo
System load:   7%            Up time:       1:23
Memory usage:  6% of 998M    IP:            192.168.1.182
CPU temp:      39°C            Usage of /:    4% of 30G    Battery:       92% discharging