Debonaras
view · edit · print · history

Place this script in /usr/local/bin/temper and run it from an init.d script. It will run the fan at maximum when the disks are over 53 degrees or the chipset is over 63 degrees. At lower temperatures the fan runs slower, and it stops completely if the temperatures are 12 degrees or more below the maximum. Find the appropriate "FAN_MIN" (lowest PWM value at which the fan reliably starts/rotates) for your unit - for me (Steve G) it was 63. Note: this version of the script now runs with "dash" or "busybox sh" shells as well as bash. These two alternative shells have reduced memory footprint, useful for a script that is always running.


 #!/bin/dash
 # /usr/local/sbin/temper - N2100 automatic fan control and logger

 # Fan controller
 F75375=/sys/devices/platform/IOP3xx-I2C.0/i2c-0/0-002e

 # Chip temperature values and maximum allowed temperature
 CHIPS=$F75375/temp?_input
 TC_MAX=63

 # Disk devices and maximum allowed temperature
 DISKS=/dev/sd?
 TD_MAX=53

 # Fan device, lowest PWM value and control range
 FAN=$F75375/pwm2
 FAN_MIN=70
 FAN_RNG=10

 # Input to read
 SPEED=$F75375/fan1_input

 # logging interval, in minutes
 LOG=15

 # Disable PWM1 output
 PWM1=$F75375/pwm1

 while true ; do
    i=0
    while [ $i -lt $LOG ] ; do
       i=$(($i+1))
       # read the disk temperatures every minute
       TD=0
       for D in $DISKS ; do
          t=$(hddtemp -n $D)
          if [ $t -gt $TD ] ; then
             TD=$t
          fi
       done

       j=0
       while [ $j -lt 6 ] ; do
          j=$(($j+1))
          # read the chip temperatures every 10 seconds
          TC=0
          for C in $CHIPS ; do
             t=$(($(cat $C)/1000))
             if [ $t -gt $TC ] && [ $t -lt 255 ]; then
                TC=$t
             fi
          done

          if [ $TC -gt $TC_MAX ] ; then
             FC=255
          elif [ $(($TC+$FAN_RNG)) -gt $TC_MAX ] ; then
             FC=$(($TC+$FAN_RNG-$TC_MAX+$FAN_MIN))
          else
             FC=0
          fi

          if [ $TD -gt $TD_MAX ] ; then
             FD=255
          elif [ $(($TD+$FAN_RNG)) -gt $TD_MAX ] ; then
             FD=$(($TD+$FAN_RNG-$TD_MAX+$FAN_MIN))
          else
             FD=0
          fi

          if [ $FC -gt $FD ] ; then
             F=$FC
          else
             F=$FD
          fi

          if [ "$1" = "-m" ] ; then
             echo "chips $TC disks $TD -> fan $F"
             exit 0
          fi
          echo $F >$FAN
          echo 0  >$PWM1

          sleep 10
       done
    done

    R=$((1500000/$(cat $SPEED)))
    logger -p daemon.notice $0 "chips $TC disks $TD -> fan $F rpm $R"
 done

 # EOF

 #! /bin/sh
 # /etc/init.d/temper - script to run temper

 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC="Fan temperature control"
 NAME=temper
 DAEMON=/usr/local/sbin/$NAME
 PIDFILE=/var/run/$NAME.pid
 SCRIPTNAME=/etc/init.d/$NAME

 # Exit if the package is not installed
 [ -x "$DAEMON" ] || exit 0

 # Read configuration variable file if it is present
 [ -r /etc/default/$NAME ] && . /etc/default/$NAME

 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh

 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
 . /lib/lsb/init-functions

 #
 # Function that starts the daemon/service
 #
 do_start()
 {
         # Return
         #   0 if daemon has been started
         #   1 if daemon was already running
         #   2 if daemon could not be started
         start-stop-daemon --start --quiet --pidfile $PIDFILE \
                 --exec $DAEMON --test > /dev/null || return 1
         start-stop-daemon --start --quiet --pidfile $PIDFILE \
                 --exec $DAEMON --background --make-pidfile
 }

 #
 # Function that stops the daemon/service
 #
 do_stop()
 {
         # Return
         #   0 if daemon has been stopped
         #   1 if daemon was already stopped
         #   2 if daemon could not be stopped
         #   other if a failure occurred
         start-stop-daemon --stop --pidfile $PIDFILE --name $NAME
         RETVAL="$?"

         # run fan at maximum speed
         echo 255 >/sys/devices/platform/IOP3xx-I2C.0/i2c-0/0-002e/pwm2

         [ "$RETVAL" = 2 ] && return 2
         rm -f $PIDFILE
         return "$RETVAL"
 }

 case "$1" in
   start)
         [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC"  "$NAME"
         do_start
         case "$?" in
                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
         esac
         ;;
   stop)
         [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
         do_stop
         case "$?" in
                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
         esac
         ;;
   restart|force-reload)
         #
         # If the "reload" option is implemented then remove the
         # 'force-reload' alias
         #
         log_daemon_msg "Restarting $DESC" "$NAME"
         do_stop
         case "$?" in
           0|1)
                 do_start
                 case "$?" in
                         0) log_end_msg 0 ;;
                         1) log_end_msg 1 ;; # Old process is still  running
                         *) log_end_msg 1 ;; # Failed to start
                 esac
                 ;;
           *)
                 # Failed to stop
                 log_end_msg 1
                 ;;
         esac
         ;;
   *)
         #echo "Usage: $SCRIPTNAME  {start|stop|restart|reload|force-reload}" >&2
         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
         exit 3
         ;;
 esac

