Trouble with 5v mini-fan

Hey guys, i just bought a 5v mini fan and im trying to make it work. But apparently i am missing something, i connected it to GND and to my pin port 2, and i am using HC-06 to send commands via phone through it, however the output is comming nothing more than 1.99V, what am i doing wrong here?

In any case, this is my code

int ledazul = 8; // LED VERMELHO
int scLed1 = 9; // LED 1 do smartcine 
int scLed2 = 10; // LED 2 do smartcine
int scLed3 = 11; // LED 3 do smartcine
int scLed4 = 12; // LED 4 do smartcine
int scLed5 = 13;
int fan = 7;

char val;
void setup() {
  pinMode(ledazul, OUTPUT);
  Serial.begin(9600);
  }
void loop() {
  if(Serial.available()> 0)
  {
    val=Serial.read();
  }else{
      //Serial.println("Indisponível");
    }
    bool ledState = false;
    if(val == 'A')
    {            
      digitalWrite(ledazul, HIGH);
      ledState = true;
      }
    if(val == 'B')
    {
    digitalWrite(ledazul, HIGH);
    ledState = true;
    }
        if(val == 'C')
    {
    digitalWrite(scLed1, HIGH);
    ledState = true;
    }
        if(val == 'D')
    {
    digitalWrite(scLed2, HIGH);
    ledState = true;
    }
        if(val == 'E')
    {
    digitalWrite(scLed3, HIGH);
    ledState = true;
    }
    if(val == 'F')
    {
    digitalWrite(scLed4, HIGH);
    ledState = true;
    }
    if(val == 'G')
    {
     digitalWrite(scLed5, HIGH);
    }
    if(val == 'S')
    {
    digitalWrite(fan,HIGH); 
   }
  }

Quote-tags are NO code tags. Please read How to use the forum.

Next, you can NOT connect a fan directly to an Arduino. Do you have a link to the fan and a schematic? (NO Fritzing breadboard mess.)

septillion:
Quote-tags are NO code tags. Please read How to use the forum.

Next, you can NOT connect a fan directly to an Arduino. Do you have a link to the fan and a schematic? (NO Fritzing breadboard mess.)

Sorry, i fixed it. Second, literally is just a fan like this this one: https://pt.aliexpress.com/item/2PCS-50x50x10mm-GDT-DC-5V-50mm-50-10mm-2P-Mini-Cooler-Radiator-Motor-Fan-5cm-Cooling/32619711621.html?src=google&albslr=202045511&isdl=y&aff_short_key=UneMJZVf&source={ifdyn:dyn}{ifpla:pla}{ifdbm:DBM&albch=DID}&src=google&albch=shopping&acnt=494-037-6276&isdl=y&albcp=757120293&albag=45449013012&slnk=&trgt=87981925924&plac=&crea=pt32619711621&netw=g&device=c&mtctp=&gclid=EAIaIQobChMIzMrs06Tx2QIVVAmRCh3R7QnbEAQYAiABEgKQxvD_BwE

i dont have the schematic, since i was just playing with it, despite all the code

Your link says the fan takes 0.14A (140mA). The maximum current it is safe to take out of a digital pin in about 20mA.

140mA is a lot more than 20mA. You see the problem? You need a transistor or MOSFET to switch the fan.

Steve

slipstick:
Your link says the fan takes 0.14A (140mA). The maximum current it is safe to take out of a digital pin in about 20mA.

140mA is a lot more than 20mA. You see the problem? You need a transistor or MOSFET to switch the fan.

Steve

Lol yes, i assumed it would come to this, would you kindly recommend to me and my ignorance a transistor that can boost the output current?

Like every NPN or N channel which can handle at least 200mA. A cheap one would for example be the S9013. Also, don't forget to add a flyback diode. For a small motor a 1N4148 will do. See

pinMode(ledazul, OUTPUT);

you do a lot of digitalWrite stuff to many things that never got the chance to be as cool as ledazul who had the honor of being made an OUTPUT.

slipstick:
Your link says the fan takes 0.14A (140mA). The maximum current it is safe to take out of a digital pin in about 20mA.

140mA is a lot more than 20mA. You see the problem? You need a transistor or MOSFET to switch the fan.

Steve

