Measuring power consumption on the Librem5
I wanted to measure the power consumption of my #Librem5 and didn't have a way to measure on the power lines off usb-c.
Looking at the #schematic and at /sysfs
I found that I could use values provided by MAX17055 to get the current values when running on battery only:
watch_battery_voltage_current.sh
:
#!/bin/bash while sleep 0.05; do C=`cat /sys/devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-0036/power_supply/max170xx_battery/current_now` V=`cat /sys/devices/platform/soc@0/30800000.bus/30a50000.i2c/i2c-3/3-0036/power_supply/max170xx_battery/voltage_now` if [ "$C" != "$OLD_C" ] || [ "$V" != "$OLD_V" ]; then echo `date +'%s.%N'` $V $C fi OLD_C=$C; OLD_V=$V done
There's much room for improvement:
- get changes pushed instead of polling (seems to be only possible using C)
- getting values at BQ25895 or BD71837 to be closer to where the power is needed
Any ideas are welcome!
Using #libreoffice I made the #diagram below which shows:
- yellow vertical lines signaling a push of the power button. First line is power off the screen
- green vertical lines with a red 'shadow' showing where the xhci usb-hub vanished.
- during the period with screen on between the second and third yellow line I unloaded the xhci modules, cut the power to the modem briefly, and reloaded the modules
- the modem draws a lot more power during registration after the reset than during average operation as can be seen on the right side of the third yeelow line(green line = current, relativ)
- when a lot current is drawn the voltage (blue line) at max17055 goes down a bit
- battery slowly depleting: average voltage going down
I did this for two reasons:
- I wanted to know how much power the modem draws to be able to compare it to other modems candidates to replace the broadmobi bm818
- While doing this and chatting about it with @craftyguy@freeradical.zone he had the idea that problems with the bus or modem could be related to brownout