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);
}
}
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 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.
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.
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?
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?
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.