Fan speed control

From ArchWiki
Revision as of 02:56, 24 June 2007 by Abelstern (Talk | contribs)

Jump to: navigation, search

Fan control

Controlling the speed (and sound!) of your CPU fan is easy!

Disclaimer: 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!

Setup lm-sensors First, you need to set up lm-sensors. This is explained [here]

Once you have lm-sensors installed, you should have a readout with 'sensors'.

$ sensors
w83627hf-isa-0290
Adapter: ISA adapter
VCore 1:   +1.14 V  (min =  +0.00 V, max =  +4.08 V)              
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''

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. Increasing fan_div:

The first line of the sensors output is the chipset your motherboard uses to read the speeds/temps/voltages. Make a backup first: Code:

cp /etc/sensors.conf /etc/sensors.conf_original

Edit the /etc/sensors.conf file as root

nano /etc/sensors.conf

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.

Save, and run:

sudo 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!

You can safely ignore anything that's not fanX_div. I would advise you to leave the other default settings as they are.

Run pwmconfig

Once you have lm sensors properly configured, run pwmconfig to test and configure speed control of your fans:

pwmconfig

Follow the instructions in pwmconfig to set up speeds.

Try to run fancontrol:

/usr/sbin/fancontrol

If it's working, in order to run at boot, either:

  • Method 1: insert the following line into /etc/rc.local, before "exit 0":
/usr/sbin/fancontrol
  • Method 2: init script. Here follows an example init script, copy to /etc/rc.d/fancontrol,

make it executable by root and add "fancontrol" to the DAEMONS list in /etc/rc.conf

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

PID=`pidof -o %PPID -x /usr/sbin/fancontrol`
case "$1" in
  start)
   stat_busy "Starting fancontrol"
   [ -z "$PID" ] && /usr/sbin/fancontrol >/dev/null &
    if [  $? -gt 0 ]; then
      stat_fail
    else
      add_daemon fancontrol
      stat_done
    fi
    ;;
  stop)
	stat_busy "Stopping fancontrol"
	# If it isn't running, stop gracefully
	if [ -z "$PID" ]; then
		stat_done
	else
		kill $PID
	fi	
	rm_daemon fancontrol
	stat_done
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"  
esac


Most of this howto is from [Ubuntu forums] and [Ubuntu guide].