An H-bridge is a circuit of four switches that allows you to reverse the polarity applied to a load.
If you connect a toy motor to a battery, it spins. If you want it to spin the other way, you have to reverse the battery.
In a robot, we don’t have a mechanical hand to flip the batteries. We need a circuit capable of reversing the polarity applied to the motor using only electronic signals. That circuit is the H-Bridge.
It gets its name from the graphical shape formed by its 4 switches around the motor.
The Theory: 4 Switches and a Motor
Think of the motor in the center and four switches (S1, S2, S3, S4) forming an H. At the top we have the supply voltage (
| State | Active Switches | Result |
|---|---|---|
| Forward | Top-Left + Bottom-Right | Motor spins clockwise |
| Reverse | Top-Right + Bottom-Left | Motor spins counter-clockwise |
| Brake | Both Top or Both Bottom | Motor locks |
| Coast | None (All open) | Motor spins freely until it stops |
| EXPLOSION 💥 | Both Left or Both Right | Short circuit (Shoot-through) |
The action depends on which pair of switches we close:
We close S1 (top-left) and S4 (bottom-right).
- Current flows:
- Current enters from the left side of the motor. It spins clockwise.
We close S3 (top-right) and S2 (bottom-left).
- Current flows:
- Current enters from the right side of the motor. It spins counter-clockwise!
If we close both top switches (S1 and S3) or both bottom switches (S2 and S4), we connect both motor terminals together.
- The motor becomes a generator, short-circuits itself, and stops abruptly (magnetic brake).
The Forbidden State: Shoot-through 💥
There is one combination that must NEVER occur.
If you close S1 and S2 at the same time (both on the left vertical side)…
You create a direct path from
Modern H-bridge controller chips usually have internal logic protections to prevent this from happening, even if you accidentally command it in your code.
From Paper to Reality: L298N vs Modern Drivers
In real life, we don’t use mechanical switches; we use transistors (BJTs or MOSFETs). Depending on which transistors are used, we have two worlds:
The Classic (and Obsolete): L298N
This is that red module with a giant aluminum heatsink that comes in all Arduino kits.
-
Technology: Uses old BJT transistors.
-
Problem: It has a huge internal voltage drop (almost 2V).
-
If you supply 12V, only 10V reaches the motor. Where do the other 2V go? They turn into heat.
-
Verdict: It’s cheap and tough, but very inefficient. It needs that giant heatsink because it wastes a lot of energy.
The Modern Ones: TB6612FNG / DRV8833
These are tiny chips that don’t need a heatsink.
- Technology: They use MOSFETs.
- Advantage: Their internal resistance is nearly zero (low
). If you supply 12V, the motor gets 11.9V. - Verdict: They are much better for battery-powered robots since they don’t waste battery power heating the air.
Speed Control (PWM + H-Bridge)
The H-Bridge only lets us choose the direction (Forward, Reverse, Brake). What if I want to go slowly?
We use PWM as seen in Module 7. Instead of leaving the switch “Closed” all the time, we turn it on and off very quickly (Enable Pin).
- PWM 100% → Maximum Speed.
- PWM 50% → Medium Speed.
- PWM 0% → Stopped.