Go Down

Topic: Powering on and off a MOSFET (to control an air compressor) (Read 747 times) previous topic - next topic

alfakher

Need a little guidance. I have an UNO R3, I looked up how to control a MOSFET with Arduino and people are saying through one of the Digital outputs and PWM?

I am building an automated air compressor, which uses a pressure sensor (b



Couple questions:

I need the Arduino to switch voltage on and off to control the MOSFET. Can I turn the power supply voltage (5V) on and off through code, or is it always on? And if I can't turn it off, what is the voltage that comes out of the digital pins when I use digitalWrite(pin, value)?

Is a breadboard too weak to handle being connected to an air compressor (12VDC Car powered), I'm thinking I should wire the MOSFET to the air compressor directly


Grumpy_Mike

Quote
Can I turn the power supply voltage (5V) on and off through code,

No it is always on.
Quote
what is the voltage that comes out of the digital pins when I use digitalWrite(pin, value)?

The voltage is either 5V or 0V, note the limit of current you should draw or sink is less than 40mA.

Quote
Is a breadboard too weak

I am not a fan of breadboard I would solder all the wires up on strip board.

alfakher

Thanks Grumpy_Mike!

Also, I've been reading that a "protection diode" from drain to voltage source, as well as a resistor (100-200 ohms) from gate to ground, is recommended for mosfets (I think I'll be using the IRF510 from radio shack..seems like a popular one and it fits my project).

2 questions here.. If I am controlling the voltage from the Arduino's digital out, which should power off the mosfet at will, why do I need a resistor? Does it somehow shut it off faster?

And what is the protection diode for?

(Oops that was 3 questions :p Sorry for all the noobish questions, but they don't really teach this stuff in class, so trying to figure it out through google and arduino forum searches get confusing when I'm struggling to understand the concepts)

Grumpy_Mike

Quote
I think I'll be using the IRF510 from radio shack

No do not, you want a logic level FET, this will not turn on with 5V on the gate.

Quote
as well as a resistor (100-200 ohms) from gate to ground, is recommended for mosfets

No a 10K is recommended to ensure that the FET is off when the arduino is off. You need a 100R resistor in line with the gate to protect the arduino's output pin from too much current.

Quote
And what is the protection diode for?

To short out a reverse voltage that is generated when turning off an inductive load.

dhenry

Quote
using the IRF510 from radio shack..seems like a popular one and it fits my project).


It may be popular for others but that doesn't mean it is the right one for your application: you need to know much current you are switching to see if irf510 is the right one.

Quote
2 questions here.. If I am controlling the voltage from the Arduino's digital out, which should power off the mosfet at will, why do I need a resistor? Does it somehow shut it off faster?


You don't need it. It is only needed if you want to blow up your mosfet.

Grumpy_Mike

Quote
You don't need it. It is only needed if you want to blow up your mosfet.

Another piece of dhenry wisdom, pray tell how a resistor from gate to ground will blow up a FET.

Go Up