Page 1 of 1

Voltage Control of System Fan in Linux?

Posted: Thu Oct 02, 2008 11:31 pm
by rdibley
Everywhere I have searched, the only solution I have found to control fans within linux is to use the lm-sensors package and fancontrol. My problem is that fancontrol appears to work only with PWM fan controllers, and the fan header for the system fan on my motherboard only supports voltage control.

Does anybody know how to get fancontrol to work properly with a voltage control style fan controller? I have a GA-MA74GM-S2H motherboard. When I run the pwmconfig utility and try to profile the system fan, the linear variation of the PWM signal results in a strange non-linear voltage response, with voltage jumps, and sections with both increasing and decreasing voltages.

Posted: Fri Oct 03, 2008 12:05 am
by frenchie
lm-sensors works like a charm on my computer (took a while cuz I'm new to linux, but it works :-) ) and it controls both my CPU PWM fan and my voltage control case fan. Maybe your motherboard sensors are not supported by lm-sensors ?

Posted: Fri Oct 03, 2008 8:04 am
by rdibley
Thanks. I'll look into it a little more to see if it's something I'm just not setting correctly.

lm-sensors works fine with everything else. I'm able to see the readings of my motherboard sensors, and the fan speeds are reported accurately as far as I can tell. It is also capable of controlling my CPU fan just fine.

Posted: Fri Oct 03, 2008 10:50 am
by dukla2000
I am far from an expert on this, and struggling with exactly this issue on my new setup (780G based, not in my sig yet).

It does seem to me there is definite overlap with what ACPI is trying to do (via thermal zones and the BIOS/DSDT) and lm_sensors/fancontrol and potentially some conflicts. My current conclusion (perhaps in ignorance) is that the BIOS/ACPI 'solution' cannot be made to work. So I am about to head back to lm_sensors/fancontrol.

BUT ... it depends, as does speedfan in windows, on the mobo being wired correctly to enable fan speed control of the various headers. And I suspect while my mobo (Abit A-S78H) will quite happily report the fan speed on all 3 headers (CPU, SYS & AUX) it is actually only wired to vary the voltage/PWM of CPU. There may be some hints in your BIOS - in Abit-speak does uGuru/FanEQ allow any control of SYS and/or AUX? If not then highly likely fancontrol wont be able to either.

[edit]ps On re-reading your first post seems you are getting some movement on SYS? In which case just edit /etc/fancontrol manually to try smooth things out? [/edit]

Posted: Fri Oct 03, 2008 11:28 am
by woodsman
I'm guessing but I think for the voltage controlled fans to respond to fancontrol, the BIOS must provide the interface.

I have an Asus M2NPV-VM motherboard. I run Slackware 12.1.

Asus provides something called Q-Fan control, which is needed for lm-sensors to operate correctly.

On the Asus M2NPV-VM the CPU cooler fan is PWM. CPU_FAN1 is a three-pin voltage controlled connector, and responds nicely to my fancontrol script and configuration.

The motherboard contains two additional fan connectors, CPU_FAN2 and PWR_FAN. Neither of those two are voltage or PWM controlled. Both are three-pin but the BIOS only supports speed monitoring for PWR_FAN.

Check your BIOS to see which fans speeds are displayed. lm-sensors should be able to monitor the speed of those fans.

Check your motherboard manual for any information about fan control. I don't know whether Gigabyte provides a feature similar to the Asus Q-Fan.

Posted: Fri Oct 03, 2008 11:37 pm
by rdibley
From reading the lm-sensors FAQ, it appears as if fancontrol writes to memory addresses on either the ISA bus or the SMBus (depending on what you have on your motherboard) directly to control the fan speed. It is my assumption that the BIOS will control the fans using this interface, but if you run fancontrol, you will override these settings.

Which brings me to my revelation... I was trying to figure out how to get fancontrol to work properly with the voltage control mode on my System Fan header. My motherboard only supports voltage control and not PWM on the System fan, despite having a 4-pin header. After reading through the fancontrol documentation and getting nowhere, I remembered that the BIOS has a "Smart Guardian" feature which is basically the BIOS controlled System Fan speed based on the motherboard temperature. With the system on, I used a hair dryer to blow hot air on the motherboard and noticed a smooth increase in fan speed. So I think the standard BIOS controller will work fine for now, and maybe sometime in the future I'll get fancontrol to work. I'm guessing my chipset just isn't supported yet. My only problem with this approach is that my fans are 12V, and they sometimes won't even spin at the lower speeds. My plan is to build a circuit with a PIC microcontroller to output a PWM signal based on the system fan voltage signal from the header. That way, I can power the fans with 12V and not ever have to worry about them stalling.

By the way, yes, I was getting some motion from the fans when I ran pwmconfig when it stepped through the speed settings. The actual voltage pattern is too hard to describe here, but it was a combination of random jumps, staying steady, and a couple of areas of linear voltage variation over several steps. My best guess is that my specific chipset isn't yet supported fully yet. I did not see any settings in /etc/fancontrol or /etc/sensors.conf that looked capable of compensating for what I've seen.

Posted: Sat Oct 04, 2008 12:22 am
by dukla2000
rdibley wrote:My motherboard only supports voltage control and not PWM on the System fan, despite having a 4-pin header.
What I discovered is that my Abit has a BIOS option for 3- or 4-pin support of the CPU header and that fancontrol profile is different depending which BIOS option is selected (see post here). The weird thing is this option is buried under the FanEQ setup which I run disabled, but the 3/4 pin setting obviously sticks despite the parent option being subsequently disabled.

Also what I found is pwmconfig is temperamental - sometimes I run it and it 'gets' control of PWM (pwm2 only on my mobo even though 1-4 are available on the W83627 chip), and others it doesn't. Once with pwmconfig (and 'voltage' control of CPU fan header) I got a very linear range of PWM/RPM results: 255/1300rpm, 240/878rpm, 225/458rpm, 210/162rpm, 195/162rpm, 180/0rpm. Hence my current fancontrol config

Code: Select all

cat /etc/fancontrol
# Configuration file generated by pwmconfig, changes will be lost
FCTEMPS= hwmon1/device/pwm2=hwmon1/device/temp2_input
FCFANS= hwmon1/device/pwm2=hwmon1/device/fan2_input
MINTEMP= hwmon1/device/pwm2=40
MAXTEMP= hwmon1/device/pwm2=60
MINSTART= hwmon1/device/pwm2=210
MINSTOP= hwmon1/device/pwm2=195

Posted: Tue Oct 07, 2008 8:52 pm
by rdibley
Well.... it's amazing what you can learn by simply reading the manual.

My motherboard manual says that the CPU header (4-pin) is PWM or voltage controlled. I have it set up as PWM and it works great. The SYS header (also 4-pin) is voltage control only. The PWM pin is NC (not connected). Strange that they would use a 4-pin header but not use the fourth pin. I contacted Gigabyte asking if it was something that might be available in a future BIOS update, but they said there are no plans to do so.

I have measured a voltage on the PWM pin, so it's connected to something. It might be possible that this header could be configured as PWM and that Gigabyte will update the BIOS at some point, but I'm not holding my breath.

Currently, I have abandoned trying to get fancontrol to work in voltage control mode. I have fallen back to allow the BIOS automatic control of the temperature, which works ok. The only problem is that the system fans sometimes don't come on when the system starts because the voltage is too low. I am going to look into building a circuit to translate the header voltage into a PWM signal, but that might not happen for a while. In the mean time, it's ok as it is.

Thanks for the advice!