so you're saying that a transistor or MOSFET will provide the lack of current, boosting it from 20ma to 140ma?

It will not really boost it, it will only switch the 5V without burning :smiley:

septillion:
It will not really boost it, it will only switch the 5V without burning :smiley:

Hm, thats not what i was looking for, do you have any idea how can i actually deal with the current difference?

I don't know what you think you are looking for but the circuit in post #5 is what you need.

What are you using to power the Arduino? USB? Power supply? Battery? The odds are it can provide enough current for the fan where one of the digital pins cannot. The way you get round that is by using the digital pin to SWITCH the current you need to the fan via a transistor. That way the current is provided by the power supply and not directly from the digital pin.

Instead of just worrying about what you think you need just try what you've been given and your fan will work.

Steve

slipstick:
I don't know what you think you are looking for but the circuit in post #5 is what you need.

What are you using to power the Arduino? USB? Power supply? Battery? The odds are it can provide enough current for the fan where one of the digital pins cannot. The way you get round that is by using the digital pin to SWITCH the current you need to the fan via a transistor. That way the current is provided by the power supply and not directly from the digital pin.

Instead of just worrying about what you think you need just try what you've been given and your fan will work.

Steve

Ahhh, i didnt take into consideration the fact im using USB output from PC to charge my arduino, i need to verify the output on my 9v font. Also, i wonder, do i get 5v specifically from the 5volts PORT only, or any pin ports would also output 5v? Last question, i dont really understand why would i need a diode, is it mandatory?

The USB cable is not "charging" the Arduino. It is powering it.

The fan can be connected to the 5V pin on the Arduino. That's the only one that can supply enough current. Yes the diode is mandatory even if you don't understand it.

I have no idea what "my 9V font" means. And PORT has a specific meaning in this context and it doesn't mean the same as pin so I don't know what you're talking about there either.

Steve

slipstick:
The USB cable is not "charging" the Arduino. It is powering it.

The fan can be connected to the 5V pin on the Arduino. That's the only one that can supply enough current. Yes the diode is mandatory even if you don't understand it.

I have no idea what "my 9V font" means. And PORT has a specific meaning in this context and it doesn't mean the same as pin so I don't know what you're talking about there either.

Steve

i didnt imply it was charging, to my understanding the arduino has its own voltage regulator, therefore i assumed my pc would feed only 5v, whereas, previously, i was relying on a 9v previously and considered the possibility of a higher output tension, if i had a higher input tension value and lastly, i am sorry for the misuse of term. I understand how the diode works, i just crossed fingers that i wasnt going to need one, cause i cant buy it today lol.

But yea, but just to clear things, i need a transistor or a MOSFET to drive the tension from the 5v pin, and only then can i connect the fan to the arduino, right?

After that i would need a diode to handle the DC/AC I/V, right?

What AC?

This is all DC.

The diode prevents things being destroyed by inductive kick-back. Its always needed when switching DC supply to any inductive load.

MarkT:
What AC?

This is all DC.

The diode prevents things being destroyed by inductive kick-back. Its always needed when switching DC supply to any inductive load.

I see, thanks.

septillion:
Like every NPN or N channel which can handle at least 200mA. A cheap one would for example be the S9013. Also, don't forget to add a flyback diode. For a small motor a 1N4148 will do. See

I followed your schematics but for some reason the output is comming 4.70v which isnt turning the fan on, i was asking myself if it could be because i am already using a bluetooth module connected to the 5v pin, and then i was thinking if i connected a second battery specifically for the transistor so i could switch it, could it work?

What transistor are you using? What value for resistor RB? What is the actual voltage across the fan, i.e. from 5V to the collector of the transistor?

Steve

slipstick:
What transistor are you using? What value for resistor RB? What is the actual voltage across the fan, i.e. from 5V to the collector of the transistor?

Steve

im using a IRF540N, im not using a resistor, and from pin 7 (which is the actual) into the base i get 4,70v - 4,80v. From the emitter into the fan i get same results 4,70 - 4,80v.

That is not a logic level MOSFET. It cannot be fully switched on from a 5V digital pin. And because it is a MOSFET it doesn't have a base or emitter.

And the important voltage is across the fan i.e. between the two leads of the fan.

Steve