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.

Tags: , , , , , , ,

4 thoughts on “Temperature and fan speed control on the Asus Eee PC

  1. 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.

  2. 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).

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe without commenting