Transistors can amplify, regulate, switch, level shift, and protect. This article focuses on one common beginner-to-professional use: turning a load on and off from a low-power control signal.

Low-side switching

The simplest arrangement is often a low-side switch. The load connects to the positive supply. The transistor sits between the load and ground. When the transistor turns on, current flows through the load.

Low-side switching is common because NPN BJTs and N-channel MOSFETs are easy to drive from logic pins. It is suitable for many LEDs, relays, motors, and solenoids, as long as the load can have its low side switched.

NPN transistor low-side switch circuit V+ Load GPIO base resistor NPN
NPN low-side switch. The GPIO feeds base current through a resistor. The load current flows through the collector and emitter, not through the GPIO pin.
N-channel MOSFET low-side switch circuit V+ Load GPIO gate resistor pull-down N-MOSFET
N-channel MOSFET low-side switch. The gate controls the switch. A pull-down keeps it off while the controller pin is floating during reset.

BJT switch basics

A BJT is current-controlled. For an NPN low-side switch, current into the base allows a larger current to flow from collector to emitter. The base needs a resistor, because a base-emitter junction behaves like a diode.

In switching use, the transistor is usually driven into saturation. Do not rely on the headline gain value alone. A practical design often uses forced beta, such as assuming the collector current is only 10 to 20 times the base current, then checking that the GPIO can safely supply that base current.

MOSFET switch basics

A MOSFET is voltage-controlled in steady state. For an N-channel low-side switch, a positive gate voltage relative to the source turns it on. The gate does not need continuous DC current like a BJT base, but it does have capacitance that must be charged and discharged.

For microcontroller use, choose a logic-level MOSFET. The important figure is not only the threshold voltage. Gate threshold is where the device just begins to conduct a tiny current. You need the on resistance specified at your actual gate voltage, such as 3.3 V or 4.5 V.

Choice Strength Watch for
NPN BJT Cheap, simple, good for modest loads. Needs base current and has saturation voltage.
N-channel MOSFET Efficient for larger currents when properly driven. Needs suitable gate voltage and good layout for fast/high current.
PNP or P-channel high-side Switches the positive side of the load. Gate/base drive is more subtle, especially with higher supply voltage.
Driver IC Handles protection, current, speed, or multiple channels. More parts, but often more reliable for real products.

Flyback protection

Inductive loads need protection. When a relay, motor, or solenoid is switched off, it tries to keep current flowing. Without a safe path, voltage can spike high enough to damage the transistor.

A flyback diode across a DC coil is the classic beginner-friendly solution. It should be placed so it does not conduct during normal operation, but conducts when the coil tries to drive the voltage in the opposite direction after switch-off.

Relay coil with flyback diode and low-side transistor switch V+ Coil Switch flyback diode Normally off; conducts when the coil is switched off. stored coil energy gets a safe loop
Flyback path. The diode gives inductive current somewhere safe to go when the transistor turns off, protecting the switch from a voltage spike.

Gate and base details

A MOSFET gate should usually have a pull-down resistor so it stays off while the microcontroller is resetting or disconnected. A small series gate resistor can reduce ringing and limit instantaneous gate charging current. The exact value depends on switching speed, load, driver strength, and EMI concerns.

A BJT base resistor is not optional. It limits base current. Without it, the control pin and transistor can be damaged.

High-side switching

Sometimes the load must remain connected to ground and the positive supply must be switched. That is high-side switching. It can be done with PNP transistors, P-channel MOSFETs, dedicated high-side switches, or driver circuits. It is very useful, but the drive requirements are less casual than low-side switching, especially when the load supply is higher than the logic voltage.

Practical rule

Choose the transistor from the load backwards: voltage, current, switching speed, heat, protection, then control signal. Starting from the GPIO pin often hides the real requirements.

Common mistakes

  • Driving a relay or motor directly from a microcontroller pin.
  • Using a MOSFET because its threshold voltage looks low, without checking on resistance at the real gate voltage.
  • Forgetting the base resistor on a BJT.
  • Forgetting the MOSFET gate pull-down.
  • Switching an inductive load without flyback or clamp protection.
  • Ignoring heat from voltage drop or MOSFET on resistance.

A practical checklist

  1. What is the load voltage and maximum current?
  2. Is low-side switching acceptable, or must the positive side be switched?
  3. Can the control signal provide the required base current or gate voltage?
  4. What voltage drop and heat will the transistor dissipate?
  5. Is the load inductive, and does it need a flyback diode or clamp?
  6. What happens during reset, startup, firmware crash, or connector unplugging?
Read: voltage dividers Next: op-amps