How to Read Board Temperature and Fan Speed

  • This method has confirmed on the following environments.
    • OS: Ubuntu 20.04 LTS
    • Kernel: 5.4.0-31 kernel from Ubuntu repository
  • We cannot confirm all other Linux distributions.

We can adjust the fan speed to the 3 target speed with the respective target temperature.

But, the temperature used in this situation is not the CPU temperature, but the board temperature. That means, if the CPU temperature reaches the target value, the fan may not speed up to the target RPM. It will take more time to see a change or cannot be worked as the parameters set ever.

That also means, if there's only the CPU temperature value, it is very hard to determine the target temperatures for the fan behavior.

This because the board temperature is measured by the EMC2103 chipset. This chipset is a RPM-based fan controller supporting programmable desired RPM/temperature/hysteresis settings.

- Here's the datasheet of the EMC2103: http://ww1.microchip.com/downloads/en/DeviceDoc/20005250.pdf

Recently, we heard that the Linux kernel offers a dedicated module for EMC2103.

- This is the original forum thread: https://forum.odroid.com/viewtopic.php?f=168&t=38520&p=292204&hilit=hysteresis#p290014

With this module, we can easily read the current EMC2103 temperature.

You can simply load emc2103 module by the following command on the Ubuntu system.

sudo modprobe emc2103

Then you can check if this module loaded or not.

lsmod | grep emc2103
joshua@joshua-ODROID-H2:~$ lsmod | grep emc2103
emc2103                20480  0

To read the current temperatures, you still can read a file corresponding to the temperature but it is recommended to install lm-sensors to check temperatures of all of the available sensors.

sudo apt install lm-sensors

Then enter sensors command.

sensors
joshua@joshua-ODROID-H2:~$ sensors
acpitz-acpi-0
Adapter: ACPI interface
temp1:        +36.0°C  (crit = +95.0°C)
 
emc2103-i2c-0-2e
Adapter: SMBus I801 adapter at f040
fan1:           FAULT  (div = 8)
temp1:        +29.9°C  (low  =  +0.0°C, high = +85.0°C)
temp2:        +29.7°C  (low  =  +0.0°C, high = +85.0°C)
temp3:        +29.9°C  (low  =  +0.0°C, high = +85.0°C)
 
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +36.0°C  (high = +105.0°C, crit = +105.0°C)
Core 0:        +36.0°C  (high = +105.0°C, crit = +105.0°C)
Core 1:        +36.0°C  (high = +105.0°C, crit = +105.0°C)
Core 2:        +36.0°C  (high = +105.0°C, crit = +105.0°C)
Core 3:        +36.0°C  (high = +105.0°C, crit = +105.0°C)

See the emc2103-i2c-0-2e part of the results. That would not be shown if emc2103 module is not loaded.

You can see the fan1: FAULT part. It is normal, if the fan is turned on, that part will change like to the below.

joshua@joshua-ODROID-H2:~$ sensors
acpitz-acpi-0
Adapter: ACPI interface
temp1:        +38.0°C  (crit = +95.0°C)
 
emc2103-i2c-0-2e
Adapter: SMBus I801 adapter at f040
fan1:        1013 RPM  (div = 8)
temp1:        +30.1°C  (low  =  +0.0°C, high = +85.0°C)
temp2:        +30.0°C  (low  =  +0.0°C, high = +85.0°C)
temp3:        +30.2°C  (low  =  +0.0°C, high = +85.0°C)
 
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +37.0°C  (high = +105.0°C, crit = +105.0°C)
Core 0:        +37.0°C  (high = +105.0°C, crit = +105.0°C)
Core 1:        +37.0°C  (high = +105.0°C, crit = +105.0°C)
Core 2:        +37.0°C  (high = +105.0°C, crit = +105.0°C)
Core 3:        +37.0°C  (high = +105.0°C, crit = +105.0°C)

In this case, the fan turned on at around 1000 RPM since the average value of those 3 temperature sensors on the board is over 30, the number is the first target step of the BIOS thermal settings. So the fan1 sensor results that 1013 RPM value.

The I2C bus number can be changed when every bootup. Seems I2C bus number is not constant. Looks like emc2103 is with I2C-0 for now but it can be with I2C-8 next time.