Here's my card fan regulator tool, written in php.
It adjusts the card temp to a specific temperature. It also catches temperature changes faster and adjusts the fan better than the simple version above.
It also has some safety extras:
Set fan to 100% if card is above 96° (can be adjusted)
Clock card down to 500Mhz at 100°C (100% fan here already)
and you can change clock frequencies by typing 1 <enter> to 5 <enter> (Silent to full speed), adjust frequencies if needed. 6 is for full speed + cooler card
Have fun
<?
// Start with this fan speed
$fan = 40;
// Target temperature
$targetb = 86;
// At this temp switch to 100% fan
$highlim = 96;
$memspeed = 900;
$hyst = 2; $temp = 0; $target = $targetb;
while ( true) {
$last = $temp;
$temp = gt();
if($last) {
$diff = $temp - $last;
if($diff > 2) $fan+=5+2*$diff;
if($diff < -2) $fan-=5-2*$diff;
}
if($temp > $target + $hyst + 2) $fan+=4;
if($temp > $target + $hyst + 4) $fan+=20;
if($temp < $target - $hyst - 4) $fan-=4;
if($temp > $target + $hyst) $fan++;
if($temp < $target - $hyst) $fan--;
if($fan > 100) $fan = 100;
if($fan < 0) $fan = 0;
if($temp > $highlim) $fan = 100;
// At 100 Deg throttle card
if($temp > 100) throttle();
sf($fan);
$a = array(STDIN);
$l = array();
if(stream_select($a, $l, $l, 10) > 0) {
$d = fread(STDIN,1);
echo "--".$d."--";
switch($d) {
case '1':
sett(500); $target = $targetb + 1; break;
case '2':
sett(600); $target = $targetb + 1; break;
case '3':
sett(700); $target = $targetb; break;
case '4':
sett(800); $target = $targetb - 1; break;
case '5':
sett(840); $target = $targetb - 2; break;
case '6':
sett(840); $target = $targetb - 4;
}
}
}
echo "\n";
function sett($speed) {
echo "Setting clock to ".$speed."\n";
exec("aticonfig --odsc ".$speed.",".$GLOBALS["memspeed"]);
}
function throttle() {
echo "Too hot. Clocking card down to 500Mhz ...\n";
exec("aticonfig --odsc 500,".$globals["memspeed"]);
}
function sf($speed) {
echo "Setting fan to ".$speed."\n";
exec('aticonfig --pplib-cmd "set fanspeed 0 '.$speed.'"');
}
function gt() {
$ausgabe = array();
$e = exec("aticonfig --odgt", $ausgabe);
foreach($ausgabe as $line) {
$t = explode("Sensor 0: Temperature -", $line);
if(count($t) > 1) {
$t2 = explode(".", $t[1]); echo "Card at ".$t2[0]."\n"; return (int)$t2[0];
}
}
}
?>