If you connect a car light bulb or a motor directly to a pin of your Arduino or Raspberry Pi, smoke will come out.
Why? Because a microcontroller is a brain, not a muscle.
- The brain (microcontroller): works with information. Its pins can only deliver or absorb a limited current.
- The muscle (actuator): works with energy and power. Motors, solenoids, and heaters can consume from milliamps to tens of amps.
For the brain to move the muscle, we need an intermediary. A translator that takes the weak signal from the brain and opens the gate for the battery’s energy. That intermediary is the driver or power stage.
The basic topology: control vs. power
In any robotics or automation schematic, you’ll see two clearly separated zones:
Control Circuit (Low Power): Operates at 3.3V or 5V. This is where the code, sensors, and logic live. The ground (GND) is usually clean.
Power Circuit (High Power): Operates at 12V, 24V, or 220V. This is where motors and large batteries live. It’s an environment full of electrical noise.
The Interface (Driver): This is the component that bridges both worlds. It receives a logic command (0 or 1) and connects or disconnects the high-power source.
The grounds (GND) of both stages must be connected to have a common reference (unless you use optocouplers for galvanic isolation). If you don’t connect the grounds, the control signal will “float,” and the driver won’t know when to turn on.
The transistor as a switch
The most basic element of a driver is the transistor (BJT or MOSFET). It acts like a digital faucet. But where do we place this faucet? There are two ways to do it:
We place the switch between the Load Negative and Ground (GND).
- Operation: We cut the return path to ground.
- Advantage: It’s very easy to control with 3.3V/5V logic (using NPN or N-MOSFET transistors).
- Problem: The load is always connected to VCC (12V). If you measure the voltage on the motor when off, you’ll see 12V on both terminals (floating potential). This is dangerous if the motor casing touches the metal chassis.
We place the switch between the Source (12V) and the Load Positive.
- Operation: We cut the power input.
- Advantage: The load is truly at 0V when turned off. It’s safer and prevents galvanic corrosion in submerged loads.
- Problem: It’s difficult to control. To turn on an N-MOSFET on the high side, you need a voltage higher than the source voltage itself (Vgate > 12V + Vth). This requires complex circuits (“Charge Pumps” or P-MOSFET transistors).
Types of drivers based on need
Not all muscles are controlled the same way. We choose the driver based on what we want to do.
It’s a mechanical switch.
- Use: Turning very large things on/off (220V AC) or when we need total isolation (air) between the brain and the muscle.
- Drawback: Slow and noisy. Not suitable for speed control (PWM).
If you use a single transistor, the motor only spins in one direction. If you want it to reverse, you need to change the polarity. The H-Bridge is 4 transistors strategically placed to direct the electron traffic in both directions.
- Old Drivers (L298N): Use BJT transistors. They have a large voltage drop (you lose 2V) and get extremely hot.
- Modern Drivers (MOSFET): They are much more efficient and run cooler.
Stepper motors are not controlled by voltage, but by current. If you connect a 3V Stepper to a 12V source, it will burn out. But we need 12V for it to react quickly. Stepper drivers (like the A4988) are intelligent:
- They apply 12V instantly to overcome inertia.
- They measure the current flowing through.
- As soon as it reaches the limit (e.g., 1A), they cut the power.
- They repeat this thousands of times per second (Chopping).
Common challenges and problems in power
This is where the difference is made in projects.
Your Arduino outputs 5V. Your ESP32 outputs 3.3V. Many power MOSFETs need 10V at the Gate to fully turn on.
- If you only give 3.3V to a large MOSFET, it will turn on “partially.”
- Consequence: The MOSFET will act as a resistor, get brutally hot, and burn out, even if the motor isn’t spinning.
- Solution: Use “Logic Level” MOSFETs or use a pre-driver to boost the gate voltage.
Motors and coils are like electrical springs. If you cut the current abruptly, the coil tries to maintain the flux by kicking back a reverse voltage spike (hundreds of volts).
- Solution: Always place a Flyback Diode in anti-parallel with the inductive load to recirculate that energy. H-bridges usually have them built-in.
When a motor starts, it draws so much current suddenly that the battery voltage can momentarily drop (from 12V to 9V). If your microcontroller shares that line, it will reset (Brown-out).
- Solution: Large capacitors near the drivers and independent voltage regulators for the logic section.