New and lighweight fan control daemon for NSA 310

Marvell Kirkwood based
nadnerb
Posts: 26
Joined: Thu Mar 21, 2013 7:28 pm

Re: New and lighweight fan control daemon for NSA 310

Post by nadnerb » Sun May 12, 2013 3:19 pm

bigtom5000 wrote:"How to install
Very simple. First, you need Go language (golang). Please note Go 1.0 WILL NOT compile on ARM5, you either need some development snapshot or you can checkout master (called "default") branch. Then install and set GOROOT and PATH variables."

I'm a newbee. Could you please write a bit more detailed tutorial? I'd appreciate it...

Thanks!
ditto, anyone able to expand on the guide in the first post, I really want to quieten my NSA310 fan.

barmalej2
Posts: 2382
Joined: Sun Apr 29, 2012 5:24 pm

Re: New and lighweight fan control daemon for NSA 310

Post by barmalej2 » Mon May 13, 2013 10:51 am

You might be interested in this solution:
viewtopic.php?f=249&t=5785&start=45#p38045

nadnerb
Posts: 26
Joined: Thu Mar 21, 2013 7:28 pm

Re: New and lighweight fan control daemon for NSA 310

Post by nadnerb » Tue May 14, 2013 9:30 pm

Thanks, I did try one of the solutions in that thread but I'm not sure if I made a mistake or what, because when running the script, RAM usage would slowly creep up over an hour or so until my NAS completely locked up and I was forced to reboot.
However, I shall try the script in you latest post, thanks.

barmalej2
Posts: 2382
Joined: Sun Apr 29, 2012 5:24 pm

Re: New and lighweight fan control daemon for NSA 310

Post by barmalej2 » Wed May 15, 2013 4:37 am

Feedback is appreciated.

fyo
Posts: 3
Joined: Fri Jun 28, 2013 2:26 pm

Re: New and lighweight fan control daemon for NSA 310

Post by fyo » Fri Jun 28, 2013 10:24 pm

Per requests above, here's some help getting lzap's fan control daemon up and running using a computer running Ubuntu (any recent version):

(I have a 310, apparently same model as lzap, so this is just a whole lot of "filler" to his instructions).

Step 1: Install Go

The process involved will depend on your system and setup. I installed Go on my Ubuntu x64 system. The version of Go available in the repositories doesn't cut it, since it the ARM compiler isn't included. After much wrangling, it turned out to be a lot easier to just compile Go myself and be done with it. Google has excellent docs explaining how to do this.

To do this in Ubuntu is quite simple. Yes, there are a few steps, but none are hard. You might be missing some build tools, but I wasn't, so I'm not sure if any were needed.

Code: Select all

