GithubHelp home page GithubHelp logo

khorton / nas_fan_control Goto Github PK

View Code? Open in Web Editor NEW
71.0 11.0 31.0 289 KB

collection of scripts to control fan speed on NAS boxes

License: BSD 2-Clause "Simplified" License

Perl 98.19% Shell 1.81%

nas_fan_control's Introduction

nas_fan_control

collection of scripts to control fan speed on NAS boxes

PID_fan_control.pl - Perl fan control script based on the hybrid fan control script created by @Stux, and posted at: https://forums.freenas.org/index.php?threads/script-hybrid-cpu-hd-fan-zone-controller.46159/ . @Stux's script was modified by replacing his fan control loop with a PID controller. This version of the script was settings and gains used by the author on a Norco RPC-4224, with the following fans:

  • 3 x Noctua NF-F12 PWM 120mm fans: hard drive wall fans replaced with .
  • 2 x Noctua NF-A8 PWM 80mm fans: chassis exit fans.
  • 1 x Noctua NH-U9DX I4: CPU cooler.

The hard drive fans are connected to fan headers assigned to the hard drive temperature control portion of the script. The chassis exit fans and the CPU cooler are connected to fan headers assigned to the CPU temperature control portion of the script.

See the scripts for more info and commentary.

Discussion on the FreeNAS forums: https://forums.freenas.org/index.php?threads/pid-fan-controller-perl-script.50908/

nas_fan_control's People

Contributors

bcran avatar khorton avatar richieb2b avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nas_fan_control's Issues

Fan changing speed before dropping bellow med temperature

I think that something is wrong with the script! From what I see, if a CPU temp goes over "$high_cpu_temp" the fans go "high", and then should go "med" if droped bellow "med_cpu_temp". But from what I see, my fans go from "high" to "med" when temperature goes bellow "$high_cpu_temp", this makes the spinning very spiky. Going Full and low every few secconds:

DEBUG_LOG 2020-06-19 18:45:34: core_temp = 48.0 C
DEBUG_LOG 2020-06-19 18:45:34: core_temp = 47.0 C
DEBUG_LOG 2020-06-19 18:45:34: core_temp = 50.0 C
DEBUG_LOG 2020-06-19 18:45:34: core_temp = 50.0 C
DEBUG_LOG 2020-06-19 18:45:34: core_temp = 56.0 C
DEBUG_LOG 2020-06-19 18:45:34: core_temp = 56.0 C
DEBUG_LOG 2020-06-19 18:45:34: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:34: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:34: CPU Temp: 56.0
DEBUG_LOG 2020-06-19 18:45:34: CPU Temp: 56.0 >= 55, CPU Fan going high.
DEBUG_LOG 2020-06-19 18:45:34: CPU Fan: high
DEBUG_LOG 2020-06-19 18:45:34: CPU Fan changing... (high)
DEBUG_LOG 2020-06-19 18:45:34: Setting Zone 0 duty cycle to 100%
DEBUG_LOG 2020-06-19 18:45:35: core_temps:
53.0
53.0
54.0
55.0
53.0
53.0
51.0
55.0
DEBUG_LOG 2020-06-19 18:45:35: core_temp = 53.0 C
DEBUG_LOG 2020-06-19 18:45:35: core_temp = 53.0 C
DEBUG_LOG 2020-06-19 18:45:35: core_temp = 54.0 C
DEBUG_LOG 2020-06-19 18:45:35: core_temp = 55.0 C
DEBUG_LOG 2020-06-19 18:45:35: core_temp = 53.0 C
DEBUG_LOG 2020-06-19 18:45:35: core_temp = 53.0 C
DEBUG_LOG 2020-06-19 18:45:35: core_temp = 51.0 C
DEBUG_LOG 2020-06-19 18:45:35: core_temp = 55.0 C
DEBUG_LOG 2020-06-19 18:45:35: CPU Temp: 55.0
DEBUG_LOG 2020-06-19 18:45:35: CPU Fan: high
DEBUG_LOG 2020-06-19 18:45:36: core_temps:
52.0
52.0
52.0
52.0
57.0
57.0
54.0
54.0
DEBUG_LOG 2020-06-19 18:45:36: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:36: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:36: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:36: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:36: core_temp = 57.0 C
DEBUG_LOG 2020-06-19 18:45:36: core_temp = 57.0 C
DEBUG_LOG 2020-06-19 18:45:36: core_temp = 54.0 C
DEBUG_LOG 2020-06-19 18:45:36: core_temp = 54.0 C
DEBUG_LOG 2020-06-19 18:45:36: CPU Temp: 57.0
DEBUG_LOG 2020-06-19 18:45:36: CPU Fan: high
DEBUG_LOG 2020-06-19 18:45:39: core_temps:
52.0
52.0
53.0
53.0
60.0
59.0
55.0
55.0
DEBUG_LOG 2020-06-19 18:45:39: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:39: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:39: core_temp = 53.0 C
DEBUG_LOG 2020-06-19 18:45:39: core_temp = 53.0 C
DEBUG_LOG 2020-06-19 18:45:39: core_temp = 60.0 C
DEBUG_LOG 2020-06-19 18:45:39: core_temp = 59.0 C
DEBUG_LOG 2020-06-19 18:45:39: core_temp = 55.0 C
DEBUG_LOG 2020-06-19 18:45:39: core_temp = 55.0 C
DEBUG_LOG 2020-06-19 18:45:39: CPU Temp: 60.0
DEBUG_LOG 2020-06-19 18:45:39: CPU Fan: high
DEBUG_LOG 2020-06-19 18:45:40: core_temps:
52.0
53.0
51.0
54.0
54.0
54.0
54.0
54.0
DEBUG_LOG 2020-06-19 18:45:40: core_temp = 52.0 C
DEBUG_LOG 2020-06-19 18:45:40: core_temp = 53.0 C
DEBUG_LOG 2020-06-19 18:45:40: core_temp = 51.0 C
DEBUG_LOG 2020-06-19 18:45:40: core_temp = 54.0 C
DEBUG_LOG 2020-06-19 18:45:40: core_temp = 54.0 C
DEBUG_LOG 2020-06-19 18:45:40: core_temp = 54.0 C
DEBUG_LOG 2020-06-19 18:45:40: core_temp = 54.0 C
DEBUG_LOG 2020-06-19 18:45:40: core_temp = 54.0 C
DEBUG_LOG 2020-06-19 18:45:40: CPU Temp: 54.0
DEBUG_LOG 2020-06-19 18:45:40: CPU Temp: 54.0 >= 45, CPU Fan going med.
DEBUG_LOG 2020-06-19 18:45:40: CPU Fan: med
DEBUG_LOG 2020-06-19 18:45:40: CPU Fan changing... (med)
DEBUG_LOG 2020-06-19 18:45:40: Setting Zone 0 duty cycle to 60%
DEBUG_LOG 2020-06-19 18:45:41: core_temps:

