Go Down

### Topic: 3 wire fans controlled by PWM? (Read 4026 times)previous topic - next topic

#### WindowMaker

##### Jan 13, 2012, 05:02 pm
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!

#1
##### Jan 13, 2012, 06:32 pmLast Edit: Jan 13, 2012, 06:36 pm by adilmalik Reason: 1
No matter how many wires (not less than 2 though   ), 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: [Select]
`int ledPin = 9;    // LED connected to digital pin 9void 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);                              } }`

#### WindowMaker

#2
##### Jan 13, 2012, 07:54 pm
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!

#3
##### Jan 13, 2012, 09:09 pm
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: [Select]
`int potPin = 0;                           // Analog pin 0 connected to the potentiometerint transistorPin = 9;                  // connected from digital pin 9 to the base of the transistorint potValue = 0;                       // value returned from the potentiometervoid 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...

Go Up