Transistors as Switches — BJT and MOSFET Explained Simply

Control a 10A motor from a 5mA Arduino pin — this is what transistors do

Introduction

Your Arduino GPIO pin can source or sink about 40mA maximum. A small DC motor might need 500mA. A relay coil needs 100mA. A string of LEDs might need 2A. How do you control these high-power loads from a tiny microcontroller pin? Transistors.

A transistor uses a small input signal to control a much larger output current. In switch applications, a tiny base/gate current switches on or off a large collector/drain current. There are two main types used in switching applications: the BJT and the MOSFET. This post explains both with complete circuits you can build today.

Part 1: BJT — Bipolar Junction Transistor

A BJT has three terminals: Base, Collector, Emitter, and two polarities: NPN (most common) and PNP. In an NPN transistor used as a switch: a small current into the BASE turns it ON; when ON, current flows from COLLECTOR to EMITTER; when OFF (no base current), no collector current flows.

🔑  KEY CONCEPT

BJT is a current-controlled device: a small BASE current controls a large COLLECTOR current.

Current gain (hFE or β): Ic = hFE × Ib. Typical hFE = 100-500.

Supply 1mA to the base with hFE = 200, and the collector can carry up to 200mA.

Figure 1 — NPN BJT wired as a low-side switch, with base and pull-down resistors.

NPN Transistor Switch Circuit

1. Connect load between positive supply and collector

2. Connect emitter to GND

3. Connect Arduino pin → 1kΩ resistor → base

4. Connect 10kΩ resistor from base to GND (ensures transistor is fully off when pin is LOW)

5. For inductive loads (motors, relays): add flyback diode across the load

Calculating the Base Resistor

To fully saturate the transistor, base current must be enough: Ib ≥ Ic ÷ (hFE × 0.3). The 0.3 factor ensures we overdrive the base for reliable saturation.

Example: switching a relay that draws 100mA (Ic), using 2N2222 (hFE min = 100). Required Ib ≥ 100mA ÷ (100 × 0.3) = 3.3mA. Base resistor: R = (Vin − Vbe) ÷ Ib = (5 − 0.7) ÷ 0.0033 = 1300Ω, use 1kΩ (gives more base current = safer saturation).

BJT TypeCommon PartMax IcMax VceUse Case
NPN small signal2N2222, BC547600mA, 800mA30V, 45VSwitching LEDs, small relays, buzzers
NPN medium powerTIP31, TIP1203A, 5A60V, 60VMotors, larger relays, heaters
NPN powerTIP35, 2N305525A, 15A100V, 115VHigh power loads
PNP small signal2N2907, BC557600mA, 100mA40V, 45VHigh-side switching
Darlington pairTIP120, ULN20035A (per channel)60VDirect GPIO to motor (built-in resistor)

Part 2: MOSFET — Metal Oxide Semiconductor FET

MOSFETs have virtually replaced BJTs in most switching applications because: they’re voltage-controlled — the gate draws almost zero current; they have lower on-state resistance (RDS_on), wasting less power when fully on; they switch faster, better for PWM control of motors and LEDs; and they’re easy to drive from 3.3V microcontrollers using logic-level parts like the IRLZ44N.

Figure 2 — N-channel MOSFET wired as a low-side switch.

N-Channel MOSFET Switch Circuit

1. Connect DRAIN to the load (between load and MOSFET)

2. Connect SOURCE to GND

3. Connect Arduino pin → GATE (often through 100Ω-1kΩ to limit gate current spikes)

4. Add 10kΩ resistor from gate to GND (ensures MOSFET is fully OFF when pin is floating or LOW)

5. Add flyback diode across inductive load

🔑  KEY CONCEPT

For N-Channel low-side switching: load between VCC and DRAIN, SOURCE to GND.

When GATE voltage exceeds VGS(th) threshold, MOSFET turns on.

Use ‘logic level’ MOSFETs (VGS(th) ~2V) for 3.3V or 5V microcontroller direct drive.

