I read this: Using MOSFET as switch

And this: http://bildr.org/2012/03/rfp30n06le-arduino/

This is my wiring(G, D, S are Gate Drain and Source): enter image description here

It's not working. The MOSFET is of the correct type, I don't have the specs on it on hand, but I know for sure that it is the correct type of MOSFET.

I've also seen in diagrams there is a resistor that would connect GPIO directly to Pi-Ground, but adding that did not fix it either.

How does one do a MOSFET switch?


closed as unclear what you're asking by Chris Stratton, uint128_t, PeterJ, winny, clabacchio Aug 14 '17 at 12:10

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ This small fruit happens to be running a server that hosts a web interface, and its PWM is working great. I had all of this functioning before, but I knocked out a few cords, and I haven't been able to get it back. \$\endgroup\$ – Seph Reed Aug 8 '17 at 23:49
  • 5
    \$\begingroup\$ -1 without the part number of the MOSFET, no, you cannot know that it is the correct type. You've presented no evidence that it is even an N-channel device, let alone that it has a sufficiently low threshold voltage for 3.3v drive. \$\endgroup\$ – Chris Stratton Aug 9 '17 at 0:39
  • \$\begingroup\$ Just assume it was, is this the correct wiring? \$\endgroup\$ – Seph Reed Aug 9 '17 at 1:54
  • \$\begingroup\$ Found the mfg: IRLB8721PBF cdn-shop.adafruit.com/datasheets/irlb8721pbf.pdf \$\endgroup\$ – Seph Reed Aug 9 '17 at 4:07
  • \$\begingroup\$ There's no way that FET will drive with only 3.3V \$\endgroup\$ – KingDuken Aug 9 '17 at 4:37

You cannot use a FET with a threshod of of 2~4V on a 3.3V swing. It must be a logic level FET 1V Vgs(th) i.e. gate voltage >=3x threshold.

With Drain low side switch to 0V it must be an Nch Logic Level FET rated for > 5x actual load current for good cool results.

The https://www.sparkfun.com/datasheets/Components/General/RFP30N06LE.pdf is good for 5V but marginal for 3.3V as Vgs(th) is 1~2V so you need 3~6V minimum.

  • \$\begingroup\$ It is definitely not the MOSFET. It was working when my friend helped me build it a month ago, the cords got jumbled out, and I'm trying to put it back together. Right now, I'm thinking my breadboard my just be really crappy. \$\endgroup\$ – Seph Reed Aug 9 '17 at 2:15
  • \$\begingroup\$ But if you're saying the wiring is correct, that definitely helps me narrow down the issue. \$\endgroup\$ – Seph Reed Aug 9 '17 at 2:15
  • 1
    \$\begingroup\$ mosfets can die instantly, and are sensitive to static, much less "jumbled out" connections... \$\endgroup\$ – dandavis Aug 9 '17 at 2:37
  • \$\begingroup\$ I just coerced my friend to come over, and, as it turns out... super lame... it was my weak bread board. He told me he doesn't trust breadboards, which I now understand. We got everything working, and, while it is better to have a resistor connecting G and S, it working fine without it. \$\endgroup\$ – Seph Reed Aug 9 '17 at 3:53
  • 1
    \$\begingroup\$ I guess your FET is marginally OK then. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Aug 9 '17 at 5:07

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: https://electronics.stackexchange.com/a/323022/87434 about getting the right MOSFET. What matters most in a scenario like this is getting an N-Channel MOSFET with the minimum threshold being below 3.3V

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


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