Air Flow investigation.

My cooling improvements. YMMV. (John Ashby).

Step 1. From some preliminary investigation work it is quite clear that the fan draws air out of the case, but there is no route for air to enter. This can be proven by undoing the lid and sliding it back about 4mm. Block the gap at the back with sticky tape. This stops air flowing into the case, and straight out again. With this modification you will see a temperature drop of about 6-8 degrees. All this does is provide a route for air to enter the case. No other modifications.

Step 2. Notice the plastic skirt around the back of the HDD cradle? Extend this back about 6mm to the case. Add a skirt down to the circuit board on both sides, (needs a 2mm cut out over one IC), and cover the 4 side slots, I used post-it notes, and sticky tape. All air is now forced passed the hard disks, and main circuit board. On the side of the case opposite the memory I then installed 4 screw holes, and a cut out for a 50mm fan. There is a flat area of the case large enough for this. I removed the fan from a HDD bolt on cooling panel. I used the panel as a template for the drilling/cutting. I have not yet installed the second fan, (which MUST suck air in), but the modifications now give 12-14 degrees of cooling.

Stage 3. Still to do. Add the 50mm fan to the case side. Replace the paper cooling skirts with something more robust.


Air flow improvement

Like John writes above, air flow through the N2100 is limited because of the very small air intake openings. The air flow can be improved by drilling some holes in your N2100. Here's what I (Frank K) did:

  • Disassemble the N2100, removing the motherboard. This is easier if you remove the fan as well.
  • Use some masking tape to mark the positions of the holes.
  • The holes should be near the front of the N2100, to allow the air flow along the length of the hard disks.

I made 9 holes with a 5 mm drill, approximately 2 cm from the front, 1 cm apart.

  • Very gently drill (from the outside in) the holes in the plastic case, and remove any burrs.
  • Reassemble the N2100, make sure to fit the fan so it extracts air from the box.
  • Fit some rubber feet on the bottom so that the box stands clear from the surface it is on.

Update Jan 2008: I (Steve G) used this method, and my disks now run 4 degrees C cooler, but my fan is only at 2/3 the speed so it's noticeably quieter.


Yet another air flow experiment

I (Jyrki M.) decided to do something between the two posts above:

  • Move the original plastic skirt towards the back of the case. Heat the thing a bit so the glue gives up and move it.
  • Remove the tiny plastic grille in the front, just below the leds. I used a small knife for this. As a bonus feature, second USB plug is revealed.
view · edit · print · history · Last edited by Steve G.
Based on work by Colint, martinwguy, Frank Kingswood, Jyrki Muukkonen, Steve G, and John Ashby.
Originally by Frank Kingswood.
Page last modified on January 28, 2008, at 09:45 AM