DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#26 2007-02-16 17:52:44

rgb
New member
Registered: 2007-02-16
Posts: 1

Re: Fan does run all the time :-(

I don't have a dns-323, but I know agood deal about shell programming. With my current system the shell allows prefix removal directly.

eg
$ T='<temperaturertc>: get temperature =30'
$ T=${T##*=}
$ echo $T
30

you could use this sort of approach to eliminate using sed.

Offline

 

#27 2007-03-14 23:10:49

FIB
Member
Registered: 2007-03-13
Posts: 13

Re: Fan does run all the time :-(

I like to share my version of the fan controller. The temperature reported by my box is a bit high, so I compensate this a bit (-20). The fan in my box is not running stabile under 2200 rpm and I will not push it for more than 5000.

Code:

#!/bin/sh
#echo New Fan controller
#
# Kill the old fan controller
kill -9 `pidof fancontrol`
#echo `pidof fancontrol`
#
update_interval=100
T1=86
T2=100
RPM1=2200 
RPM2=5000
#
while [ 1 ]
do
  T=`temperature g 0`
  T=${T##*=}
  # Calibrate
  T=`expr $T - 20`
  # Show temperature in  Celcius
  # Calc and set fanspeed
  newRPM=`expr \( \( $T2 \< $T \) \* $RPM2 \) \| \( \( $RPM1 + \( $RPM2 - $RPM1 \) \* \( $T - $T1 \) \/ \( $T2 - $T1 \) \) \& \( $T \>= $T1 \) \)`   
  fanspeed w $newRPM
  echo `date` "Fahrenheit" $T "Celcius" `expr \( \( $T - 32 \) \* 10 + 9 \) \/ 18` "fanspeed w" $newRPM > /tmp/fan.txt
  # wait for next cycle
  sleep $update_interval
done

I would like to include disk spinning state, but have not yet figured out a good way to extract the disk state into the script. I might be possible to detect state of the power-led, which follows the disk spinning state (see http://dns323.kood.org/forum/p948-20070122-225328.html for inspiration)?

I install this from fun_plug like this

Code:

# Alternative (home made) FAN controller
/mnt/HD_a2/fan.sh &

Last edited by FIB (2007-03-14 23:15:15)

Offline

 

#28 2007-03-15 16:09:14

hwahrmann
Member
Registered: 2007-03-15
Posts: 23

Re: Fan does run all the time :-(

What's your experience in controlling the fan?
When i run the script, the disks never seem to spin down

Offline

 

#29 2007-03-15 21:28:40

FIB
Member
Registered: 2007-03-13
Posts: 13

Re: Fan does run all the time :-(

Currently my disks spin down as expected, also when I am running the script. Also telnet, FireFly in standalone mode is “enabled”. FW 1.02b.

I will update this thread http://dns323.kood.org/forum/t203-Disk- … nutes.html with my disk spin down experience.

Offline

 

#30 2007-05-23 23:52:44

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Fan does run all the time :-(

FIB wrote:

Currently my disks spin down as expected, also when I am running the script. Also telnet, FireFly in standalone mode is “enabled”. FW 1.02b.

I will update this thread http://dns323.kood.org/forum/t203-Disk- … nutes.html with my disk spin down experience.

Did you notice that, with your script, sometimes when the script sets the new fanspeed, the fan spins up and then spins down again? Is there a way to prevent this?

This is the only thing that annoys me, otherwise this script is much preferable to using fancontrol. And it works great :)

Offline

 

#31 2007-05-28 15:43:10

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Fan does run all the time :-(

I've been asked to include a fancontrol script in my funplug, and I think that's a nice idea. I'm not sure, however, which version to use. The scripts in the various threads seem to differ in details. I've found the following scripts:

http://dns323.kood.org/hardware:fan
http://dns323.kood.org/forum/p2037-2007 … html#p2037
http://dns323.kood.org/forum/p3036-2007 … html#p3036

Which one would you vote for? Or are there even more versions!?

Offline

 

#32 2007-05-28 19:48:26

lovgren
Member
Registered: 2007-05-05
Posts: 11

Re: Fan does run all the time :-(

I saw that someone in this forum wanted to turn off the fan when the drives were hibernating, so I started to work on something like that.
There is still a big room for improvement (I'm not that familiar with shell scripts - and I only wanted to use commands from /bin to avoid that the disks  would spin up...) for example if you only use one drive some lines need to be changed.
The attached script works for me anyway.

This script uses fahrenheit temperatures.

Offline

 

#33 2007-05-28 20:53:43

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Fan does run all the time :-(

I think that a modified version of FIB's script is excellent, I use it myself. Apart from the spinup of the fan that *sometimes* occurs when the script is executing, I have had no problems at all with it.

This is the script that I am talking about:

Code:

#!/bin/sh
#
# This script was created at http://dns323.kood.org by FIB,
# it has been slightly modified by leper (with help from
# fonz). It sets the fanspeed of the device depending on 
# the temperature, which is measured in Fahrenheit. If 
# your box measures temperature in Celsius, you need to 
# edit it to work.

# Set the path to use RAM-disk instead of harddrive, to 
# execute from. This is done so that the disks will go
# into sleep mode, while the script is running.
PATH=/usr/bin:/bin:/usr/sbin:/sbin

# Create a logfile on the RAM-disk.
LOGDIR=/log
FANLOGFILE=${LOGDIR}/fan_ctrl.log
mkdir -p ${LOGDIR}

# Kill the old fan controller.
kill -9 `pidof fancontrol`
echo "Fancontrol killed. Installing fan_ctrl.sh" >${FANLOGFILE}

# With temps between T1 and T2, the script automatically
# lowers/raises the fanspeed between RPM1 and RPM2. This
# it does every update_interval seconds.
update_interval=100
T1=105
T2=140
RPM1=1800
RPM2=4000

while [ 1 ]
do
  T=`temperature g 0`
  T=${T##*=}
  CALCTEMP=`expr \( \( $T2 \< $T \) \* $RPM2 \) \| \( \( $RPM1 + \( $RPM2 - $RPM1 \) \* \( $T - $T1 \) \/ \( $T2 - $T1 \) \) \& \( $T \>= $T1 \) \)`
  CONVFTOC=`expr \( \( $T - 32 \) \* 10 + 9 \) \/ 18`
  newRPM=${CALCTEMP}
  fanspeed w $newRPM  
  echo `date`" ::CURRENT::" $T"F" ${CONVFTOC}"C -- fanspeed:" $newRPM "(written to "${FANLOGFILE}")." >>${FANLOGFILE}
  # wait for next cycle
  sleep $update_interval
done

There is no practical reason to use the CALCTEMP and CONVFTOC stuff in the while loop, I just modified this to make the script a tad easier to understand. For myself to understand :)

I also added quite a bit of comments here, maybe they'll help someone. The expression used, is all credit to FIB, mainly I just added (with the help of fonz) the path and the logfile on the RAM-disk. Of course, the T1 and T2 integers are a bit specific to my box, I am running a single 500GB seagate drive, and with these settings my temps are ~107-114F (42-46C), idle as well as under load. The fanspeeds are in the range of 1925-2365, which I think is rather quiet. Especially compared to the original fancontroller, which on my box ran almost exclusively at ~2600+, even in idle mode.

You could probably integrate lovgren's script to turn off the fan in case the drives are asleep, but I leave this to someone with more skills :D

Offline

 

#34 2007-05-28 20:58:50

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Fan does run all the time :-(

Oh, and

Code:

/path/to/your/script >/dev/null 2>/dev/null </dev/null &

must be incorporated into the fun_plug, to prevent FIB's fanscript to "hang" the telnet session. Or at least I think so :)

Last edited by leper (2007-05-28 20:59:12)

Offline

 

#35 2007-05-28 21:18:49

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Fan does run all the time :-(

leper wrote:

Code:

...
# the temperature, which is measured in Fahrenheit. If 
# your box measures temperature in Celsius, you need to 
# edit it to work.
...

what is the issue here? do different firmware versions print celius or fahrenheit, depending on what? i'm pretty sure i have not the us version installed, and it shows fahrenheit...

The wiki page says: "By running temperature g 0 you can see what temperature-unit your box uses. The script will be update with a more general solution asap." Is someone working on this?

Last edited by fonz (2007-05-28 21:23:05)

Offline

 

#36 2007-05-28 23:50:40

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Fan does run all the time :-(

fonz wrote:

leper wrote:

Code:

...
# the temperature, which is measured in Fahrenheit. If 
# your box measures temperature in Celsius, you need to 
# edit it to work.
...

what is the issue here? do different firmware versions print celius or fahrenheit, depending on what? i'm pretty sure i have not the us version installed, and it shows fahrenheit...

The wiki page says: "By running temperature g 0 you can see what temperature-unit your box uses. The script will be update with a more general solution asap." Is someone working on this?

I have no idea, I've bought mine in Sweden. Since I gathered info about it from this site, I figured someone must have had a box with celsius, or else the wiki is just a bit out of sync with reality on this point. To make it clear: my box is running firmware 1.03, the EU version, which is named NAS202B_DLINKEu_DNS323.1.03b41(1.03.0330.2007) when downloaded and unpacked from d-link.se, and I have heat measured in Fahrenheit.

Offline

 

#37 2007-05-29 01:30:38

DNS-323 Talker
Member
Registered: 2007-05-21
Posts: 245

Re: Fan does run all the time :-(

leper wrote:

Oh, and

Code:

/path/to/your/script >/dev/null 2>/dev/null </dev/null &

must be incorporated into the fun_plug, to prevent FIB's fanscript to "hang" the telnet session. Or at least I think so smile

I rand FIB's fan script for a day or so, and didn't notice any telnet problems...certainly didn't give it a long run (I wasn't totally sure that I wanted to mess around with the fan w/out more info.


DNS-323 w/two Seagate 500 GB RAID1
Fonz's Fun_Plug- Don't DNS-323 without it!

Offline

 

#38 2007-05-29 14:48:38

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Fan does run all the time :-(

DNS-323 Talker wrote:

(I wasn't totally sure that I wanted to mess around with the fan w/out more info.

That's why I'm asking, since I don't want to include a flawed script. So far I don't think it's ready:
- leper's script is nicely commented, but could use some cleanup (remove unused code)
- lovgren's drive status detection is an interesting idea, though I'm not sure whether stopping the fan - without checking the actual temperature - is the right thing (TM)!?
- I'm also not sure about the parameters, do they work for summer and winter?
- the celius/fahrenheit issue needs to be solved

Offline

 

#39 2007-05-29 15:07:02

gartylad
Member
Registered: 2007-01-15
Posts: 30

Re: Fan does run all the time :-(

Finally got round to trying a custom fan_speed plug, many thanks for the code

All seems to work fine, the fan controls a lot quiter and modulates with the temp.

With the fan plug running both telnet and twonkymedia stop running. Anyone else having this issue or tried the "/path/to/your/script >/dev/null 2>/dev/null </dev/null &" fix above.


For Info: (Dual drive setup)
Using the inbuilt fan speed function my fans runs at 3996RPM @ 104F. A few hours later it reduces to 2700RPM @ 109F. Seems odd to me

Last edited by gartylad (2007-05-29 20:26:38)

Offline

 

#40 2007-05-29 21:01:18

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Fan does run all the time :-(

gartylad wrote:

Finally got round to trying a custom fan_speed plug, many thanks for the code

All seems to work fine, the fan controls a lot quiter and modulates with the temp.

With the fan plug running both telnet and twonkymedia stop running. Anyone else having this issue or tried the "/path/to/your/script >/dev/null 2>/dev/null </dev/null &" fix above.


For Info: (Dual drive setup)
Using the inbuilt fan speed function my fans runs at 3996RPM @ 104F. A few hours later it reduces to 2700RPM @ 109F. Seems odd to me

see fonz' explanation here. if you experience similar problems that i did, this fixed it for me. don't know about twonkymedia though, but it sounds like you have the same problem that i did.

Offline

 

#41 2007-05-29 21:23:58

gartylad
Member
Registered: 2007-01-15
Posts: 30

Re: Fan does run all the time :-(

leper wrote:

see fonz' explanation here. if you experience similar problems that i did, this fixed it for me. don't know about twonkymedia though, but it sounds like you have the same problem that i did.

Many thanks, was unsure about that command.

All is working now, FanSpeed, Telnet, and Twonky

Offline

 

#42 2007-05-30 00:58:20

DNS-323 Talker
Member
Registered: 2007-05-21
Posts: 245

Re: Fan does run all the time :-(

gartylad....Have you done any comparisons (before/after) in terms of temperature to see how the fanspeed script affects operating temperature of the box?  Hard to get exact apples to apples, but if you were checking temp before the mod and check it after on days where the temps are similar that would give an idea of the impact...


DNS-323 w/two Seagate 500 GB RAID1
Fonz's Fun_Plug- Don't DNS-323 without it!

Offline

 

#43 2007-05-30 09:40:00

gartylad
Member
Registered: 2007-01-15
Posts: 30

Re: Fan does run all the time :-(

Obviously this will differ for everyone

With general light use of the DNS-323, normally single drive access at a time. I noticed the working temp of the box was around 4-5F higher than before the plug. Raising from 109F to around 114F @2400RPM and continued to start creeping higher, the fan was unable to catch up

I increased RPM2 value in the script to compensate, which will increase the fan speed at higher temp while remianing the same low temps while idle.(cold). This stopped the temperature creeping up during light use, and was still quiet @2700RPM

I played with the fan_off script to disable fans when they are both idle, but this does not link to temperature. If both drives are inactive, and the fan stops, the box could still be hot. There needs to be a referance to the temp to enable a cool down period. So i'm not happy to use this as yet.

Currnet setting using the basic script above, with the ram drive feature (thanks to leper & fonz):

update_interval=100
T1=105
T2=140
RPM1=2000
RPM2=4500

one thing I did notice, on a cold morning, when the box was reading 104F the fan stopped, after accessing the drive for a short while and warming up, the fan started. This is not running the fan_stop script. The lowest fiqures in my script is 2000RPM @ 105F, below 105F and the fan stops !!!! Great news.

Can someone convert the following formula into 'BASIC' code,

CALCTEMP=`expr \( \( $T2 \< $T \) \* $RPM2 \) \| \( \( $RPM1 + \( $RPM2 - $RPM1 \) \* \( $T - $T1 \) \/ \( $T2 - $T1 \) \) \& \( $T \>= $T1 \) \)`

as i'm a newbie Linux I find it very hard to read, and wanted to check the formula value with a temp of 104F to see if it results in a fanspeed of 0RPM. If that is true then increasing the T1 value would set the fan stop temp !! It had no problems restarting.

Last edited by gartylad (2007-05-30 09:41:24)

Offline

 

#44 2007-05-30 10:23:23

DNS-323 Talker
Member
Registered: 2007-05-21
Posts: 245

Re: Fan does run all the time :-(

Thanks for the detailed post, gartylad, very interesting information and ideas.  I hope someone knowledgable can give you some feedback on the formula and your speculation that the T1 value sets a fan stop temp...

Is there any fun like tweaking fun?  wink


DNS-323 w/two Seagate 500 GB RAID1
Fonz's Fun_Plug- Don't DNS-323 without it!

Offline

 

#45 2007-06-03 19:23:20

gartylad
Member
Registered: 2007-01-15
Posts: 30

Re: Fan does run all the time :-(

Added an additional few lines of code to the above files.

All logs are recorded into Ram, so the disk don't startup for fan control
Fan speed is controlled via temp
Fan speed is set to 0rpm below the T1 setpoint.

Currently my fans stop below 108F, which i find to be when the fans are off, and the box is cool.

Details of change as follows:

*******************************************************************************************************************

  # Check if temperature has fallen below T1 value
  if $T < $T1; then
      # Temp below T1 fan stops
     CALCTEMP=`expr 0`
  else
     # Temp above T1 fan starts
     CALCTEMP=`expr \( \( $T2 \< $T \) \* $RPM2 \) \| \( \( $RPM1 + \( $RPM2 - $RPM1 \) \* \( $T - $T1 \) \/ \( $T2 - $T1 \) \) \& \( $T \>= $T1 \) \)`
  fi

****************************************************************************************************************************************

I have attached the full code, if you want to look.

Playing with these may damage you DNS-323, do so it your own risk.

Any comments guys and girls ?? I'm a linux noobie, so please point out any proplems in the code

Last edited by gartylad (2007-06-03 19:25:13)

Offline

 

#46 2007-06-03 23:35:49

leper
Member
From: sweden
Registered: 2007-05-17
Posts: 25
Website

Re: Fan does run all the time :-(

I added this script on the wiki page, with a link back to this thread. While doing this, I read through the other stuff there again, and noticed how 'temperature g' can be used with both '0', '1' and '2', with '2' being the "Overtemp shutdown Tos register value/threshold". Is this something that needs to be added to the script?

It might be that it is just a safety measurement, and that the current script won't reach those high temperatures (80C), but in case the fan stops spinning, maybe this needs to be regarded. Or at least some sort of emergency shutdown feature needs to be added, in case temperature starts rocketing.

Any thoughts on this?

Offline

 

#47 2007-06-04 01:06:34

DNS-323 Talker
Member
Registered: 2007-05-21
Posts: 245

Re: Fan does run all the time :-(

Good point, leper...that would be bad (to quote "Ghostbusters") if using a fan script didn't allow the unit to shut down properly if necessary.   

Do we assume that killing the standard fan script and then running ours means the DNS-323 temperature shutdown setting (in the Email Alerts section of the Dlink setup pages) doesn't run?


DNS-323 w/two Seagate 500 GB RAID1
Fonz's Fun_Plug- Don't DNS-323 without it!

Offline

 

#48 2007-06-06 12:51:40

vthinsel
Member
Registered: 2007-05-24
Posts: 41

Re: Fan does run all the time :-(

Hello,

As my dns323 reports temperatue in celcius, I made a "best-of" from all your smart scripts, so I attach my version here.
It should handle temps in celcius and fahrenheit transparently. The scripts is treating temps in Fh, so no more T, but F, just to know what we are managing.

I'll do some more tests, but if someone with a box reporting in F could report it works, it would be nice.

Cheers,
Vincent

Edit: added some stats generation in /tmp/ clean it at times. Usefull for calibrating your temperatures T1 and T2

PS: I also noticed that "temperature" seems to generate /tmp/temper_F and /tmp/temper_C on my DNS :-)

Vincent.

Last edited by vthinsel (2007-06-06 14:20:52)

Offline

 

#49 2007-06-07 02:37:28

DNS-323 Talker
Member
Registered: 2007-05-21
Posts: 245

Re: Fan does run all the time :-(

I don't really know how to write a script, but one part looked strange to me...

update_interval=60
#T1 and T2 in fahrenheit - convert if necessary using c2f function
T1=$(c2f 50)
T2=$(c2f 75)

Does the above set the fan speeds for temperature 1 (T1) and temperature 2 (T2)?  The temperatures look odd...my DNS-323 never runs anywhere near 50 or 75 degrees...your comment says they are in farenheit.  What am I getting wrong?   Those are celcius temperatures, aren't they?


DNS-323 w/two Seagate 500 GB RAID1
Fonz's Fun_Plug- Don't DNS-323 without it!

Offline

 

#50 2007-06-07 03:00:15

bluecar
New member
Registered: 2007-01-20
Posts: 3

Re: Fan does run all the time :-(

"c2f" is a function that accepts Celsius and returns Fahrenheit .  It's explained right in your quoted text...

Last edited by bluecar (2007-06-07 03:04:07)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB