Blame doc/fancontrol.txt

Packit 53d5b6
Packit 53d5b6
fancontrol - automated software based fan speed regulation
Packit 53d5b6
Packit 53d5b6
Packit 53d5b6
Introduction
Packit 53d5b6
Packit 53d5b6
fancontrol is a shellscript for use with lm_sensors. It reads its
Packit 53d5b6
configuration from a file, then calculates fan speeds from temperatures and
Packit 53d5b6
sets the corresponding pwm outputs to the computed values.  It is included in
Packit 53d5b6
lm_sensors since version 2.8.0. For easy configuration, there's a script
Packit 53d5b6
named pwmconfig which lets you interactively write your configuration file for
Packit 53d5b6
fancontrol. Alternatively you can write this file yourself using the
Packit 53d5b6
information from the configuration section of this document.
Packit 53d5b6
Packit 53d5b6
Please be careful when using the fan control features of your mainboard, in
Packit 53d5b6
addition to the risk of burning your CPU, at higher temperatures there will be
Packit 53d5b6
a higher wearout of your other hardware components, too. So if you plan to use
Packit 53d5b6
these components in 50 years, _maybe_ you shouldn't use fancontrol/your
Packit 53d5b6
hardware at all.  Also please keep in mind most fans aren't designed to be
Packit 53d5b6
powered by a PWMed voltage, for more detailed information on this I recommend
Packit 53d5b6
this appnote: http://www.maxim-ic.com/appnotes.cfm/appnote_number/707
Packit 53d5b6
In practice it doesn't seem to be a major issue, the fans will get slightly
Packit 53d5b6
warmer, just be sure to have a temperature alarm and/or shutdown call, in case
Packit 53d5b6
some fan fails, because you probably won't hear it anymore ;)
Packit 53d5b6
Packit 53d5b6
Configuration
Packit 53d5b6
Packit 53d5b6
Since most of you are going to use the pwmconfig script, the config
Packit 53d5b6
file syntax will be discussed last. First I'm going to describe the various
Packit 53d5b6
variables available for changing fancontrol's behaviour:
Packit 53d5b6
Packit 53d5b6
INTERVAL
Packit 53d5b6
	This variable defines at which interval in seconds the main loop of
Packit 53d5b6
	fancontrol will be executed
Packit 53d5b6
Packit 53d5b6
FCTEMPS
Packit 53d5b6
	Maps pwm outputs to temperature sensors so fancontrol knows which
Packit 53d5b6
	temperature sensors should be used for calculation of new values for
Packit 53d5b6
	the corresponding pwm outputs.
Packit 53d5b6
Packit 53d5b6
FCFANS
Packit 53d5b6
	FCFANS records the association between a pwm and a fan.
Packit 53d5b6
	Then fancontrol can check the fan speed and restart it if it
Packit 53d5b6
	stops unexpectedly.
Packit 53d5b6
Packit 53d5b6
MINTEMP
Packit 53d5b6
	The temperature below which the fan gets switched to minimum speed.
Packit 53d5b6
Packit 53d5b6
MAXTEMP
Packit 53d5b6
	The temperature over which the fan gets switched to maximum speed.
Packit 53d5b6
Packit 53d5b6
MINSTART
Packit 53d5b6
	Sets the minimum speed at which the fan begins spinning. You should
Packit 53d5b6
	use a safe value to be sure it works, even when the fan gets old.
Packit 53d5b6
Packit 53d5b6
MINSTOP
Packit 53d5b6
	The minimum speed at which the fan still spins. Use a safe value here,
Packit 53d5b6
	too.
Packit 53d5b6
Packit 53d5b6
MINPWM
Packit 53d5b6
	The PWM value to use when the temperature is below MINTEMP.
Packit 53d5b6
	Typically, this will be either 0 if it is OK for the fan to plain
Packit 53d5b6
	stop, or the same value as MINSTOP if you don't want the fan to
Packit 53d5b6
	ever stop.
Packit 53d5b6
	If this value isn't defined, it defaults to 0 (stopped fan).
Packit 53d5b6
Packit 53d5b6
MAXPWM
Packit 53d5b6
	The PWM value to use when the temperature is over MAXTEMP.
Packit 53d5b6
	If this value isn't defined, it defaults to 255 (full speed).
Packit 53d5b6
Packit 53d5b6
A graph might help you understand how the different values relate
Packit 53d5b6
to each other:
Packit 53d5b6
Packit 53d5b6
    PWM ^
Packit 53d5b6
    255 +
Packit 53d5b6
        |
Packit 53d5b6
        |
Packit 53d5b6
        |                             ,-------------- MAXPWM
Packit 53d5b6
        |                           ,'.
Packit 53d5b6
        |                         ,'  .
Packit 53d5b6
        |                       ,'    .
Packit 53d5b6
        |                     ,'      .
Packit 53d5b6
        |                   ,'        .
Packit 53d5b6
        |                 ,'          .
Packit 53d5b6
        |       MINSTOP .'            .
Packit 53d5b6
        |               |             .
Packit 53d5b6
        |               |             .
Packit 53d5b6
        |               |             .
Packit 53d5b6
 MINPWM |---------------'             .
Packit 53d5b6
        |               .             .
Packit 53d5b6
        |               .             .
Packit 53d5b6
        |               .             .
Packit 53d5b6
      0 +---------------+-------------+---------------->
Packit 53d5b6
                     MINTEMP       MAXTEMP            t (degree C)
Packit 53d5b6
Packit 53d5b6
The configuration file format is a bit strange:
Packit 53d5b6
Packit 53d5b6
VARIABLE=chip/pwmdev=value chip/pwmdev2=value2 [...]
Packit 53d5b6
VARIABLE2=[...]
Packit 53d5b6
Packit 53d5b6
Each variable has its own line. The variable name is followed by an equal sign
Packit 53d5b6
and the device=value pairs. These consist of the path to the pwm output for
Packit 53d5b6
which the value is valid, equal sign followed by the value and are separated
Packit 53d5b6
by a blank. Path can be absolute or relative (from /sys/bus/i2c/devices or
Packit 53d5b6
/sys/class/hwmon depending on the kernel version).
Packit 53d5b6
Packit 53d5b6
Example:
Packit 53d5b6
Packit 53d5b6
MINTEMP=hwmon0/device/pwm1=40 hwmon0/device/pwm2=54
Packit 53d5b6
Packit 53d5b6
You have to play with the temperature values a bit to get happy. For initial
Packit 53d5b6
setup I recommend using the pwmconfig script. Small changes can be made by
Packit 53d5b6
editing the config file directly following the rules above.
Packit 53d5b6
Packit 53d5b6
Packit 53d5b6
The algorithm
Packit 53d5b6
Packit 53d5b6
fancontrol first reads its configuration, writes it to arrays and loops its
Packit 53d5b6
main function.  This function gets the temperatures and fanspeeds from
Packit 53d5b6
kernel driver files and calculates new speeds depending on temperature
Packit 53d5b6
changes, but only if the temp is between MINTEMP and MAXTEMP. After that, the
Packit 53d5b6
new values are written to the pwm outputs.  The pwm value increases
Packit 53d5b6
linearly with rising temperature.
Packit 53d5b6
Packit 53d5b6
Packit 53d5b6
Planned features
Packit 53d5b6
Packit 53d5b6
rc-scripts for some gnu/linux-distributions
Packit 53d5b6
smoother regulation (temp interpolation)
Packit 53d5b6
gui for configuration
Packit 53d5b6
Packit 53d5b6
If you have other wishes or want to contribute something, please let me know:
Packit 53d5b6
marius.reiner${AT}hdev.de