Pages: [1]   Go Down
Author Topic: FAN PWM Control  (Read 659 times)
0 Members and 1 Guest are viewing this topic.
Mauritius
Offline Offline
Jr. Member
**
Karma: 2
Posts: 95
Learning Never Ends . . .
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

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/]
« Last Edit: February 15, 2013, 08:56:43 am by taz3m » Logged


tz
.....

Leighton Buzzard, UK
Offline Offline
Edison Member
*
Karma: 21
Posts: 1339
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

there are only 10 types of people
them that understands binary
and them that doesn't

Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5350
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
// 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.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

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

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.
Logged

Mauritius
Offline Offline
Jr. Member
**
Karma: 2
Posts: 95
Learning Never Ends . . .
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 . .  smiley 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.
Logged


tz
.....

Mauritius
Offline Offline
Jr. Member
**
Karma: 2
Posts: 95
Learning Never Ends . . .
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 . . smiley

Cheers . .
Logged


tz
.....

Pages: [1]   Go Up
Jump to: