I have my GPIOs doing PWM with pi-blaster.

Now I just need to figure out the wiring. I checked over electrical engineering, and found this question: https://electronics.stackexchange.com/questions/213914/using-mosfet-as-switch, but it hasn't helped me.

I also read through this: http://bildr.org/2012/03/rfp30n06le-arduino/

Anyways, this is, to the best of my knowledge, how I'm supposed to translate the links above into something real:

enter image description here

The issue is, it's not working. What needs to change in this diagram for it to be functional?

P.S. Please don't tell me to go over to Electrical Engineering, the expected baseline of knowledge there is way above this pi hobbyist's education.


3 Answers 3


I just want to post this here to help other absolute beginners like me. The circuit above is correct and imperfect. But if it isn't working, here are some cases to check:

My issue was the breadboard being finicky. If a single connection point on a breadboard is at the whim of chance (as in you have to wiggle it a bit to get a connection), then that's the chance you won't have a working circuit. Those chances compile too.

But also, if you're trying to get a circuit like this working, it is important to read the answer above about getting the right MOSFET. What matters most in a scenario like this is the minimum threshold being below 3.3V. Also, use an N-Channel MOSFET.

Finally, it is good practice (as said in the answer above) to have a resistor connecting the Gate and Source. I'll update this later with the resistor type that I know works (once I've found it). I believe it's because connecting these helps ensure that the MOSFET defaults to off if something goes awry.


Most MOSFETs will not work with the RPi at all; the ones that do will not work well. Here are the issues:

  1. Most MOSFETs require gate-source voltages (Vgs) that exceed the 3.3V output the GPIO is able to provide. These will not work at all.

  2. The MOSFETs with Vgs ratings in the 3V range will suffer from one of the following:

    • They have very low power ratings, OR

    • The gate capacitance will be large; this will tax the GPIO's ability to source or sink enough current to turn the device ON and OFF in a reasonable time.

OTOH, bipolar transistors work quite well with the GPIO's limits. They will switch useful amounts of power with lower losses, and at lower component cost. I can't say that there is no RPi project that would benefit from or even justify the use of a MOSFET, but I will say that I'd really like to see one.

Your drawing doesn't show a load... presumably you want to switch current through some device, and control that with a GPIO on your RPi. If you can give us more information, we'll try to provide a definitive answer.


You have not specified what MOSFET. Most will NOT switch reliably with 3.3V.

There are a few models which will work.

NOTE You should check the SDG, as there is no standard.

You should ALWAYS include a resistor (~100kΩ) between G and S.

See http://elinux.org/RPi_GPIO_Interface_Circuits#Using_a_FET

  • The MOSFET I have is correct. It is meant for 3v3 to 5v. Are you saying the thing I'm missing is a resistor between G and S, and that is it? I tried that to no avail.
    – Seph Reed
    Aug 9, 2017 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.