MOSFETTypeVgs(th)RDS(on)Max IdUse
2N7000N-ch logic2.1V1.8Ω200mASmall logic switching
IRLZ44NN-ch logic2.0V0.022Ω47AMotor, LED strips, high current
IRF520N-ch4.0V0.270Ω9.7A5V-compatible with pull-up
AO3400N-ch SMD1.6V0.035Ω5.7ASMD low-side switch
STP36NF06N-ch2.5V0.028Ω30AHigh current motor drivers
BHT VS MOSFET

Figure 3 — BJT vs MOSFET at a glance.

Part 3: Relay vs Transistor vs MOSFET — When to Use Which

DeviceIsolationSpeedPower neededHandles AC?Best for
RelayYes (coil vs contacts)Slow (ms)Coil current neededYes!Mains switching, AC loads, complete isolation
BJTNoFast (µs)Small base currentNoSimple low-power loads, old designs
MOSFETNoVery fast (ns)Near zero gate currentNo (special circuits)DC motor PWM, LED strips, most modern designs

💡  TIP

For most maker projects driving DC loads: use an N-channel logic-level MOSFET (IRLZ44N).

For mains AC switching: use a relay module (never directly, always with opto-isolation).

For multiple channels: ULN2003 (Darlington array) handles 7 channels at 500mA each.

✅  QUICK RECAP

BJT: current-controlled. Small base current → large collector current. NPN most common.

MOSFET: voltage-controlled. Near-zero gate current. Much more efficient than BJT.

N-channel: load between VCC and DRAIN. SOURCE to GND. Gate controls switching.

Always add flyback diode across inductive loads (motors, relays, solenoids).

10kΩ gate-to-GND resistor keeps MOSFET OFF when control signal is disconnected.

Logic-level MOSFETs (IRLZ44N): work with 3.3V/5V GPIO directly. Use these.

Relays: for AC mains switching or when you need total isolation between circuits.

Frequently Asked Questions

Q: Why can’t I just connect a motor directly to an Arduino pin?

A: GPIO pins are limited to roughly 40mA, while even small motors typically draw hundreds of milliamps to amps. Exceeding the pin’s current limit will damage the microcontroller. A transistor or MOSFET lets the small GPIO current control a separate, much larger current path to the motor.

Q: How do I choose between a BJT and a MOSFET for a new project?

A: For most modern maker projects driving DC loads (motors, LED strips, relays) a logic-level N-channel MOSFET like the IRLZ44N is the better default — it’s more efficient, switches faster, and barely loads the GPIO pin. BJTs remain useful for very simple low-power switching or when following older reference designs.

Q: What happens if I skip the flyback diode on a relay or motor circuit?

A: The collapsing magnetic field when the inductive load switches off generates a large voltage spike, often hundreds of volts, in the opposite direction. Without a flyback diode to clamp it, that spike will usually destroy the switching transistor or MOSFET within a few cycles.

Q: Why is a 10kΩ pull-down resistor needed on the gate/base?

A: Without it, the gate or base can float to an undefined voltage when the microcontroller pin is an input, briefly high-impedance, or during power-up — potentially turning the switch partially or fully on unintentionally. The pull-down resistor guarantees a defined OFF state.

Q: Can I drive a MOSFET gate directly with no resistor at all?

A: It’s common to add a small series resistor (100Ω-1kΩ) even though the DC gate current is near zero, because the gate behaves like a small capacitor — the resistor limits the current spike when that capacitance charges and discharges during fast switching, protecting both the MCU pin and the MOSFET.

Q: What is the practical difference between a MOSFET and a relay for turning on a lamp?

A: A MOSFET switches fast and silently but only isolates in one sense (no true electrical isolation between control and load side) and generally can’t handle AC mains well. A relay provides true galvanic isolation and can switch AC mains loads, but is slower, mechanical (wears out over time), and needs more current to drive its coil.

🚀  NEXT UP

Post 10: Reading a Circuit Schematic — Symbols and Rules

Now that you know all the basic components, it’s time to read circuit diagrams — every common symbol and the rules for reading any schematic.

Share your love
abrarhasnath2004@gmail.com
abrarhasnath2004@gmail.com
Articles: 13

Leave a Reply

Your email address will not be published. Required fields are marked *