I realise theres a lot of threads about this but I cant seem to find anything that fixes this. **Im trying to control the speed of my 4-pin Intel stock fan by means of the PWM signal.**
#include <PWM.h>
#define fanPWM 9
const int32_t frequency = 250000; //frequency (in Hz)
void setup() {
Serial.begin(9600); // serial monitor
// Initializing Pins
pinMode(fanPWM, OUTPUT);
// Adjusting PWM frequency for Fan pins
InitTimersSafe();
if(SetPinFrequencySafe(fanPWM, frequency)){
Serial.println("success");
} else{
Serial.println("failed");
}
analogWrite(fanPWM, 255);
}
void loop() {
}
My approach is as follows,
Change the PWM frequency to 25kHz by using the PWM library.
Provide a 0 PWM value to give a 0% duty cycle meaning the fan should switch off. Provide a 255 PWM value to give a 100% duty cycle mean the fan should be at max RPM.
The problem that I am having is that the fan doesnt seem to respond well to the analogWrite PWM values. For example if I give a 255 analogWrite the RPM goes quite low but with a value of 0, it goes faster but still nowhere near its max RPM capabilities. Anything in between doesnt seem to be scaling at all. Its almost as if it has two states, one super low and one low. I cannot figure out why this is happening? Perhaps Intel has some sort of IC built into this making it a smart fan?
Wawa:
The 'smart fan' part is correct. Only a 3-pin fan needs external mosfet control.
Remove the fet.
Connect the PWM pin from the Arduino directly to the PWM pin of the fan.
Leo..
Just tried that. Its working slightly better. If I set a PWM value of 0, the fan goes super quiet but still doesnt turn off. A PWM value of 10 and its the exact same as 0. A PWM value of 20 and it definitely increases in speed. And a PWM value of anything from 30-255 is slightly louder but definitely not at max. A value of 30 and 255 sounds the exact same. Not sure whats happening. I don`t have an oscilloscope to check the PWM signal with.
I know the PWM frequency change worked fine because the code outputs a success.
I just tried it with some older Intel 4 pin fans from the Core 2 Duo era, at a PWM value of around 20(not 20%) or higher they spin to max RPM but anything lower than that and it goes quite low. Using any value from 20 to 255 gives the same RPM.