For switching a motor from a microcontroller, a logic-level MOSFET is usually the better choice at higher currents because it needs almost no drive current and wastes little heat, while a small bipolar transistor (BJT) is fine for tiny motors under a few hundred milliamps. For reversing a motor, use a ready-made driver IC instead of building an H-bridge from parts.
Key takeaways
- A BJT is controlled by base current, while a MOSFET is controlled by gate voltage and draws almost no steady gate current.
- A logic-level MOSFET has its on-resistance specified at a low gate voltage, such as 4.5 V, and some at 2.5 V, so check that figure.
- A motor is an inductive load, so a flyback diode across it is needed with either device.
- For direction control, a driver IC such as the TB6612FNG or DRV8833 is simpler and safer than discrete parts.
How Each Device Switches
A transistor used as a switch is a part that is either fully on (low resistance) or fully off (no current), controlled by a small signal on one pin. A BJT is a current-controlled device: current into the base lets a larger current flow from collector to emitter. A MOSFET is a voltage-controlled device: voltage between gate and source creates a channel from drain to source.
For a low-side switch (the load connects to the supply and the transistor connects the load to ground), an NPN BJT or an N-channel MOSFET is used. The microcontroller pin drives the base through a resistor, or drives the gate directly, and a diode sits across the motor to absorb the voltage spike when the motor is switched off.
Drive Current and Gate Drive
Drive current is the current your microcontroller pin must supply to turn the switch fully on. A BJT needs a steady base current. A common rule of thumb for hard saturation is to assume a low forced gain, often around 10, rather than the datasheet’s maximum gain. For example, a 500 mA motor would then need about 500 / 10 = 50 mA of base current, which is more than a typical microcontroller pin should supply. That is why a small BJT often needs a second transistor, or a different choice.
A MOSFET gate is like a small capacitor. It draws current only while charging and discharging, so a pin can drive it with no resistor in steady state, though a small series resistor (often tens to a few hundred ohms) limits the charging spike. The key check is that the gate voltage from your board is high enough. A 3.3 V ESP32 pin and a 5 V Arduino Uno pin each need a MOSFET whose datasheet gives on-resistance at that gate voltage. Parts with a threshold of only about 1 to 2 V may still not be fully on at 3.3 V, because threshold voltage is where conduction just starts, not where resistance is low.
Heat and Losses
Heat in a switch is the power lost inside it while carrying current, and it decides whether the part runs cool or burns out. A MOSFET acts like a small resistor, Rds(on), so the loss is I squared times Rds(on). A BJT has a roughly fixed saturation voltage, Vce(sat), so the loss is Vce(sat) times I.
Illustrative example, assuming a 2 A motor, a MOSFET with Rds(on) of 0.05 ohm and a BJT with Vce(sat) of 0.5 V:
| Device | Assumption | Calculation | Heat |
|---|---|---|---|
| MOSFET | Rds(on) 0.05 ohm | 2 x 2 x 0.05 | 0.2 W |
| BJT | Vce(sat) 0.5 V | 0.5 x 2 | 1.0 W |
These are example values. Real parts differ and Rds(on) rises as the part warms, so read the datasheet curves. PWM speed control also adds switching losses, which grow with frequency. The motor choice itself is covered in motor selection for robots.
Which Is Simpler for Beginners
For a single small motor or a vibration motor, a BJT such as a general-purpose NPN with a base resistor, a flyback diode and a common ground is simple and cheap. For anything near an amp or more, or if you want PWM speed control from a 3.3 V board, a logic-level N-channel MOSFET module or part is usually simpler, because there is no base current calculation.
If you are building for a college project in India and buying from a local electronics shop, check the part number printed on the transistor and read its datasheet, because similar-looking parts differ a lot. Ask for the exact type you planned rather than “a MOSFET”. Check the markings for fakes where parts are sold loose and unlabelled.
When to Use a MOSFET
- The motor current is high enough that a BJT would run warm or need heavy base drive.
- You want PWM speed control with a small, efficient switch.
- Your microcontroller works at 3.3 V and you need a part rated at that gate voltage.
- You need low voltage loss, for example on a battery-powered robot where every tenth of a volt counts.
Add a flyback diode across the motor, and a pull-down resistor from gate to ground so the motor does not start by itself while the microcontroller pin is floating at power-up.
Driver ICs Versus Discrete Parts
A motor driver IC is a chip that contains the switches, the protection and the logic for direction control in one package. Building an H-bridge from discrete parts needs two high-side and two low-side devices, correct gate drive for each, and protection against both devices of one side conducting together.
The older L298N module is a bipolar design with noticeable voltage loss, while newer MOSFET-based chips such as the TB6612FNG motor driver and the DRV8833 motor driver lose less voltage and run cooler at moderate currents. Compare them in L298N vs TB6612FNG, and see the wiring for the older module in Arduino DC motor speed and direction control with L298N. Real builds such as the obstacle-avoiding robot with Arduino use a driver module rather than loose transistors.
How to check this yourself
- Pick your candidate part and open its datasheet. Find Rds(on) at your gate voltage, or Vce(sat) at your current.
- Compute the heat: I squared x Rds(on) for a MOSFET, or Vce(sat) x I for a BJT, and compare it with the part’s power rating and your heatsinking.
- For a BJT, divide the motor current by a forced gain of about 10 and check your microcontroller pin’s current limit.
- Build the switch with the motor disconnected first and check the output with a multimeter and an LED.
- Run the motor, and after a minute of load, switch off safely and feel the transistor for heat.
Common mistakes
- Using a standard-threshold MOSFET with a 3.3 V pin and expecting it to switch fully.
- Forgetting the flyback diode, which can destroy the switch with voltage spikes.
- Driving a BJT base straight from a pin with no resistor.
- Leaving the gate floating, so the motor twitches at power-up.
- Forgetting to join the grounds of the microcontroller and the motor supply.
Quick checklist
- Check the motor stall current against the part’s current rating.
- For a MOSFET, find Rds(on) at your actual gate voltage.
- Add a flyback diode across the motor.
- Add a pull-down resistor on the gate or base.
- Use a driver IC when you need reversing.
Frequently asked questions
Can I drive a motor directly from an Arduino pin?
No. A typical Arduino pin can supply only a small current, far less than most motors need, and the motor’s voltage spikes can damage the chip. Use a transistor, a MOSFET or a driver module between the pin and the motor, and add a flyback diode.
Is a MOSFET better than a transistor for motors?
At higher currents, usually yes, because a MOSFET needs almost no drive current and loses less power as heat. For a very small motor, a simple BJT circuit is cheaper and works. The deciding facts are the motor current and the gate voltage your board provides.
Do I need a logic-level MOSFET with ESP32?
Yes, in most cases. ESP32 pins output 3.3 V, so use a MOSFET whose datasheet lists a low on-resistance at a gate voltage of 3.3 V or lower. A part that only reaches its low resistance at 10 V gate drive will run hot or switch poorly.
Related reading
- PID motor speed control with an encoder on Arduino, for PWM drive in a working project.
- Robotics Learn hub, for more motor and driver guides.
- Time Constant and Step Response in a Motor Test
About the author and how this is kept accurate
Written, checked and maintained by Jignesh Panchal of Jaadu Digital. Figures in worked examples come from the stated assumptions, not from a bench test of our own. Read the editorial standard, follow the author on LinkedIn, or send a correction. Last reviewed: November 2026.



