Pages: [1]   Go Down
Author Topic: 3 wire fans controlled by PWM?  (Read 1167 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have read in several places that 3 wire 12v fans are controllable via PWM (low frequency). However I dont have a ton of understanding on PWM or the difference between low and High frequency. I am also not coming up with much when it comes to wiring diagrams as to how this will work. I dont particularly care about the tach output, but if I can make it work without an obsurd amount of effort I would like to retain that as well.

the goal is to have several onewire temp sensors (already have those working) feed a temp to the board and have the board turn the fans on at different speeds based on the average temperature that the sensors are reading.

The reason for using 3 wire is that I work for an electronics retailer and have access to 3 wire 80mm fans for $1 each. I also have access to 4 wire fans but they are 120mm and I dont think that will fit into my project.

Please let me know if you have any input on this one.
Thanks!

Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 184
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No matter how many wires (not less than 2 though  smiley-razz ), you can control it with Pwm. You will need power transistors, to switch a high current fan, and a flyback diode,and pwm is quite easy to setup in arduino ide. As far as your third wire is concerned, it is used to keep track of the fans RPM, incase you want it at a certain speed.

And you programming also wont be too difficult you can use the simple analog in analog out example to your needs.

Code:
int ledPin = 9;    // LED connected to digital pin 9

void setup()  {
  // nothing happens in setup
}

void loop()  {
  // fade in from min to max in increments of 5 points:
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);         
    // wait for 30 milliseconds to see the dimming effect   
    delay(30);                           
  }

  // fade out from max to min in increments of 5 points:
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);         
    // wait for 30 milliseconds to see the dimming effect   
    delay(30);                           
  }
}



Now you can add analogread to it.
« Last Edit: January 13, 2012, 12:36:02 pm by adilmalik » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow, that is much easier than I thought on the PWM coding. Any idea where I could find a wiring diagram? fan specs are +12vdc, 200ma.

thanks!
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 184
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The wiring is easy, i dont think your fan can be 200ma, under load it can exceed that, so use this circuit:

This circuit can be used:
http://www.rcrowley.com/images/ArduinoTIP120motor.png

This one is very similar to your project:
http://www.uchobby.com/index.php/2007/09/23/arduino-temperature-controlled-pc-fan/#more-70

Code:
int potPin = 0;                           // Analog pin 0 connected to the potentiometer
int transistorPin = 9;                  // connected from digital pin 9 to the base of the transistor
int potValue = 0;                       // value returned from the potentiometer

void setup() {                          // set  the transistor pin as an output
  pinMode(transistorPin, OUTPUT);
}

void loop() {                           // read the potentiometer, convert it to between 0 - 255 for the value accepted by the digital pin.
  potValue = analogRead(potPin) / 4;    // potValue alters the supply from pin 9 which in turn controls the power running through the transistor
  analogWrite(9, potValue);
}

This is the code i found for simpler pwm control, you can replace the pot with your temperature sensor, ofcourse you will need a few more calculations...

Logged

Pages: [1]   Go Up
Jump to: