Sensors
Background
In order to read the sensors on your board, the package lm-sensors must be installed.
$ sudo apt update
$ sudo apt install lm-sensors
Read sensors
After installing the package ‘lm-sensros', the sensors of your ODROID can be read with the command sensors
. This command will show the current temperatures provided by CPU itself. The fan speed also can be provided when cooling fan is attached only when it provides TACH signals.
$ sensors
pwmfan-isa-0000
Adapter: ISA adapter
Default Fan: 3017 RPM
cpu_thermal-virtual-0
Adapter: Virtual device
CPU Temp: +37.7°C (crit = +110.0°C)
ddr_thermal-virtual-0
Adapter: Virtual device
DDR Temp: +39.0°C (crit = +110.0°C)
Fanspeed control
Cooling fan speed can be controlled in 3 modes - Automatic/Manual/Maximum - and one needs to access sysfs node with granted permission since changing the fan speed can.
Automatic mode
The fan speed is set by Linux kernel as defined cooling point in the device tree, this is the default.
$ echo 2 | sudo tee /sys/class/hwmon/hwmon0/pwm1_enable
Manual mode
This mode is to set the fan speed manually by a user or a service in the userspace and predefined cooling point in the kernel space will be completely ignored. So mode could be harm if the fan speed is not properly managed whenever CPU temperature is changed. The range of fan speed is from 0 to 255 where 0 as turn off and 255 as maximum speed.
$ echo 1 | sudo tee /sys/class/hwmon/hwmon0/pwm1_enable
$ echo 128 | sudo tee /sys/class/hwmon/hwmon0/pwm1
Maximum mode
This mode is to set the fan speed at its maximum speed until the fan speed mode is changed to ‘Automatic' or ‘Manual'.
$ echo 0 | sudo tee /sys/class/hwmon/hwmon0/pwm1_enable
Fanspeed control using ‘fancontrol'
$ sudo apt update
$ sudo apt install fancontrol
To make sure fancontrol is started at system startup enable the service.
$ sudo systemctl enable fancontrol
Fancontrol can be configured using pwmconfig. It provides a guided questionaire for tuning the fan speed. The configuration should be saved to /etc/fancontrol
$ sudo pwmconfig
Once the configuration has been saved, restart the fancontrol service to apply changes.
$ sudo systemctl restart fancontrol
Sample config for ODROID-HC4 fan
The following fancontrol configuration was created for an ODROID-HC4 (/etc/fancontrol
)
# !!!USE AT YOUR OWN RISK!!! Configuration file generated by pwmconfig
INTERVAL=10
DEVPATH=hwmon0=devices/virtual/thermal/thermal_zone0 hwmon2=devices/platform/pwm-fan
DEVNAME=hwmon0=cpu_thermal hwmon2=pwmfan
FCTEMPS= hwmon2/pwm1=hwmon0/temp1_input
FCFANS= hwmon2/pwm1=hwmon2/fan1_input
MINTEMP= hwmon2/pwm1=35
MAXTEMP= hwmon2/pwm1=70
MINSTART= hwmon2/pwm1=10
MINSTOP= hwmon2/pwm1=10
MINPWM= hwmon2/pwm1=10
With an ambiant temperature of 22 °C these settings keep the max temp at ~53.8 °C during sysbench cpu run --cpu-max-prime=100000000 --threads=4
which ran for 397 seconds, thus ensuring saturation. During the run the fan spins up to ~2800 RPM producing a slightly noticable but not in any way annoying hum. When idle (serving an instance of NextcloudPi to ~5 users, mdadm software RAID 1, 2 Seagate Ironwolf HDDs) the CPU temperature hovered around 47 °C with the fan inaudible at ~1600 RPM. All temperatures and RPM measurements were acquired with lm-sensors