Results 1 to 10 of 120

Thread: HOWTO: Fancontrol

Threaded View

  1. #1
    Join Date
    Jan 2005

    HOWTO: Fancontrol

    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!

    Update Nov 7, 2007: this still works in Gutsy Gibbon! Hurray!

    Setup lm-sensors
    First, you need to set up lm-sensors. This is explained here. That's for Warty, but still works under Hoary.

    Once you have lm-sensors installed, you should have a readout with 'sensors'
    $ sensors
    Adapter: ISA adapter
    VCore:     +1.54 V  (min =  +1.69 V, max =  +1.86 V)              
    +12V:     +11.67 V  (min = +10.82 V, max = +13.19 V)              
    +3.3V:     +3.42 V  (min =  +3.14 V, max =  +3.47 V)              
    +5V:       +5.15 V  (min =  +4.75 V, max =  +5.25 V)              
    -12V:     -14.91 V  (min = -10.80 V, max = -13.18 V)              
    V5SB:      +5.05 V  (min =  +4.76 V, max =  +5.24 V)              
    VBat:      +0.06 V  (min =  +2.40 V, max =  +3.60 V)              
    fan1:        0 RPM  (min = 18750 RPM, div = 8)                     
    CPU Fan:  1188 RPM  (min = 18750 RPM, div = 8)                     
    fan3:        0 RPM  (min = 19285 RPM, div = 1)                     
    M/B Temp:    +31°C  (high =   -73°C, hyst =   +21°C)   sensor = thermistor           
    CPU Temp:  +50.0°C  (high =   +80°C, hyst =   +75°C)   sensor = thermistor           
    temp3:     +15.0°C  (high =   +80°C, hyst =   +75°C)   sensor = thermistor           
    vid:      +1.775 V  (VRM Version 9.0)
              Sound alarm enabled
    Adapter: SMBus Via Pro adapter at 0400
    Memory type:            DDR SDRAM DIMM
    Memory size (MB):       256
    Adapter: SMBus Via Pro adapter at 0400
    Memory type:            DDR SDRAM DIMM
    Memory size (MB):       256
    Notice that my CPU fan is running really slowly, only 1100 RPM. The CPU temp is a little high, so I need to do some tweaking of the config there. The fan can run so slowly and quietly, because it's a large 12 cm fan made by Zalman (it's the 7000B AlCu). 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:
    $ sudo cp /etc/sensors.conf /etc/sensors.conf_original
    Edit the /etc/sensors.conf file as root
    $ sudo gedit /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!

    Here is a sample from my sensors.conf
    chip "w83627thf-*" "w83637hf-*"
        label in0 "VCore"
        label in1 "+12V"
        label in2 "+3.3V"
        label in3 "+5V"
        label in4 "-12V"
        label in7 "V5SB"
        label in8 "VBat"
        compute in1 ((28/10)+1)*@, @/((28/10)+1)
        compute in3 ((34/51)+1)*@, @/((34/51)+1)
        compute in4 (5.14*@)-14.91, (@+14.91)/5.14
        compute in7 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)
        set fan2_div 8
    You can safely ignore anything that's not fanX_div. I would advise you to leave the other default settings as they are.

    Patching pwmconfig This is no longer needed if you run Dapper! Go to the next step unless you're running Hoary.
    There is a bug in pwmconfig that you need to fix.
    This is true for the version currently in Hoary, version 2.8.8-7ubuntu2.

    First, try running pwmconfig:
    $ pwmconfig
    if that gives you the following error:
    /usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed
    than you need to apply this fix. If not, proceed to the next step.

    $ sudo cp /usr/sbin/pwmconfig /usr/sbin/pwmconfig_original
    Open pwmconfig:
    $ sudo gedit /usr/sbin/pwmconfig
    and go to line 68. Delete these three lines:
    and replace with:
    You just turned the if/else around! Now pwmconfig should work.

    Run pwmconfig
    $ sudo pwmconfig
    One by one, all fans will be tested for 'speedcontrol' (Pulse Width Modulation, actually). Follow the onscreen help. Pwmconfig will write a config file in /etc. I set the interval to 5 seconds, just to be safe, but 10 should be fine too. Let the script run until you see "Select fan output to configure, or other action:" (all default options are fine, you can basically enter you way through the script).

    Now press 5 to look at the configuration file. Press 1 to edit settings. Select a temperature that matches your CPU temp (usually the same number as the fan number, but check and double check!). Go with the defaults until you see: "Enter the minimum PWM value (0-255)
    at which the fan STARTS spinning (press t to test) (150):"
    Here, press t.
    Keep pressing enter until you hear (or better: see) the fan spinning up. Then, press y and enter.
    Same for the next step, but the other way around. If you see the fan stops spinning, press y and enter.

    Press 5 again to display the config file one more time, then press 4 to save and quit. Almost there!

    My /etc/fancontrol config looks like this:
    FCTEMPS= 1-0290/pwm2=1-0290/temp2_input
    FCFANS= 1-0290/pwm2=1-0290/fan2_input
    MINTEMP= 1-0290/pwm2=43
    MAXTEMP= 1-0290/pwm2=53
    MINSTART= 1-0290/pwm2=120
    MINSTOP= 1-0290/pwm2=105
    this is an example!

    Starting fancontrol
    The last step is to start up fancontrol. Enter this:
    $ sudo fancontrol &
    Now you can see and hear that your CPU fan is running slower, unless your CPU heats up. Good stuff!

    [B}Starting fancontrol automatically on boot[/B]
    Create a file called "fancontrol" in /etc/init.d:
    sudo gedit /etc/init.d/fancontrol
    And paste this in there:
    # Fancontrol start script.
    set -e
    # Defaults
    test -f $DAEMON || exit 0
    . /lib/lsb/init-functions
    case "$1" in
                    log_begin_msg "Starting fancontrol daemon..."
                    start-stop-daemon --start -o -q -m -b -p $PIDFILE -x $DAEMON
                    log_end_msg $?
                    log_begin_msg "Stopping fancontrol daemon..."
                    start-stop-daemon --stop -o -q -p $PIDFILE
                    log_end_msg $?
                    sh $0 stop
                    sh $0 start
                    log_success_msg "Usage: /etc/init.d/fancontrol {start|stop|restart|force-reload}"
                    log_success_msg "  start - starts system-wide fancontrol service"
                    log_success_msg "  stop  - stops system-wide fancontrol service"
                    log_success_msg "  restart, force-reload - starts a new system-wide fancontrol service"
                    exit 1
    exit 0
    Save and close, then run
    sudo update-rc.d fancontrol defaults 99 01
    and you should be set.

    (Thanks, Mr Wonka and jotape99!)

    I would advise you to have some sort of fan/temp monitoring software installed. There is a nice one in gkrellm, or you can use xsensors.

    Most of this howto is from here:
    Check if your hardware is supported here:
    Last edited by remmelt; November 7th, 2007 at 01:29 PM. Reason: Added automatic startup on boot


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts