I have an N-Channel MOSFET (model: FQP30N06L) which I tried hooking up the Gate connector to a RaspberryPi GPIO pin (3.3v, also tried a always-on 5v).

The Source connector connects to a wall-mounted powersupply that delivers 12v and 850 mA.

The Drain connects to a 10W LED Buck-Driver


simulate this circuit – Schematic created using CircuitLab

I've also tried turning the negative and positive around all together, and I get light from the LED. However it's not that bright. I assumed it might be the voltage from the RPi being to low, so i tried a static 5v output but it didn't do much to the naked eye.

So I hooked up another 12v power supply and just fed it straight on the Gate of the MOSFET, low and behold it lit up perfectly (just as it did with the 12v power supply straight on the buck-driver).

So that's worked out, I need more power on the gate or I need a different MOSFET. But how do you turn off the MOSFET? I assumed putting 0v across the Gate would cause it to shut off?

So I guess I have two questions that would help me go on learning these things. 1: How do you turn off this MOSFET 2: Is this wiring even OK?

  • \$\begingroup\$ Is there really just one wire connected to the Pi? \$\endgroup\$
    – Phil Frost
    Commented Jan 3, 2015 at 2:25

2 Answers 2


Is the ground of the 12 volt supply connected to the RPi ground?

The MOSFET reacts to the voltage between its Gate and Source terminal - if the two grounds are not connected the Gate/Source voltage is undefined, and the Pi output cannot control the action of the MOSFET.

  • \$\begingroup\$ The powersupply is just a 12v mobile phone charger from an old Nokia or if it's a network-switch power supply. So it's a standard 2.5mm circular connector where I simply plugged the negative lead to the negative input of the MOSFET and the positive lead to the positive input of the buck driver, so I understand that I probably should connect something to the GND pins of the RPi but I'm really not sure which part.. \$\endgroup\$
    – Torxed
    Commented Jan 3, 2015 at 2:30
  • 2
    \$\begingroup\$ You MUST connect the negative lead from the 12 volt supply to the Pi ground, as well as to the MOSFET negative lead, otherwise there is no reference voltage between the Pi and the MOSFET. \$\endgroup\$ Commented Jan 3, 2015 at 2:33
  • \$\begingroup\$ Cheers Peter, as you probably can tell I'm a complete beginner in terms of low level electronics. I thought I knew a thing or two especially but I've clearly gotten some of the fundamentals down wrong. So just make something like this? i.imgur.com/Y4a1EYJ.png \$\endgroup\$
    – Torxed
    Commented Jan 3, 2015 at 2:39
  • \$\begingroup\$ Yes - connect the Pi ground to the MOSFET source. \$\endgroup\$ Commented Jan 3, 2015 at 2:48
  • \$\begingroup\$ Works like a charm. The "OFF" state is still not completely off, the LED is still at ~5% light capacity but the "on" and "off" switch that is the RPi now works thanks to the GND connector. Cheers for pointing out that logical error! \$\endgroup\$
    – Torxed
    Commented Jan 3, 2015 at 4:23

I could tell you how a MOSFET works, but you already got that from Google. The problem isn't that the internet is too advanced. Your problem is you don't know how to perform basic troubleshooting.

You can troubleshoot just about anything by simplifying it. Do you really need a whole RPi to change the voltage on the gate? How about a switch? Do you really need a complicated buck driver and a 10W LED? Wouldn't a voltmeter be much simpler? (Extra credit: verify that the switch and voltmeter work before you draw any conclusions.)


simulate this circuit – Schematic created using CircuitLab

You don't even really need a switch. You could just move a wire on a breadboard.

Does this circuit even make sense to you? If not, why? Can you simplify it even more? Try more research. If you are still really stuck, ask a specific question with the simplest possible example of your difficulty possible. Be more specific than "it's not working properly". Good questions might be:

  • why do I need a double-throw switch instead of a single-throw switch?
  • do I really need a 5V supply and a 12V supply?
  • why are the negative sides of the two supplies connected?

Now, did you get this circuit to work? If so, your problem is not here. Try an alternate hypothesis:

  • the buck driver is broken
  • the LED is broken
  • the RPi is not functioning the way you assume
  • or something else of your own design

Then design a simple experiment to test your hypothesis. Conclusions not clear? Simplify more and perform more experiments. Contradictory results? Probably a misunderstanding of how a device works. Research more.

If this does not work, then the problem is here. Is the transistor broken? Do you feel you have a good understanding of how MOSFETs even work? Maybe you need to get some more fundamental experience before moving on to something more complex.

  • \$\begingroup\$ So the circuit makes sense, and that works. As mentioned I stuck a secondary 12v supply straight on the MOSFET, that worked (on, off). Those were however connected to the same power-outlet which I assume worked because as @PeterBennet sad they have to be connected to the same ground and the two power supplies were (if that's not how it works, I'm sorry for being a silly goose). As soon as I try involving the RPi this wholse setup starts acting oddly. Which either is because of the input voltage or something with the ground? \$\endgroup\$
    – Torxed
    Commented Jan 3, 2015 at 2:34
  • \$\begingroup\$ @Torxed Well, what happens if you build the simplified circuit above, but omit that connection? What will the voltage between the source and the gate be? What voltage to you measure if you stick your voltmeter leads on two batteries that aren't connected to each other in any way? \$\endgroup\$
    – Phil Frost
    Commented Jan 3, 2015 at 3:19
  • \$\begingroup\$ The negative terminals of typical wall-wart power supplies are not connected to the AC neutral or Safety Ground, so you cannot assume that the negative terminal of your 12 volt supply bears any relation to the negative (ground) terminal of the RPi. You MUST connect the MOSFET source terminal to BOTH the 12 volt supply negative terminal and to the RPi ground for your Pi to be able to control the MOSFET. \$\endgroup\$ Commented Jan 3, 2015 at 3:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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