Digital Switch Transistor

A GPIO pin can only supply a limited amount of current. By using a MOSFET as a digital switch, we can safely control external components using a low-power signal.
 

 

Basic GPIO-controlled MOSFET switching circuit


 

When using a microcontroller, always choose components that can be driven by 3.3V or 5V GPIO signals.

 

Other possible transistors:

  • IRLZ44N – Logic-level MOSFET, ideal for switching medium/high loads (LED strips, motors)
  • 2N7000 – Small logic-level MOSFET, suitable for low-current loads
  • AO3400 – Compact SMD MOSFET, very efficient at 3.3V
  • 2N2222 – BJT transistor, suitable for simple switching (relays, small loads), requires base resistor


Use MOSFETs for efficiency and higher current, and BJTs for simple, low-power switching.

 


High Voltages

For higher voltage applications (e.g. 110V/220V AC), transistors are not used directly with microcontrollers.

Instead, an intermediate stage such as a relay, solid state relay (SSR), or a triac-based circuit is required to ensure proper isolation and safe operation.