RPi-Monitor is a self monitoring application designed to run on Raspberry Pi.
With a few adjustments it can also be used on numerous sunxi devices that are using the A10, A13 or A20 SoC since they all feature the same power management unit AXP209.
All you have to do is to relink RPi-Monitor's data.conf
to sunxi_axp209.conf
, ensure that /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh
is running as root and restart the rpimonitor service/daemon afterwards:
# stop rpimonitor
ln -f -s /etc/rpimonitor/template/sunxi_axp209.conf /etc/rpimonitor/data.conf
nohup /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh &
# start rpimonitor
You should ensure that the sunxi-temp-daemon.sh
daemon is started at boot, eg. by adding /usr/share/rpimonitor/scripts/sunxi-temp-daemon.sh &
to /etc/rc.local
or creating an appropriate systemd service. We chose a daemon approach since otherwise it wasn't possible to gather thermal values of connected SATA disks and the SoC's temperature under high load. Now the daemon collects these thermal values in a loop and writes them to 3 files below /tmp/ where they can be fetched by rpimonitor.
If you use a SATA disk and want its temperature to be monitored you'll need to install the hddtemp package since the daemon relies on the /usr/sbin/hddtemp
binary. If you've a USB disk instead that is able to be queried using S.M.A.R.T. then you might install the smartmontools package and replace the hddtemp
call in sunxi-temp-daemon.sh
with an appropriate smartctl -d
call:
/usr/sbin/smartctl -d sat|usbsunplus|usbcypress|usbjmicron|usbprolific -a /dev/sda | awk -F" " '/Temperature_Cel/ {print $10}'
You've to try out which expressions work for your combination of USB enclosure and disk since different enclosures can be accessed differently and temperature S.M.A.R.T. attributes aren't standardized. Still using hddtemp
is recommended since it doesn't wake up disks that are in standby/sleep mode. Using smartctl
you can create data sources for any other relevant S.M.A.R.T. attribute you're interested in, especially those related to drive health. But this is left as an excercise for the reader and a better job for smartd.
Most informations regarding the power management unit rely on the ability to query the AXP209 via I2C/sysfs. A driver for kernel 3.4 provides internal PMU informations below /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/
but unfortunately this is still missing in mainline kernel.
Informations regarding cpufreq settings (CPU clock speed, governor) can only be queried if cpufreq support is built into the kernel. This should apply to all 3.4.x kernels used nowadays and with mainline kernel starting with 4.0 for A10/A13/A20 too.
If you use mainline kernel 4.0 or above the SoC's temperature will be read out using /sys/class/thermal/thermal_zone0/temp
. If you've applied the patches at the bottom of this page and installed the lm-sensors package it should be possible to read out at least the AXP209's internal thermal sensor (that is more reliable than the SoC's) when using mainline kernel.
Author: Thomas Kaiser