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