| BJT (2N3904, BC547) | MOSFET (IRLZ44N, AO3400) | |
|---|---|---|
| Terminals | Base, Collector, Emitter | Gate, Drain, Source |
| Controlled by | Base current | Gate voltage |
| Control current | Continuous, ~1/100 of load | Almost none once switched |
| Loss when on | ~0.2V drop (Vce_sat) | Very low resistance (Rds_on) |
| Good for | Small loads, simple, forgiving | Real current, efficient |
| Watch out for | Needs a base resistor, gain varies | Must be logic-level for 3.3V/5V gates |
Both come in two polarities. NPN / N-channel switch the ground side of a load (low-side switching) and are the easy, common case. PNP / P-channel switch the positive side (high-side), which is more awkward to drive from a microcontroller and is best left until you need it.
Everything in that diagram earns its place:
// switching 60mA with hFE (gain) around 100 I_base minimum = 60mA / 100 = 0.6mA // drive 5-10x harder to guarantee full saturation I_base chosen = 5mA R_base = (V_pin − 0.7) / 0.005 = (3.3 − 0.7) / 0.005 = 520Ω -> 470Ω
The 0.7V is the base-emitter drop, essentially fixed for silicon. Overdriving ensures the transistor is fully saturated — behaving like a closed switch with a small voltage drop — rather than partly on and dissipating the difference as heat. Datasheet gain figures are quoted at a particular current and vary enormously between individual parts, so designing at exactly the minimum is asking for a transistor that runs warm and switches unreliably.
MOSFETs are voltage-controlled, so the gate draws essentially no steady current and a good one has very low on-resistance — far more efficient for real loads. Three specifications decide the choice:
Two practical additions: a gate resistor of 100–220Ω limits the current spike as the gate capacitance charges, and a 10kΩ pull-down from gate to ground keeps the MOSFET off while the microcontroller boots and its pins are still floating. Without the pull-down, motors twitch on power-up.
You drive an IRF540 MOSFET from a 3.3V pin to switch a 12V LED strip. It works, but the MOSFET gets very hot. Why?
Failure modes: transistors usually fail shorted, so the load stays permanently on — an alarming but informative symptom. If your motor runs the instant power is applied and ignores the control signal, suspect a destroyed transistor and look for the missing flyback diode that killed it.