$ sudo apt-get install mercurial
$ mkdir $HOME/go
$ export GOROOT=$HOME/go
$ hg clone https://code.google.com/p/go $GOROOT
Mercurial is the revision control tool used by Google for Go (similar to git, which we'll need to install in a bit). The first line installs that.

The second lines makes a directory for go in your home directory (we'll keep everything local) and the third sets an environment variable (for the current session only, so if you close the shell, you'll have to redo it) pointing to it.

The fourth line clones the Go code from Google (hg is the atomic symbol for mercury... hence mercurial).

Alright, we now have a full copy of the Go source. Compiling is almost trivial:

Code: Select all

$ cd $GOROOT/src
$ ./all.bash
$ export PATH=$PATH:$HOME/go/bin
And then we wait. Hopefully, nothing goes wrong in this step. It ran just fine on mine system. I suspect you might need to install some development tools ("make" etc.), but everything was already running on my system. The tests took quite a while to finish... And, while we're at it, might as well include the Go binaries in the current path.

The last part of installing Go is to make sure we can cross compile to ARM. Fortunately, there's a very nice set of scripts to do all that for you waiting in a git repository.

Code: Select all

$ sudo apt-get install git
$ git clone git://github.com/davecheney/golang-crosscompile.git
$ source golang-crosscompile/crosscompile.bash
$ go-crosscompile-build-all
First line installs git, second gets the scripts, third sets up a very handy method for calling the cross compiles, while the fourth does the actual build of all the go tools for all the supported architectures. You could probably save some time and just do it for linux/arm, which is what you'll need ("go-crosscompile-build linux/arm" instead).

That's it ;)


Step 2: Compile lzap's Fan Controller Daemon

This is a breeze once Go is up and running. If you have any problems, you might want to try compiling a "hello world" example first and seeing if it'll run on the NSA box (Google has some a detailed example).

Code: Select all

$ git clone github.com/lzap/fan3xxnsa
$ cd fan3xxnsa
$ GOARM=5 go-linux-arm build fan3xxnsa.go
Line one gets the source code from the git repository. Change to the project directory. And then compile.

GOARM=5 specifies the target ARM architecture as v5 by setting an environment variable just for that line (you could "export GOARM=5" on a separate line and have it set for the session) and go-linux-arm uses the crosscompile.bash that you source'd above.

Move it to your NSA box, run it, and you're done!

lzap
Posts: 39
Joined: Wed Dec 19, 2012 11:46 am

Re: New and lighweight fan control daemon for NSA 310

Post by lzap » Fri Nov 15, 2013 1:47 pm

I have updated README file of the fan3xxnsa, no changes in the code tho:

Now it is as easy as:

Code: Select all

    apt-get install git golang
    git clone https://github.com/lzap/fan3xxnsa.git
    cd fan3xxnsa
    ./install.sh

senthor
Posts: 1
Joined: Fri Jun 27, 2014 1:00 pm

Re: New and lighweight fan control daemon for NSA 310

Post by senthor » Fri Jun 27, 2014 1:17 pm

has anybody found a way to control the nsa310s?
i have no /sys/class/i2c-dev/i2c-0/device/0-002e folder.
however, the controller is the same:

Code: Select all

root@ZyXEL:/# cat /sys/class/i2c-dev/i2c-0/device/name
mv64xxx_i2c adapter

root@ZyXEL:/# cat /sys/class/i2c-dev/i2c-0/name
mv64xxx_i2c adapter
getting readings as with nsa325 works:

Code: Select all

root@ZyXEL:/# i2cget -y 0x0 0x0a 0x07
0x26

i2cget -y 0x0 0x0a 0x08
0x23
any ideas?

fyo
Posts: 3
Joined: Fri Jun 28, 2013 2:26 pm

Re: New and lighweight fan control daemon for NSA 310

Post by fyo » Thu Aug 17, 2017 8:45 am

senthor wrote:has anybody found a way to control the nsa310s?

any ideas?
TLDR: Yes, assuming it has the same fantrld (fan control daemon) as the non-s 310 (using your controller address):

Code: Select all

killall fanctrld
fanctrld -P 20 -I 0 -D 0 -S 10 -T0 45 -T1 45 -T2 45 -W0 1 -W1 0 -W2 0 0x0 0x0a 10
Long version:

I've switched (back) to using the existing fan control daemon. It turns out that the either the supplied arguments were wrong or the the sensors were switched around (hardware). Either way, the fan controller daemon is pretty advanced and does everything I could want it to... as long as it is supplied with the proper values!

If you start by running fanctrld from the command line, you should get something like this:

Code: Select all

Syntax: pidcontrold [-option] I2CBUS CHIP-ADDRESS [LowestPWM] [Tolerance]
  option will set P,I,D constant value by
     P d: assign d(decimal) value to P constant
     I d: assign d(decimal) value to I constant
     D d: assign d(decimal) value to D constant
     Tn c: Set setpoint of sensor Tn value c
     Wn d: Set Weight for each sensors
     S d: Set sampling rate to d seconds
     M d: Set multiple value for the error
     X d: Set the Maximum pwm value
     LowestPWM set the minimum pwm value
     Tolerance set the tolerance value, shoule be scale with 100
  I2CBUS is an integer
  Installed I2C busses:
    i2c-0       i2c             mv64xxx_i2c adapter
My old NSA 310 box has 1 fan and 3 temp sensors (T0,T1,T3). When controlling the fan speed, you need to primarily consider the temperature of the closest medium. Instant reaction to a temperate that is "far away" doesn't make much sense. In my case, the fan sits at the back of the box blowing room-temp air in, but the control daemon was using the "CPU" temp. In addition, the limits on the board and at least one of the case sensors was set very low, the result of which was that whenever the ambient room temperature climbed above about 23 deg C, the fan would max out.

fanctrld uses a P-I-D based approach to controlling the duty cycle of the fan.

Variables:


pwm (pulse width modulation) is the duty cycle expressed as an integer between 0 and 255 (the latter being 100%).

ST Set(point) Temperature, aka target temperature.

T Temperature (current).

P is the proportional response. This particular implementation sets the contribution to pwm at P*(ST - T).

Remember that you have temperatures from a number of sensors. The controller allows you to choose weights and target temps for each, along with the proportional response. The "D" value, which I've just set to zero, is an additional control that adjust fan speed according to the CHANGE in temperature (derivative). In my opinion, it's a bit of an overkill for this kind of system, but the support is there.

"I" in P-I-D is Integral and let's you add an adjustment based on the accumulated error, that is the length of time multiplied by the amount the temperature has been off it's set point. The result of this is that a non-zero value will have the fan speed increasing gradually the longer the temperature is over the set point. I've set I to zero.

In other words, I'm using this very advanced daemon and its many inputs in an incredibly simplified manner, but it works very well for me and has so for a couple of years now.

Code: Select all

killall fanctrld
fanctrld -P 20 -I 0 -D 0 -S 10 -T0 45 -T1 45 -T2 45 -W0 1 -W1 0 -W2 0 0x0 0x2e 10

lispykid
Posts: 1
Joined: Wed Aug 23, 2017 12:31 pm

Re: New and lighweight fan control daemon for NSA 310

Post by lispykid » Wed Aug 23, 2017 1:12 pm

Does anyone know where I can disable the temperature warning beep or where I can raise the warning variables?
I don't need it as the temp never reaches more than 70° CPU or 53°HD.
But the beeper goes off at 67°. Very annoying and needless as the spec for the chipset sees no problem with temperatures <100°.

Post Reply