# Switching a Circuit on/off with a MOSFET

I have have a simple circuit that I want to drive with a raspberry pi GPIO pin and I want to use a MOSFET to control the circuit. My circuit will be using about 3-5v and 2-3a.

I'm planning on using a IRLB3034PBF. Or maybe an IRF510 since that is available in a physical store at RadioShack.

From what I've read and tried to understand from the datasheets, my 3-5v and 2-3a should be well below the limit of either... But can I drive it with a raspberry pi or arduino?? And am I correct in my reading of the datasheets?

Also, in a lot of diagrams I've seen for this type of circuit online, there is a resistor from the Gate to the GPIO pin. Why is that?

Edit: From what I can tell on the datasheets, Vgs is only limited to +-20V for either. How can one tell that the IRF510 would be a bad fit? Is it because the max Gate Threshold Voltage is 4V which is greater than 3V3?

Thank you for all of your help everyone! I'm a software guy so this low level circuit stuff is still new to me.

• The IRF510 might not be a good choice to be driven directly from a Pi's GPIO pin. 3V3 is a little too low as V_GS for your desired drain current. The listed max threshold voltage V_GS is 4V, so any particular IRF could have a threshold of up to 4V - and therefore not be sufficiently saturated at 3V3.
– Ghanima
Jan 17, 2016 at 20:51
• I just posted a question about a different MOSFET. Take a look here and please answer or comment: raspberrypi.stackexchange.com/questions/72884/… Sep 23, 2017 at 21:17

Not enough rep to comment, so here's a very short answer. If your MOSFET is too 'stiff', you can add a BJT driver, i.e. a bipolar transistor stage that will accept the GPIO input and will pilot the fet in the second stage with the required voltage.

See the answer to this question for a schematic:

https://electronics.stackexchange.com/questions/169211/using-npn-bjt-with-a-p-channel-mosfet-to-switch-3-3v-to-24v

2N3904 and 2N2222 are 'jellybean' transistors: they are everywhere and cost a fraction of a penny.

Or you could use a "logic level MOSFET". User mindcrime in his/her answer here

https://electronics.stackexchange.com/questions/13075/is-it-safe-to-drive-a-mosfet-from-an-output-pin-of-a-microcontroller

suggests an IRL540, and explains what you should be looking for in the datasheet:

The big thing is to look in the data sheet and check the VGS(threshold) value and look at the graph that shows current flow vs VGS. If the VGS(threshold) is like 1.8V or 2.1V or so, and the "knee of the curve" on the graph is at around 5 volts, you basically have a logic-level MOSFET.