Temperature and fan speed control on the Asus Eee PC

I noticed that after my second eeebuntu install (see a previous post for a why to this reinstall), my Eee PC was a wee bit more noisy. Most probably it has always been like that, but I just noticed after the reinstall.

I put some sensor output in my [[Xfce]] panel, and noticed that the CPU temperature hovered around 55 degrees C, and the fan would continuously spin at around 1200 rpm. I searched the web about it, and found out that usually fans are stopped at computer boot, then start spinning when temperature goes up. This is logic. The small catch is that when the temperature in the Eee PC goes down, the fan does not stop automatically. This means that the fans are almost always spinning in the long run.

I searched for methods to fix that, and I read this post at hartvig.de. From there I took the idea of taking over the control of the fans, and making them spin according to the current temperature. For that, I wrote the following script:

#!/bin/bash

TEMFILE=/proc/eee/temperature
FANFILE=/proc/eee/fan_speed
MANFILE=/proc/eee/fan_manual

# Get temperature:
TEMP=`cat $TEMFILE`

# Choose fan speed:
if [ $TEMP -gt 65 ]
then
  SPEED=90
elif [ $TEMP -gt 60 ]
then
  SPEED=60
elif [ $TEMP -gt 55 ]
then
  SPEED=30
else
  SPEED=0
fi

# Impose fan speed:
echo 1 > $MANFILE
echo $SPEED > $FANFILE

The file /proc/eee/fan_manual controls whether fans are under manual (file contains a “1”) or automatic (file contains a “0”) control. File /proc/eee/fan_speed must contain an integer number from 0 to 100 (a percent of max fan speed).

I am running this script every minute with cron, and thus far it works OK.

5 Comments »

  1. sindhu said,

    April 5, 2009 @ 15:15 pm

    Going to give this a try now, will report back if my CPU temp on my eee 1000h drops below 63C. Thanks a lot.

  2. sindhu said,

    April 5, 2009 @ 18:09 pm

    sindhu@sindhu-eee:~$ ps -ef|grep cron
    root 4881 1 0 21:22 ? 00:00:00 /usr/sbin/cron
    sindhu 5556 5536 0 21:26 pts/0 00:00:00 grep cron

    sindhu@sindhu-eee:~$ crontab -l
    # m h dom mon dow command
    1 * * * * /home/sindhu/myfan.sh >/dev/null 2>&1

    now the temp is around 60, i modded the script a bit (the temps part), maybe i should tweak it some more.

  3. isilanes said,

    April 6, 2009 @ 9:00 am

    Hi sindhu!

    I’m glad you found my script useful. I have two comments. First, I’d say 63C is a bit hot for an idle eeePC. Maybe your fans were almost never spinning? 60C and below is more reasonable. Second, recal that you are calling your script from cron every hour! Maybe your intention was to call it every minute, and hence the “one” in the first column… But right now you the line is executed at every hour o’clock, plus one minute (00:01, 01:01, 02:01…). If that was actually your intention, then I’d say that controlling the fan speed every hour is a bit too sparse. You could call the script every 5 minutes like so:

    0,5,10,15,25,30,35,40,45,50,55 * * * * /home/sindhu/myfan.sh

    (If the script has no output, you don’t need to redirect anything to /dev/null).

  4. sindhu said,

    April 6, 2009 @ 9:22 am

    damn i had it set up all wrong =P thanks for correcting, i changed it now to */2 * * * * …hope that works :)

  5. melissa said,

    June 9, 2020 @ 10:14 am

    i love this blod, ist realy nice. thanks a lot :)

RSS feed for comments on this post · TrackBack URI

Leave a Comment