How H-Bridge Circuits Control DC Motor Direction in Robotics

This article explains the mechanics of an H-bridge circuit and how it reverses current polarity to achieve bidirectional control of DC motors in robotics. It covers the fundamental architecture of the circuit, the specific switching sequences required for forward and reverse rotation, and essential protection mechanisms needed to prevent component failure during operation.

The Architecture of an H-Bridge

A standard DC motor spins in a direction determined by the polarity of the voltage applied to its two terminals. To make a robot move both forward and backward, the control system must be able to flip this polarity without physically rewiring the circuit. The H-bridge solves this problem electronically.

The circuit gets its name from its schematic layout, which resembles the capital letter "H". Four switching elements—typically MOSFETs or Bipolar Junction Transistors (BJTs)—form the four vertical legs of the "H". The DC motor is connected across the horizontal bar in the middle.

  • High-Side Switches (S1 and S3): Connected to the positive power supply (Vcc) at the top of the bridge.
  • Low-Side Switches (S2 and S4): Connected to the ground (GND) at the bottom of the bridge.
  • Motor Terminals (A and B): Located in the center. S1 and S2 connect to Terminal A; S3 and S4 connect to Terminal B.

Reversing Current Polarity

By selectively turning these four switches on (closed) and off (open) in diagonal pairs, a microcontroller can dictate the path the electrical current takes through the motor.

Forward Rotation

To spin the motor in the forward direction, the microcontroller closes switches S1 and S4 while keeping S2 and S3 open.

  1. Current flows from the positive supply through S1.
  2. It enters the motor at Terminal A and exits at Terminal B.
  3. The current then flows through S4 to the ground, completing the circuit.

Reverse Rotation

To spin the motor in the opposite direction, the polarity across the motor must be inverted. The microcontroller opens S1 and S4, and closes S3 and S2.

  1. Current flows from the positive supply through S3.
  2. It enters the motor at Terminal B and exits at Terminal A.
  3. The current flows through S2 to the ground.

Because the current now travels through the motor from B to A instead of A to B, the magnetic fields inside the motor reverse, causing the shaft to spin in the opposite direction.

Braking and Coasting States

Beyond directional control, an H-bridge allows a robot to stop its motors in two distinct ways:

  • Coasting (Freewheeling): All four switches (S1, S2, S3, S4) are opened. No current flows, and the motor simply spins down naturally due to friction.
  • Dynamic Braking: Both low-side switches (S2 and S4) are closed while the high-side switches remain open (or vice versa). This shorts the motor terminals together. Because a spinning motor acts as a generator, shorting its terminals causes the motor's own generated electricity to oppose its rotation, bringing it to a rapid halt.

Critical Circuit Protections

Controlling an inductive load like a motor introduces hazards that can destroy an H-bridge if not properly managed in the electronics design.

Preventing Shoot-Through

If both switches on the same side of the bridge (S1 and S2, or S3 and S4) are closed at the exact same time, it creates a direct short circuit from the positive power supply to the ground, bypassing the motor entirely. This condition is called "shoot-through." It results in a massive surge of current that will rapidly burn out the transistors. Robotics controllers implement "dead time"—a microscopic delay where all switches are turned off for a few nanoseconds before the next diagonal pair is turned on—to prevent shoot-through during direction changes.

Flyback Diodes

When current flowing through a motor's coil is suddenly switched off, the collapsing magnetic field generates a massive reverse voltage spike known as back-EMF (Electromotive Force). This voltage can easily exceed the tolerances of the transistors and destroy them. To protect the H-bridge, four "flyback" or "snubber" diodes are placed in parallel with each switch. These diodes provide a safe path for the back-EMF current to dissipate back into the power supply or ground without damaging the sensitive switching components.