Go Down

Topic: 3 wire fans controlled by PWM? (Read 1 time) previous topic - next topic

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.


Jan 13, 2012, 06:32 pm Last Edit: Jan 13, 2012, 06:36 pm by adilmalik Reason: 1
No matter how many wires (not less than 2 though  :P ), 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 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   

  // 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   

Now you can add analogread to it.

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.



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:

This one is very similar to your project:

Code: [Select]
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...

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131