I think that should only go med when temperature is 45

probably works with X11DPH-T

Hello, I have this board

dmidecode -t 2
# dmidecode 3.4
Getting SMBIOS data from sysfs.
SMBIOS 3.1.1 present.

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
	Manufacturer: Supermicro
	Product Name: X11DPH-T
	Version: 1.10

I'm using several commands from your script (not the entirety of the script) but they all work. e.g.

#READ FAN MODE
#ipmitool raw 0x30 0x45 0x00

# SET FAN MODE TO "FULL"
ipmitool raw 0x30 0x45 0x01 0x01

#set zone 0 to 60%
ipmitool raw 0x30 0x70 0x66 0x01 0x00 0x60

These work fine. All the other modes work correctly too but these are what I'm using. So we can say this board works as well.
In the script comments a few boards that work and wanted to add this one to the list so others know.

# the X11SSM-F.


Also I see this is an error everywhere but just wanted to say my numbers if it helps anyone:
my fans at 60% (according to ipmitool) are actually at 100%.
It thinks that 3000RPM is their max even though ipmitool sensor says 25500.000 this is wrong twice over.
Internally it thinks that number is "3000" not "25500.000"
Because via ipmitool 50% fan speed = 1500
60% fan speed = 1800
etc
Therefore we can see that it is thinking 3000rpm is the max.
and to repeat again: however via ipmitool sensor it says 25500.000 lol

and manufacturer noctua of fan says 1800 is max.

so ipmitool reads the BMC wrong and then the BMC reads the fan wrong? not sure how that is double wrong but it is.

Missing Default values

It's been a while since I have coded in Perl, but I think there is a problem with read_config sub in the current version of the script.

In the PID_fan_control.pl script, the sub read_config (line 1307 - 1324) the config file is executed which sets the $config_xxx variables.
Those are then assigned to the global variables, or if not defined, the $default_xxx variables are assigned.

The problem that I see is that the $default_xxx values are never assigned, So if one of the variables is missing from the $config_file, the global variable's value is set to null.

I haven't run the scripts to see what happens for each of the cases, but I'm pretty sure that is not something that would be desired.

The complex solution would be to define the $default_xxx values in the global configuration area of the script.
The simpler solution, I think, would be to replace the $default_xxx values with the values existing values, i.e.
$Kp = $cofig_Kp // $default_Kp;
would become:
$Kp = $cofig_Kp // $Kp;

I think you ran into this problem because the #hd_fan_duty_start was commented out of the FAN CONFIGURATION section with the comment:
# HD fan duty cycle when script starts - defined in config file
but it was added back in the DEFAULT VALUES area.

As I said it has been a while since I have walked through a Perl script, so if my assumptions are wrong I apologize for wasting your time.

Linus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.