Key Engineering Takeaways
- •Microcontroller GPIO pins are limited to 20mA; transistors allow 3.3V/5V logic to switch 50A+ high-power loads.
- •BJTs are CURRENT-CONTROLLED: requires continuous base current (I_b = I_c / beta) and has ~0.2V–0.4V saturation voltage drop.
- •MOSFETs are VOLTAGE-CONTROLLED: draws zero continuous gate current; conducts with ultra-low ON-resistance (R_DS(on) < 0.01Ω).
- •Never use standard MOSFETs (IRF540N) with 3.3V/5V microcontrollers—they require 10V on Gate to turn on! Use Logic-Level MOSFETs (IRLZ44N / IRLB8721).
- •Always place a 10kΩ pull-down resistor from Gate to Ground to prevent floating gate oscillation during microcontroller boot.
- • Ohm's Law, Transistors, and PWM basics
- • IRLZ44N Logic-Level N-MOSFET (TO-220)
- • 2N2222 NPN Transistor
- • 100Ω and 10kΩ Resistors
- • 12V DC Motor and Flyback Diode
The Problem: Microcontrollers Cannot Drive Motors Directly
An ESP32 or Arduino GPIO pin can safely supply at most 12mA - 20mA at 3.3V / 5.0V.
A standard robotics DC motor, high-power LED spotlight, or solenoid draws 1.0A - 10.0A at 12V. Connecting the load directly to a GPIO pin will immediately vaporize the internal microcontroller output driver.
A Transistor (BJT or MOSFET) serves as an electronically controlled solid-state switch: your GPIO pin controls the gate/base, allowing heavy current to flow from the battery to the motor with zero physical moving parts.
N-Channel Power MOSFETs (IRLZ44N / IRLB8721) for Heavy Loads (>2A)
For high-power robotics, N-Channel MOSFETs are the undisputed king of switching:
Why MOSFETs Outperform BJTs:
- 1Zero DC Gate Current: The Gate is an insulated capacitor (SiO_2). Zero current is required to hold the switch ON.
- 2Ultra-Low ON-Resistance (R_DS(on)): When turned on, the channel behaves like a pure 0.01 Ω resistor.
- 3Low Heat:
The Logic-Level Trap: Standard vs Logic-Level MOSFETs (V_GS)
Complete High-Power MOSFET Motor Driver Schematic
The 4-Component High-Power Low-Side Switch Circuit:
- 1Gate Resistor (100 Ω): Placed in series between GPIO pin and Gate to dampen ringing and limit inrush charging current into the gate capacitance.
- 2Pull-Down Resistor (10 kΩ): Placed between Gate and Ground to ensure the MOSFET stays 100% OFF during microcontroller bootup and reset.
- 3N-Channel MOSFET (IRLZ44N): Source connects to Ground; Drain connects to Motor Negative lead.
- 4Flyback Diode (1N5819 / 1N4007): Connected across motor terminals (+ to +12V, - to Drain) to absorb inductive back-EMF spikes.
Frequently Asked Questions
What is the difference between Low-Side and High-Side switching?
Low-Side switching connects the transistor between the load and Ground (N-MOSFET / NPN BJT), which is easiest because Gate control voltage is referenced directly to Ground. High-Side switching connects the transistor between Power (+12V) and the load (P-MOSFET / PNP BJT), which is used when the load must remain permanently grounded.