| 1 |
.TH FANCONTROL 8 "September 2009" "lm-sensors 3" |
| 2 |
.SH NAME |
| 3 |
fancontrol \- automated software based fan speed regulation |
| 4 |
|
| 5 |
.SH SYNOPSIS |
| 6 |
.B fancontrol |
| 7 |
.I [configfile] |
| 8 |
|
| 9 |
.SH DESCRIPTION |
| 10 |
\fBfancontrol\fP is a shell script for use with lm_sensors. It reads its |
| 11 |
configuration from a file, then calculates fan speeds from temperatures and |
| 12 |
sets the corresponding PWM outputs to the computed values. |
| 13 |
|
| 14 |
.SH WARNING |
| 15 |
Please be careful when using the fan control features of your mainboard, in |
| 16 |
addition to the risk of burning your CPU, at higher temperatures there will be |
| 17 |
a higher wearout of your other hardware components, too. So if you plan to use |
| 18 |
these components in 50 years, \fBmaybe\fP you shouldn't use fancontrol |
| 19 |
at all. Also please keep in mind most fans aren't designed to be |
| 20 |
powered by a PWMed voltage. |
| 21 |
|
| 22 |
In practice it doesn't seem to be a major issue, the fans will get slightly |
| 23 |
warmer, just be sure to have a temperature alarm and/or shutdown call, in case |
| 24 |
some fan fails, because you probably won't hear it anymore ;) |
| 25 |
|
| 26 |
.SH CONFIGURATION |
| 27 |
For easy configuration, there's a script |
| 28 |
named \fBpwmconfig\fP(8) which lets you interactively write your |
| 29 |
configuration file for \fBfancontrol\fP. Alternatively you can write this |
| 30 |
file yourself using the information from this manpage. |
| 31 |
|
| 32 |
Since most of you are going to use \fBpwmconfig\fP(8) script, the config |
| 33 |
file syntax will be discussed last. First I'm going to describe the various |
| 34 |
variables available for changing \fBfancontrol\fP's behaviour: |
| 35 |
|
| 36 |
.TP |
| 37 |
.B INTERVAL |
| 38 |
This variable defines at which interval in seconds the main loop of |
| 39 |
\fBfancontrol\fP will be executed |
| 40 |
.TP |
| 41 |
.B DEVPATH |
| 42 |
Maps hwmon class devices to physical devices. This lets \fBfancontrol\fP |
| 43 |
check that the configuration file is still up-to-date. |
| 44 |
.TP |
| 45 |
.B DEVNAME |
| 46 |
Records hwmon class device names. This lets \fBfancontrol\fP check that |
| 47 |
the configuration file is still up-to-date. |
| 48 |
.TP |
| 49 |
.B FCTEMPS |
| 50 |
Maps PWM outputs to temperature sensors so \fBfancontrol\fP knows which |
| 51 |
temperature sensors should be used for calculation of new values for |
| 52 |
the corresponding PWM outputs. A prefix of ! can be used to execute a |
| 53 |
command as a temperature sensor. |
| 54 |
|
| 55 |
.TP |
| 56 |
.B FCFANS |
| 57 |
Records the association between a PWM output and a fan input. |
| 58 |
Then \fBfancontrol\fP can check the fan speed and restart it if it |
| 59 |
stops unexpectedly. |
| 60 |
.TP |
| 61 |
.B MINTEMP |
| 62 |
The temperature below which the fan gets switched to minimum speed. |
| 63 |
.TP |
| 64 |
.B MAXTEMP |
| 65 |
The temperature over which the fan gets switched to maximum speed. |
| 66 |
.TP |
| 67 |
.B MINSTART |
| 68 |
Sets the minimum speed at which the fan begins spinning. You should |
| 69 |
use a safe value to be sure it works, even when the fan gets old. |
| 70 |
.TP |
| 71 |
.B MINSTOP |
| 72 |
The minimum speed at which the fan still spins. Use a safe value here, |
| 73 |
too. |
| 74 |
.TP |
| 75 |
.B MINPWM |
| 76 |
The PWM value to use when the temperature is below MINTEMP. |
| 77 |
Typically, this will be either 0 if it is OK for the fan to plain |
| 78 |
stop, or the same value as MINSTOP if you don't want the fan to |
| 79 |
ever stop. |
| 80 |
If this value isn't defined, it defaults to 0 (stopped fan). |
| 81 |
.TP |
| 82 |
.B MAXPWM |
| 83 |
The PWM value to use when the temperature is over MAXTEMP. |
| 84 |
If this value isn't defined, it defaults to 255 (full speed). |
| 85 |
.TP |
| 86 |
.B AVERAGE |
| 87 |
How many last temperature readings are used to average the temperature. |
| 88 |
It can be used to smoothen short temperature peaks. |
| 89 |
If this value isn't defined, it defaults to 1 (no averaging). |
| 90 |
.PP |
| 91 |
The configuration file format is a bit strange: |
| 92 |
.IP |
| 93 |
.nf |
| 94 |
VARIABLE=chip/pwmdev=value chip/pwmdev2=value2 |
| 95 |
VARIABLE2=... |
| 96 |
.fi |
| 97 |
.PP |
| 98 |
Each variable has its own line. The variable name is followed by an equal sign |
| 99 |
and the device=value pairs. These consist of the path to the pwm output for |
| 100 |
which the value is valid, equal sign followed by the value and are separated |
| 101 |
by a blank. Path can be absolute or relative (from /sys/bus/i2c/devices or |
| 102 |
/sys/class/hwmon depending on the kernel version). Example: |
| 103 |
.IP |
| 104 |
MINTEMP=hwmon0/device/pwm1=40 hwmon0/device/pwm2=54 |
| 105 |
.PP |
| 106 |
You have to play with the temperature values a bit to get happy. For initial |
| 107 |
setup I recommend using the \fBpwmconfig\fP script. Small changes can be made by |
| 108 |
editing the config file directly following the rules above. |
| 109 |
|
| 110 |
Upon starting, fancontrol will make sure that all referenced devices |
| 111 |
do exist and match what they were at configuration time, and that all |
| 112 |
referenced sysfs files do exist. If not, it will quit immediately, upon |
| 113 |
the assumption that the configuration file may be out-of-sync with the |
| 114 |
loaded kernel drivers. |
| 115 |
|
| 116 |
.SH THE ALGORITHM |
| 117 |
|
| 118 |
\fBfancontrol\fP first reads its configuration, writes it to arrays and loops its |
| 119 |
main function. This function gets the temperatures and fanspeeds from |
| 120 |
kernel driver files and calculates new speeds depending on temperature |
| 121 |
changes, but only if the temp is between MINTEMP and MAXTEMP. After that, the |
| 122 |
new values are written to the PWM outputs. Currently the speed increases |
| 123 |
linearly with rising temperature. This way you won't hear your fans most |
| 124 |
of the time at best. |
| 125 |
|
| 126 |
.SH SEE ALSO |
| 127 |
pwmconfig(8), sensors(1). |
| 128 |
|
| 129 |
.SH AUTHOR |
| 130 |
.PP |
| 131 |
Marius Reiner <[email protected]> |