Fan control Linux Debian: Fancontrol

 

After I installed a fan in my NAS, it always ran at top speed. In the BIOS I could set the speed, but the automatic mode did not work properly. Using the service fancontrol the speed of the fan can be linked to any sensor and any threshold and controlled automatically.

Installing fancontrol

sudo apt-get install fancontrol lm-sensors
sudo service fancontrol start 

Reading out the temperatures

Command:

sensors

Setting the threshold values

sudo pwmconfig

Ubuntu 20.04: There are no pwm-capable sensor modules installed

sudo sensors-detect

Do you want to scan for them? This is totally safe. (YES/no): YES
Do you want to scan for Super I/O sensors? (YES/no): YES
Do you want to probe the I2C/SMBus adapters now? (YES/no): YES

..

To load everything that is needed, add this to /etc/modules: 
#----cut here---- 
# Chip drivers 
coretemp 
nct6775 
#----cut here---- 
If you have some drivers built into your kernel, the list above will 
contain too many modules. Skip the appropriate ones!
..

Do you want to add these lines automatically to /etc/modules? (yes/NO)yes

sudo pwmconfig

The script tests the individual fans and can then assign them to a temperature sensor with corresponding threshold values:

[+]
sudo pwmconfig
# pwmconfig version 3.6.0
This program will search your sensors for pulse width modulation (pwm)
controls, and test each one to see if it controls a fan on
your motherboard. Note that many motherboards do not have pwm
circuitry installed, even if your sensor chip supports pwm.

We will attempt to briefly stop each fan using the pwm controls.
The program will attempt to restore each fan to full speed
after testing. However, it is ** very important ** that you
physically verify that the fans have been to full speed
after the program has completed.

Found the following devices:
   hwmon0 is acpitz
   hwmon1 is coretemp
   hwmon2 is nct6793

Found the following PWM controls:
   hwmon2/pwm1           current value: 255
   hwmon2/pwm2           current value: 255
   hwmon2/pwm3           current value: 255
hwmon2/pwm3 is currently setup for automatic speed control.
In general, automatic mode is preferred over manual mode, as
it is more efficient and it reacts faster. Are you sure that
you want to setup this output for manual control? (n) 
   hwmon2/pwm4           current value: 255
hwmon2/pwm4 is currently setup for automatic speed control.
In general, automatic mode is preferred over manual mode, as
it is more efficient and it reacts faster. Are you sure that
you want to setup this output for manual control? (n) 
   hwmon2/pwm5           current value: 255
hwmon2/pwm5 is currently setup for automatic speed control.
In general, automatic mode is preferred over manual mode, as
it is more efficient and it reacts faster. Are you sure that
you want to setup this output for manual control? (n) 
   hwmon2/pwm6           current value: 127

Giving the fans some time to reach full speed...
Found the following fan sensors:
   hwmon2/fan1_input     current speed: 0 ... skipping!
   hwmon2/fan2_input     current speed: 2054 RPM
   hwmon2/fan3_input     current speed: 0 ... skipping!
   hwmon2/fan4_input     current speed: 0 ... skipping!
   hwmon2/fan5_input     current speed: 0 ... skipping!
   hwmon2/fan6_input     current speed: 0 ... skipping!

Warning!!! This program will stop your fans, one at a time,
for approximately 5 seconds each!!!
This may cause your processor temperature to rise!!!
If you do not want to do this hit control-C now!!!
Hit return to continue: 

Testing pwm control hwmon2/pwm1 ...
  hwmon2/fan2_input ... speed was 2054 now 2054
    no correlation

No correlations were detected.
There is either no fan connected to the output of hwmon2/pwm1,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)

Did you see/hear a fan stopping during the above test (n)? 

Testing pwm control hwmon2/pwm2 ...
  hwmon2/fan2_input ... speed was 2054 now 0
    It appears that fan hwmon2/fan2_input
    is controlled by pwm hwmon2/pwm2
Would you like to generate a detailed correlation (y)? y
Note: If you had gnuplot installed, I could generate a graphical plot.
    PWM 255 FAN 2080
    PWM 240 FAN 2076
    PWM 225 FAN 2014
    PWM 210 FAN 1909
    PWM 195 FAN 1807
    PWM 180 FAN 1664
    PWM 165 FAN 1537
    PWM 150 FAN 1412
    PWM 135 FAN 1253
    PWM 120 FAN 1073
    PWM 105 FAN 774
    PWM 90 FAN 0
    Fan Stopped at PWM = 90


Testing pwm control hwmon2/pwm6 ...
  hwmon2/fan2_input ... speed was 2054 now 2057
    no correlation

No correlations were detected.
There is either no fan connected to the output of hwmon2/pwm6,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)

Did you see/hear a fan stopping during the above test (n)? 

Testing is complete.
Please verify that all fans have returned to their normal speed.

The fancontrol script can automatically respond to temperature changes
of your system by changing fanspeeds.
Do you want to set up its configuration file now (y)? 
What should be the path to your fancontrol config file (/etc/fancontrol)? 

Select fan output to configure, or other action:
1) hwmon2/pwm2
2) Change INTERVAL
3) Just quit
4) Save and quit
5) Show configuration
select (1-n): 1

Devices:
hwmon0 is acpitz
hwmon1 is coretemp
hwmon2 is nct6793

Current temperature readings are as follows:
hwmon0/temp1_input      35
hwmon1/temp1_input      37
hwmon1/temp2_input      37
hwmon1/temp3_input      37
hwmon1/temp4_input      35
hwmon1/temp5_input      34
hwmon2/temp1_input      118
hwmon2/temp2_input      34
hwmon2/temp3_input      34
hwmon2/temp4_input      110
hwmon2/temp5_input      109
hwmon2/temp6_input      110
hwmon2/temp7_input      0
hwmon2/temp8_input      0
hwmon2/temp9_input      0

Select a temperature sensor as source for hwmon2/pwm2:
1) hwmon0/temp1_input                      4) hwmon1/temp3_input                     7) hwmon2/temp1_input                    10) hwmon2/temp4_input                    13) hwmon2/temp7_input                    16) None (Do not affect this PWM output)
2) hwmon1/temp1_input                      5) hwmon1/temp4_input                     8) hwmon2/temp2_input                    11) hwmon2/temp5_input                    14) hwmon2/temp8_input
3) hwmon1/temp2_input                      6) hwmon1/temp5_input                     9) hwmon2/temp3_input                    12) hwmon2/temp6_input                    15) hwmon2/temp9_input
select (1-n): 1   

Enter the low temperature (degree C)
below which the fan should spin at minimum speed (20): 40

Enter the high temperature (degree C)
over which the fan should spin at maximum speed (60): 50

Enter the minimum PWM value (0-255)
at which the fan STOPS spinning (press t to test) (100): 90

Enter the minimum PWM value (90-255)
at which the fan STARTS spinning (press t to test) (150): 91

Enter the PWM value (0-90) to use when the temperature
is below the low temperature limit (0): 0

Enter the PWM value (90-255) to use when the temperature
is over the high temperature limit (255): 255


Select fan output to configure, or other action:
1) hwmon2/pwm2
2) Change INTERVAL
3) Just quit
4) Save and quit
5) Show configuration
select (1-n): 4

then still:

sudo service fancontrol restart
positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Questions / Comments


By continuing to browse the site, you agree to our use of cookies. More Details