Raspberry Pi + MOSFET = High power switch

With all the possibilities, Raspberry Pi requires additional hardware to turn on and off any additional hardware. GPIOs built in power limit is low: 3.3V, 16mA per GPIO, but not more that 50mA total). And while it might be enough to light a small LED, it is not enough for anything else. Forget about motors, strong LEDs, relays. Anything that uses more that 16mA on input will destroy Raspberry Pi.

Luckily, there are things called MOSFET. To keep things short: they are special kind of transistors that can be used to turn on and off devices with high power requirements. Unfortunately, most MOSFETs require more that 3.3V Raspberry Pi GPIO provides. So you either have to use 3.3V logic compatible MOSFETs or add few other elements and use more common 5V compatible MOSFET like 30N06. And 30N06 MOSFET transistor can handle a lot of thing: up to 30A and 60V. So it’s more that enough to handle most 12V motors, relays, lights, LEDs, etc.

30N06 MOSFET Raspberry Pi


Required elements:

  • NPN BC547 (or compatible) transistor,
  • PNP BC640 (or compatible) transistor,
  • 30N06 MOSFET transistor,
  • 3x 10kOhm resistors,
  • 4.7kOhm resistors,
  • 1N4001 (or similar) diode

If it was Arduino with 5V logic, transistors would not be required. But with Raspberry Pi’s 3.3V logic they are required to bump voltage from 3.3V GPIO port provides to 5V MOSFET needs. Additionally, if we would be powering any coil device (motor, relay), flyback diode would be required to secure MOSFET from voltage spikes. Even if there is no coil, flyback diode still can be used. Just to be safe.

2 thoughts on “Raspberry Pi + MOSFET = High power switch

    1. In this case, 3.3V of GPIO is not enough to fully open MOSFET. We have to boost it to 5V. Also, in this case, bipolar transistors acts like a inverter

Leave a Reply

Your email address will not be published.