# fancontrol for applesmc on macbook pro 7.1 (mid 2010)

## cbaabc

Hello,

I have a problem with my fancontrols on my macbook pro. The fan increases its speed not until the cpu temp gets really high(>70°C). The applesmc module seems to hold the fan at the minimum of 2000 rpm for most of the time. I try to solve this with a script, which raises the minimum speed if the temperature is rising.

The fan can take 2000-6200 rpm, but I raise the minimum from 2000 (<=50°C) up to 5000 (>=80°C) and leave the rest as it is, so that the automatic temperature control still works for higher temperatures.

My question now is: is my solution good enough or could this harm more than it helps?

And maybe someone can look over the script, as i havn't any experience with this.

The script:

```
#!/bin/bash

# AUTOMATIC VALUES BELOW, DON`T EDIT

# FAN SPEED

FAN1_SPEED_MIN=2000

FAN1_SPEED_MAX=5000

# dynamic values

while [ 1 ]; do

# CPU TEMPS

CPU_TEMP0=`cat /sys/devices/platform/coretemp.0/temp1_input`

CPU_TEMP1=`cat /sys/devices/platform/coretemp.1/temp1_input`

CPU_TEMP=`expr "(" $CPU_TEMP0 + $CPU_TEMP1 ")" "/" 2000`

# calculate

FAN_SPEED=`expr "(" $CPU_TEMP "-" 30 ")" "*" 100`

# don`t go below min limit

if [ "$FAN_SPEED" -le "$FAN1_SPEED_MIN" ]; then

FAN_SPEED=$FAN1_SPEED_MIN;

fi

# don`t go above max limit

if [ "$FAN_SPEED" -gt "$FAN1_SPEED_MAX" ]; then

FAN_SPEED=$FAN1_SPEED_MAX;

fi

# only write if speed has changed

if [ "$FAN_SPEED" != "$FAN_SPEED_OLD" ]; then

#echo $CPU_TEMP $FAN_SPEED

echo $FAN_SPEED > /sys/devices/platform/applesmc.768/fan1_min

fi

# store old speed

FAN_SPEED_OLD=$FAN_SPEED;

sleep 15

done
```

EDIT: I don't know if any other information could help, but i will provide them if necessary.

----------

## phoenix juice

here are some other scripts you may use as reference:

https://wiki.ubuntu.com/MacBookPro/SantaRosaFanControl

read the entire post because several examples exist.

https://bbs.archlinux.org/viewtopic.php?id=64457

I use the ubuntu wiki as a reference. I didn't find much on sensors, but it might help you with other issues.

https://help.ubuntu.com/community/MacBookPro7-1/Lucid#Sensors

----------

