I am looking at getting 2 Evercool EC8015HH12BP 80x10mm (4-wire) PWM fans. However, I am looking at controlling the fan speed with the arduino via the PWM pins.
I found the following diagram that seems to be what I am looking for in order to hook the fan up to the Arduino:
The code that I think I can use is this:
int pwmPin = 9; // digital pin 9
int pwmVal = 10;
void setup()
{
pinMode(pwmPin, OUTPUT); // sets the pin as output
Serial.begin(9600);
}
void loop()
{
if (pwmVal != 255) {
analogWrite(pwmPin, pwmVal);
//pwmVal += 10;
Serial.print(pwmVal); // Print red value
Serial.print("\n"); // Print a tab
} else {
Serial.print('at max high'); // Print red value
Serial.print("\n"); // Print a tab
}
delay(1000);
}
I gather that the PWM would be in the range of 0-255 when writing out to it from the ardunio? I will be using the DS18B20 Thermometer Temperature Sensor in order to see how fast I need to spin the fan.
However, the fan speed (max 12V right now) never slows down one bit.
I'm using D9 on the Arduino Nano ATmega 328.
The reference is here for the board (in case i have the board pin wrong): enter link description here
Any helpful feedback would be great!
No comments:
Post a Comment