I'm trying to set up a project in which the raspberry pi will turn on/off and on a 12V circuit. I've read that a MOSFET would be best but I can't seem to get the circuit to work. I'm using a 30N06 MOSFET, and this guide for reference. Before testing the entire circuit with a GPIO pin I wanted to test the switch itself, so I've connected the 5V raspberry pin directly to the gate of the MOSFET in an attempt to "turn on" the switch. My circuit looks like this currently:

current circuit

I must be doing something wrong though, since there is no current flowing in the 12V circuit. I have troubleshooted by running the 12V circuit without the MOSFET, as well as measuring the voltage from the raspberry pi 5V pin, and everything seems to function normally, so I am sure the problem lies in how I am connecting/using the MOSFET. I have also also found this guide online which seems to agree with my circuit, so I am extremely puzzled as to why it is not "turning on" (http://www.robertcudmore.org/blog/?p=181).

Any help or suggestions would be extremely appreciated.

  • 1
    \$\begingroup\$ Do you have the Raspberry Pi GND pin connected to the negative lead of your battery? \$\endgroup\$
    – Daniel
    Feb 8, 2018 at 19:01
  • 2
    \$\begingroup\$ You have the answer, but keep in mind that the GPIO voltage is 3.3V not 5V so you should use a MOSFET rated for 3.3V drive. \$\endgroup\$ Feb 8, 2018 at 19:13

1 Answer 1


In order to turn on the MOSFET, a certain voltage between its gate and source must be attained. In your case, you have an n-channel MOSFET, meaning that once the gate is driven to a higher voltage than the source, it will begin to conduct current between its source and drain.1

In order to do this the 12V circuit must not float with respect to the control circuit. You'll need the 12V circuit to share a ground with the Raspberry Pi in this case:

enter image description here

1 There's also a parasitic diode that allows conduction in the other direction regardless of gate voltage, but it's not relevant to this circuit as it is currently designed.


Your Answer

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

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