Go Down

Topic: FAN PWM Control (Read 812 times) previous topic - next topic

taz3m

Feb 15, 2013, 02:51 pm Last Edit: Feb 15, 2013, 02:56 pm by taz3m Reason: 1
Hello to all,

Im just testing the phase of controlling a FAN with temperature and playing around with 3 different speed level.

However, i noticed that if i just connect a direct 5V to the FAN it spin to its full speed.

Whereas, when im analogWrite (FanPin,255); the Fan do not spin at its full speed likewise when directly connected to 5V supply.

Another observation is when output has been activated a small push needs to be performed on the fan for it to start spinning, and at the same time its always have a whining noise.

Below is my code for the testing, i used a potentiometer to simulate same:

Any suggestion please . .

Thanks for responses.

Code: [Select]


const uint8_t FanPin = 3;    // Fan connected to digital pin 3 with PWM capability

const uint8_t PotSim = 0;

uint8_t FanCtrl;
uint8_t FanSpd_1 = 65;
uint8_t FanSpd_2 = 128 ;
uint8_t FanSpd_3 = 255;


void setup()  {
   
  Serial.begin (9600);
   
   pinMode(FanPin,OUTPUT);
}

void FanCtrl_1(){


    analogWrite(FanPin, FanSpd_1);         
    // wait for 30 milliseconds to see the effect   
    delay(30);                           
  }


void FanCtrl_2 (){
 
    analogWrite(FanPin, FanSpd_2);         
    // wait for 30 milliseconds to see the effect   
    delay(30);                           
  }


void FanCtrl_3(){

    analogWrite(FanPin, FanSpd_3);         
    // wait for 30 milliseconds to see the effect   
    delay(30);                           
  }


void loop()  {

  int TempSim = analogRead(PotSim);
 
  if (TempSim >=100 && TempSim <= 350){
    FanCtrl_1();}
   
    if (TempSim >=350 && TempSim <= 700){
      FanCtrl_2();}
     
       if (TempSim >=700 && TempSim <= 1024){
       FanCtrl_3();}
 
  delay (500);
 
  Serial.print ("Sim-Value = ");
  Serial.println (TempSim);
 
// delay(1000);

}


[code/]
tz
.....

mmcp42

I strongly advise AGAINST connecting the fan directly to the 'duino
a) it will draw far too much current and PROB90 kill the pin it's connected to
b) electric motors generate back EMF that will kill the pin it's connected to

put a transistor in there, with a revrse biased diode across the motor
then you may see more sensible results
and your 'duino will survive to tell the tale!
there are only 10 types of people
them that understands binary
and them that doesn't

tuxduino

Please search for "pwm fan control" and you'll find many suggestions on the hardware and software side.

For example have a look at this old thread:

http://arduino.cc/forum/index.php/topic,132300.0.html

fungus


Code: [Select]

// Fan connected to digital pin 3 with PWM capability



Stop there, switch everything off, disconnect all the wires.

There's no way an Arduino pin can drive a fan directly. The only thing you'll achieve is to break the Arduino.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Veco

As a fan is a motor you have to contend with something known as "inrush current". This is generally taken to be six times the full load current (on large motors, no idea what it is on small fans). The datasheet should tell you what the full load and starting currents will be at a voltage.

With that in mind consider that the Arduino can only source a rather small amount of current, if you put anything that's good at sinking current (motors, hint hint) you'll end up overheating and damaging your microcontroller.

What you need to do is have an external supply with the Arduino controlling that supplies path to the motor, you could use a transistor for example. You might also want to add protection like optical isolation and diodes to prevent back emf.

taz3m

Hello to all,

Thats indeed right about all your post here, i have rather quite a long time not dealt with motors, where i did forget somehow all the precautions to be taken. But indeed my forgetfullness would have made me lost few things . .  :) luckily im saved . . Thanks

About the inrush current its right, i planned to PWM a brushless DC motor with a 24Vdc, but since i had a small fan 5V supply with a consumption of 0.16 A, i thought i could tinker a bit with the PWm before moving towards a bigger load.

Is there any thread or link someone can help me with in understanding the basic circuits behind connecting the load with transistors and eventually with reverse bias diode.

Thanks

Regards

Tazlim.
tz
.....

taz3m

Hello,

I just gone through some readings and come across positive voltage regulator. I do have some in hands having reference L7805CV.
http://html.alldatasheet.com/html-pdf/22634/STMICROELECTRONICS/L7805CV/1621/1/L7805CV.html

Can i use these voltage regulators to connect with my fan load.

My apologise in asking these stufss which may sound silly, as im noob in circuit designs..

Alternatively i do have 1 transistor NPN S9013.

http://www.hz-dz.net/UploadFiles/200952711452305.pdf

Meanwhile i will continue my readings and geet to my PWM objective for my fans . . :)

Cheers . .
tz
.....

Go Up