Difference between revisions of "Fan speed control"

From ArchWiki
Jump to: navigation, search
(added reference to bug #17775)
m
(34 intermediate revisions by 12 users not shown)
Line 1: Line 1:
[[Category:CPU (English)]]
+
{{Expansion|This is a bare-bones article. Additional details would help new users.}}
[[Category:HOWTOs  (English)]]
+
  
{{i18n_links_start}}
+
[[Category:CPU]]
{{i18n_entry|English|Fan speed control}}
+
[[it:Fan Speed Control]]
{{i18n_entry|Русский|Контроль скорости кулера}}
+
[[ru:Fan Speed Control]]
{{i18n_entry|Italiano|Controllo ventola CPU}}
+
{{i18n_links_end}}
+
  
Controlling the speed (and sound!) of your CPU fan is easy!
+
{{Article summary start}}
 +
{{Article summary text|Fancontrol, part of {{Pkg|lm_sensors}}, can be used to control the speed and sound of CPU/case fans.  This article covers configuration/setup of the utility}}
 +
{{Article summary heading|Related}}
 +
{{Article summary wiki|Lm_sensors}}
 +
{{Article summary end}}
  
'''This can ruin your hardware. A CPU fan is needed to cool your CPU and in this howto it will be turned off for a couple of seconds. If you are not comfortable with doing this, don't!''''
+
=== Preface ===
 +
Support for newer motherboards may not yet be in the linux kernel.  Check the official [http://www.lm-sensors.org/wiki/Devices lm-sensors devices] table to see if experimental drivers are available for such motherboards.  At the time this statement was written for example, support for the Asus P8Z77 series of motherboards was not mainlined, yet {{AUR|nct677x-git}} was available in the [[AUR]].
  
=== lm-sensors ===
+
It is recommended not to use lm_sensors.service to load the needed modules for fancontrol.  Instead, manually place them in {{ic|/etc/modules-load.d/load_these.conf}} since the order in which these modules are loaded dictate the order in which the needed symlinks for hwmon get created.  In other words, using the lm_sensors.service causes inconsistencies boot-to-boot which will render the configuration file for fancontrol worthless for a consistency point of view.
  
First, you need to set up lm-sensors. This is explained [[Lm_sensors|here]]
+
For more, see this thread: https://bbs.archlinux.org/viewtopic.php?pid=1251766
  
Once you have lm-sensors installed, you should have a readout with 'sensors'.
+
=== lm-sensors ===
 +
Set up [[Lm_sensors|lm_sensors]].
  
 
<pre>$ sensors
 
<pre>$ sensors
w83627hf-isa-0290
+
coretemp-isa-0000
 
Adapter: ISA adapter
 
Adapter: ISA adapter
VCore 1:  +1.14 V  (min =  +0.00 V, max =  +4.08 V)             
+
Core 0:      +29.0°C (high = +76.0°C, crit = +100.0°C)   
VCore 2:  +2.67 V  (min =  +0.00 V, max =  +4.08 V)             
+
+3.3V:    +3.39 V  (min =  +2.82 V, max =  +3.79 V)             
+
+5V:      +5.19 V  (min =  +3.47 V, max =  +0.40 V)      ALARM 
+
+12V:    +12.40 V  (min = +12.95 V, max =  +7.96 V)      ALARM 
+
-12V:      -7.01 V  (min =  +1.78 V, max = -10.63 V)      ALARM 
+
-5V:      -3.84 V  (min =  -7.66 V, max =  +2.29 V)             
+
V5SB:      +5.75 V  (min =  +0.08 V, max =  +0.54 V)      ALARM 
+
VBat:      +3.10 V  (min =  +0.54 V, max =  +0.13 V)      ALARM 
+
fan1:    2428 RPM  (min =    0 RPM, div = 4)                   
+
fan2:        0 RPM  (min = 1630 RPM, div = 4)              ALARM 
+
fan3:    2191 RPM  (min = 6367 RPM, div = 4)              ALARM 
+
temp1:      +38°C (high =   +20°C, hyst =  +68°C)  sensor = thermistor         
+
temp2:    +39.5°C  (high =  +65°C, hyst =   +60°C)  sensor = diode         
+
temp3:    +38.0°C (high =  +65°C, hyst =  +60°C)   sensor = thermistor          (beep)
+
vid:      +0.000 V (VRM Version 2.4)
+
alarms: 
+
beep_enable:
+
          Sound alarm enabled''
+
</pre>
+
  
If your output does not display an RPM for your CPU fan, and you are positive it is running, you need to increase the fan divisor. If your fan speed is shown and higher than 0, skip the next step.
+
coretemp-isa-0001
'''
+
Adapter: ISA adapter
Increasing fan_div:'''
+
Core 1:     +29.0°C  (high = +76.0°C, crit = +100.0°C) 
  
The first line of the sensors output is the chipset your motherboard uses to read the speeds/temps/voltages. Make a backup first:
+
coretemp-isa-0002
Code:
+
Adapter: ISA adapter
 +
Core 2:     +31.0°C  (high = +76.0°C, crit = +100.0°C) 
  
<pre>cp /etc/sensors.conf /etc/sensors.conf_original</pre>
+
coretemp-isa-0003
 +
Adapter: ISA adapter
 +
Core 3:      +29.0°C  (high = +76.0°C, crit = +100.0°C) 
  
Edit the /etc/sensors.conf file as root
+
it8718-isa-0290
 +
Adapter: ISA adapter
 +
Vcc:        +1.14 V  (min =  +0.00 V, max =  +4.08 V) 
 +
VTT:        +2.08 V  (min =  +0.00 V, max =  +4.08 V) 
 +
+3.3V:      +3.33 V  (min =  +0.00 V, max =  +4.08 V) 
 +
NB Vcore:    +0.03 V  (min =  +0.00 V, max =  +4.08 V) 
 +
VDRAM:      +2.13 V  (min =  +0.00 V, max =  +4.08 V) 
 +
fan1:        690 RPM  (min =  10 RPM)
 +
temp1:      +37.5°C  (low  = +129.5°C, high = +129.5°C)  sensor = thermistor
 +
temp2:      +25.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermal diode
 +
</pre>
  
<pre>nano /etc/sensors.conf</pre>
+
If the output does not display an RPM value for the CPU fan, one may need to increase the fan divisor. If fan speed is shown and higher than 0, skip the next step.
  
and look up your exact chipset. The names all look alike, so make sure the one you are editing is yours. Add the line fanX_div 4 near the start of your chipset config. Replace the X with the number of your CPU fan's, for me that was 2. You have to figure out for yourself which one it is, but it's probably 1, 2 or 3.
+
====Increasing fan_div====
 +
The first line of the sensors output is the chipset used by the motherboard for readings of temperatures and voltages.  
  
Save, and run:
+
Edit {{ic|/etc/sensors.d/sensors.conf}} and look up the exact chipset. A few chipset names are similar, so make sure the one to edit is correct. Add the line 'set fanX_div 4' near the start of the chipset config, replacing X with the number of CPU fans in the target system.
  
<pre>sudo sensors -s</pre>
+
Save the file, and run as root:
 +
# sensors -s
  
 
which will reload the sensors.conf's set variables.
 
which will reload the sensors.conf's set variables.
 
Run sensors again and check if there is an RPM readout. If not, increase the divisor to 8, 16 or 32. YMMV!
 
Run sensors again and check if there is an RPM readout. If not, increase the divisor to 8, 16 or 32. YMMV!
 
You can safely ignore anything that's not fanX_div. I would advise you to leave the other default settings as they are.
 
  
 
=== pwmconfig ===
 
=== pwmconfig ===
  
Once you have lm sensors properly configured, run pwmconfig to test and configure speed control of your fans:
+
{{Note|Advanced users may want to skip this section and write {{ic|/etc/fancontrol}} on their own, which also saves them from hearing all of the fans at full speed.}}
<pre>pwmconfig</pre>
+
  
Follow the instructions in pwmconfig to set up basic speeds.
+
Once sensors is properly configured, run {{Ic|pwmconfig}} to test and configure speed control.  Follow the instructions in {{Ic|pwmconfig}} to set up basic speeds. The default configuration options should create a new file, {{ic|/etc/fancontrol}}.
 
+
The default configuration options should create a new file, <tt>/etc/fancontrol</tt>. 
+
 
+
Follow the instructions in pwmconfig to set up speeds.
+
  
 
==== Tweaking ====
 
==== Tweaking ====
  
<strong>Second warning:</strong> Some of the steps outlined below describe how to tweak fan speeds. Before doing this be sure you have a low cpu load and are comfortable playing around. If at any time during tweaking you notice the CPU temperature start to rise dramatically, do a <tt>echo "255" > /sys/class/hwmon/hwmon0/device/pwm1</tt> to spin up the fan all the way until things cool down.  Basically, you should know what your doing before fooling with the configuration file
+
{{Warning|Some of the steps outlined below describe how to tweak fan speeds. Before doing this be sure to have a low CPU load.}}
  
If your want more control, you probably will need to tweak the generated configuration in order get the results you expectHere is a sample configuration file:
+
{{Note|On several systems, the included script may report errors as it trys to calibrate fans to the respective PWMUsers may safely ignore these errors. The problem is that the script does not wait long enough before ramping up or down the PWM.}}
  
<pre>
+
Users wishing more more control may need to tweak the generated configuration. Here is a sample configuration file:
INTERVAL=10
+
INTERVAL=10
FCTEMPS=hwmon0/device/pwm1=hwmon0/device/temp1_input
+
DEVPATH=hwmon0=devices/platform/coretemp.0 hwmon2=devices/platform/w83627ehf.656
FCFANS= hwmon0/device/pwm1=hwmon0/device/fan1_input
+
DEVNAME=hwmon0=coretemp hwmon2=w83627dhg
MINTEMP=hwmon0/device/pwm1=20
+
FCTEMPS=hwmon0/device/pwm1=hwmon0/device/temp1_input
MAXTEMP=hwmon0/device/pwm1=55
+
FCFANS= hwmon0/device/pwm1=hwmon0/device/fan1_input
MINSTART=hwmon0/device/pwm1=150
+
MINTEMP=hwmon0/device/pwm1=20
MINSTOP=hwmon0/device/pwm1=105
+
MAXTEMP=hwmon0/device/pwm1=55
</pre>
+
MINSTART=hwmon0/device/pwm1=150
 +
MINSTOP=hwmon0/device/pwm1=105
  
* <strong>INTERVAL</strong>: how often the daemon should poll cpu temps and adjust fan speeds. Interval is in seconds.
+
* '''INTERVAL''': how often the daemon should poll CPU temps and adjust fan speeds. INTERVAL is in seconds.
  
The rest of the configuration file is split into (at least) two values per configuration option. Each configuration option first points to a PWM device which is written to which sets the fan speed.  The second "field" is the actual value to set. This allows you to monitor and control multiple fans and temperatures (if your pc supports it).
+
The rest of the configuration file is split into (at least) two values per configuration option. Each configuration option first points to a PWM device which is written to which sets the fan speed.  The second "field" is the actual value to set. This allows monitoring and controlling multiple fans and temperatures.
  
* <strong>FCTEMPS</strong>: The temperature input device to read for cpu temperature.  The above example corresponds to <tt>/sys/class/hwmon/hwmon0/device/temp1_input</tt>.
+
* '''FCTEMPS''': The temperature input device to read for cpu temperature.  The above example corresponds to {{Ic|/sys/class/hwmon/hwmon0/device/temp1_input}}.
* <strong>FCFANS</strong>: The current fan speed, which can be read (like the temperature) in <tt>/sys/class/hwmon/hwmon0/device/fan1_input</tt>
+
* '''FCFANS''': The current fan speed, which can be read (like the temperature) in {{Ic|/sys/class/hwmon/hwmon0/device/fan1_input}}
* <strong>MINTEMP</strong>: The temperature (&deg;C) at which to <em>SHUT OFF</em> the cpu fan.  Efficicent CPU's often will not need a fan while idling. Be sure to set this to a temperature that you <em>know</em> is safe. Setting this to 0 is not reccommended, use a sane value.
+
* '''MINTEMP''': The temperature (&deg;C) at which to '''SHUT OFF''' the CPU fan.  Efficient CPUs often will not need a fan while idling. Be sure to set this to a temperature that ''you know is safe''. Setting this to 0 is not recommended and may ruin your hardware!
* <strong>MAXTEMP</strong>: The temperature (&deg;C) at which to spin the fan at it's <em>MAXIMUM</em> speed.  This should be probably be set to perhaps 10 or 20 degrees (&deg;C) below your CPU's critical/shutdown temperature. Setting it closer to MINTEMP will result in higher fan speeds overall.
+
* '''MAXTEMP''': The temperature (&deg;C) at which to spin the fan at its ''MAXIMUM'' speed.  This should be probably be set to perhaps 10 or 20 degrees (&deg;C) below your CPU's critical/shutdown temperature. Setting it closer to MINTEMP will result in higher fan speeds overall.
* <strong>MINSTOP</strong>: The PWM value at which your fan stops spinning.  Each fan is a little different.  Power tweakers can <tt>cat</tt> different values (between 0 and 255) to <tt>/sys/class/hwmon/hwmon0/device/pwm1</tt> and then watch the cpu fan.  When it stops, use this value.
+
* '''MINSTOP''': The PWM value at which your fan stops spinning.  Each fan is a little different.  Power tweakers can {{Ic|echo}} different values (between 0 and 255) to {{ic|/sys/class/hwmon/hwmon0/device/pwm1}} and then watch the CPU fan.  When the CPU fan stops, use this value.
* <strong>MINSTART</strong>: The PWM value at which your fan starts to spin again.  This is often a higher value than MINSTOP as more voltage is required to overcome inertia.
+
* '''MINSTART''': The PWM value at which your fan starts to spin again.  This is often a higher value than MINSTOP as more voltage is required to overcome inertia.
  
=== fancontrol ===
+
There are also two settings fancontrol needs to verify the configuration file is still up to date. The lines start with the setting name and a equality sign, followed by groups of hwmon-class-device=setting, seperated by spaces. You need to specify each setting for each hwmon class device you use anywhere in the config, or fancontrol will not work.
  
Try to run fancontrol:
+
* '''DEVPATH''': Sets the physical device. You can determine this by executing the command
<pre>/usr/sbin/fancontrol</pre>
+
readlink -f /sys/class/hwmon/<hwmon-device>/device | sed -e 's/^\/sys\///'
 +
* '''DEVNAME''': Sets the name of the device. Try
 +
cat /sys/class/hwmon/<hwmon-device>/device/name | sed -e 's/[[:space:]=]/_/g'
  
Also notice this bug: [http://bugs.archlinux.org/task/17775] (Initscript outputs FAIL when it should be DONE)
+
{{Tip|Use '''MAXPWM''' and '''MINPWM''' options that limit fan speed range. See {{Ic|man fancontrol}} for details.}}
  
It should start up and you'll probably hear your CPU fans spin down.
+
=== fancontrol ===
  
If it's working, in order to run at boot simply add "fancontrol" to DAEMONS in /etc/rc.conf, as
+
Try to run fancontrol:
a fancontrol init script is now provided by default!
+
# /usr/sbin/fancontrol
  
''Most of this howto is from [[http://ubuntuforums.org/ Ubuntu forums]] and [[http://ubuntuguide.org/ Ubuntu guide]].''
+
A properly configured setup will not error out and will take control of system fans.  Users should hear system fans slowing shortly after executing this command.
  
For Dell Latitude/Inspiron laptops, you may want to use i8kutils/i8kmon.
+
{{Note|For Dell Latitude/Inspiron laptops, {{Pkg|i8kutils}}/{{Pkg|i8kmon}} are available. Note that these two packages do ''not'' work on the Inspiron 1764.}}

Revision as of 14:58, 30 March 2013

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: This is a bare-bones article. Additional details would help new users. (Discuss in Talk:Fan speed control#)
Summary help replacing me
Fancontrol, part of lm_sensors, can be used to control the speed and sound of CPU/case fans. This article covers configuration/setup of the utility
Related
Lm_sensors

Preface

Support for newer motherboards may not yet be in the linux kernel. Check the official lm-sensors devices table to see if experimental drivers are available for such motherboards. At the time this statement was written for example, support for the Asus P8Z77 series of motherboards was not mainlined, yet nct677x-gitAUR was available in the AUR.

It is recommended not to use lm_sensors.service to load the needed modules for fancontrol. Instead, manually place them in /etc/modules-load.d/load_these.conf since the order in which these modules are loaded dictate the order in which the needed symlinks for hwmon get created. In other words, using the lm_sensors.service causes inconsistencies boot-to-boot which will render the configuration file for fancontrol worthless for a consistency point of view.

For more, see this thread: https://bbs.archlinux.org/viewtopic.php?pid=1251766

lm-sensors

Set up lm_sensors.

$ sensors
coretemp-isa-0000
Adapter: ISA adapter
Core 0:      +29.0°C  (high = +76.0°C, crit = +100.0°C)  

coretemp-isa-0001
Adapter: ISA adapter
Core 1:      +29.0°C  (high = +76.0°C, crit = +100.0°C)  

coretemp-isa-0002
Adapter: ISA adapter
Core 2:      +31.0°C  (high = +76.0°C, crit = +100.0°C)  

coretemp-isa-0003
Adapter: ISA adapter
Core 3:      +29.0°C  (high = +76.0°C, crit = +100.0°C)  

it8718-isa-0290
Adapter: ISA adapter
Vcc:         +1.14 V  (min =  +0.00 V, max =  +4.08 V)   
VTT:         +2.08 V  (min =  +0.00 V, max =  +4.08 V)   
+3.3V:       +3.33 V  (min =  +0.00 V, max =  +4.08 V)   
NB Vcore:    +0.03 V  (min =  +0.00 V, max =  +4.08 V)   
VDRAM:       +2.13 V  (min =  +0.00 V, max =  +4.08 V)   
fan1:        690 RPM  (min =   10 RPM)
temp1:       +37.5°C  (low  = +129.5°C, high = +129.5°C)  sensor = thermistor
temp2:       +25.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermal diode

If the output does not display an RPM value for the CPU fan, one may need to increase the fan divisor. If fan speed is shown and higher than 0, skip the next step.

Increasing fan_div

The first line of the sensors output is the chipset used by the motherboard for readings of temperatures and voltages.

Edit /etc/sensors.d/sensors.conf and look up the exact chipset. A few chipset names are similar, so make sure the one to edit is correct. Add the line 'set fanX_div 4' near the start of the chipset config, replacing X with the number of CPU fans in the target system.

Save the file, and run as root:

# sensors -s

which will reload the sensors.conf's set variables. Run sensors again and check if there is an RPM readout. If not, increase the divisor to 8, 16 or 32. YMMV!

pwmconfig

Note: Advanced users may want to skip this section and write /etc/fancontrol on their own, which also saves them from hearing all of the fans at full speed.

Once sensors is properly configured, run pwmconfig to test and configure speed control. Follow the instructions in pwmconfig to set up basic speeds. The default configuration options should create a new file, /etc/fancontrol.

Tweaking

Warning: Some of the steps outlined below describe how to tweak fan speeds. Before doing this be sure to have a low CPU load.
Note: On several systems, the included script may report errors as it trys to calibrate fans to the respective PWM. Users may safely ignore these errors. The problem is that the script does not wait long enough before ramping up or down the PWM.

Users wishing more more control may need to tweak the generated configuration. Here is a sample configuration file:

INTERVAL=10
DEVPATH=hwmon0=devices/platform/coretemp.0 hwmon2=devices/platform/w83627ehf.656
DEVNAME=hwmon0=coretemp hwmon2=w83627dhg
FCTEMPS=hwmon0/device/pwm1=hwmon0/device/temp1_input
FCFANS= hwmon0/device/pwm1=hwmon0/device/fan1_input
MINTEMP=hwmon0/device/pwm1=20
MAXTEMP=hwmon0/device/pwm1=55
MINSTART=hwmon0/device/pwm1=150
MINSTOP=hwmon0/device/pwm1=105
  • INTERVAL: how often the daemon should poll CPU temps and adjust fan speeds. INTERVAL is in seconds.

The rest of the configuration file is split into (at least) two values per configuration option. Each configuration option first points to a PWM device which is written to which sets the fan speed. The second "field" is the actual value to set. This allows monitoring and controlling multiple fans and temperatures.

  • FCTEMPS: The temperature input device to read for cpu temperature. The above example corresponds to /sys/class/hwmon/hwmon0/device/temp1_input.
  • FCFANS: The current fan speed, which can be read (like the temperature) in /sys/class/hwmon/hwmon0/device/fan1_input
  • MINTEMP: The temperature (°C) at which to SHUT OFF the CPU fan. Efficient CPUs often will not need a fan while idling. Be sure to set this to a temperature that you know is safe. Setting this to 0 is not recommended and may ruin your hardware!
  • MAXTEMP: The temperature (°C) at which to spin the fan at its MAXIMUM speed. This should be probably be set to perhaps 10 or 20 degrees (°C) below your CPU's critical/shutdown temperature. Setting it closer to MINTEMP will result in higher fan speeds overall.
  • MINSTOP: The PWM value at which your fan stops spinning. Each fan is a little different. Power tweakers can echo different values (between 0 and 255) to /sys/class/hwmon/hwmon0/device/pwm1 and then watch the CPU fan. When the CPU fan stops, use this value.
  • MINSTART: The PWM value at which your fan starts to spin again. This is often a higher value than MINSTOP as more voltage is required to overcome inertia.

There are also two settings fancontrol needs to verify the configuration file is still up to date. The lines start with the setting name and a equality sign, followed by groups of hwmon-class-device=setting, seperated by spaces. You need to specify each setting for each hwmon class device you use anywhere in the config, or fancontrol will not work.

  • DEVPATH: Sets the physical device. You can determine this by executing the command
readlink -f /sys/class/hwmon/<hwmon-device>/device | sed -e 's/^\/sys\///'
  • DEVNAME: Sets the name of the device. Try
cat /sys/class/hwmon/<hwmon-device>/device/name | sed -e 's/[[:space:]=]/_/g'
Tip: Use MAXPWM and MINPWM options that limit fan speed range. See man fancontrol for details.

fancontrol

Try to run fancontrol:

# /usr/sbin/fancontrol

A properly configured setup will not error out and will take control of system fans. Users should hear system fans slowing shortly after executing this command.

Note: For Dell Latitude/Inspiron laptops, i8kutils/i8kmon are available. Note that these two packages do not work on the Inspiron 1764.