Alexander Robotics

Visualizing H-bridges

Introduction

While writing an upcoming post for the Idea to Prototype series covering “Brains”, it became clear a significant portion of the topic is the motor driver — a circuit to control the movement of the robot’s motors. The critical component of the motor driver is the H-bridge, enough so, I felt it deserves its own post.

There are solid resources available on H-bridges already. The goal here is to cover the H-bridge from a high-level, to help visualize its purpose.

A motor has two leads. Each lead has three possible states: connected to positive voltage, connected to ground, or open. The value of each lead not only controls the movement of the shaft clockwise or counterclockwise, but also allows for braking or coasting.

Left Lead Right Lead Result
Open Open Coast
Positive Positive Brake
Positive Ground Counterclockwise
Ground Ground Brake
Ground Positive Clockwise
H-Bridge lead connections and their affect on the motor.

The H-bridge circuit can connect each lead to ground or positive (and sometimes open). So what? A microcontroller can too.

The big deal is that an H-bridge can connect a motor’s leads to a higher voltage unregulated power, like 9, 12, and 24 volts. A microcontroller or logic chip may supply up to 5V, but many motors require 6V or more. A motor may also use 150 mA, 300 mA, on up — a current microcontrollers cannot provide. When working with an H-bridge, a lower powered signal — like the pins of a microcontroller — configures how the H-bridge supplies the motor with the awesome power connected to it.

Circuit Scenarios

An H-bridge, in its most high level view, is four switches: two for each motor lead. One switch on each side connects to positive, the other switch on each side connects to ground.

H-bridge with all switches open for coasting.
Coasting

When all the switches are open, there is an open circuit and the motor is free to coast. Coasting is also called “slow decay” as the motor’s energy is consumed slowly due to friction.

H-bridge with left switch to positive closed and right switch to
      ground closed, causing motor to sping counterclockwise.
Counterclockwise

When the left switch connected to positive is closed and the right switch to ground is closed, a closed circuit occurs and the motor spins counterclockwise.

H-bridge with left switch to ground closed and right switch to
      positive closed, causing motor to sping clockwise.
Clockwise

As expected, the motor spins clockwise when the switches are reversed.

H-bridge with left and right side connected to ground, causing the
      motor to brake.
Brake low

With both sides’ switches connected to ground, motor energy is quickly drained. Ground to ground and positive to positive creates what is called an “electronic brake” or “fast decay”. An electronic brake dissipates the energy from a motor quickly to help slow it down. It does not serve as a physical brake to the motor. Ground to ground is called “braking low” and positive to positive is called “braking high.”

H-bridge with left side connected to positive and ground, causing a
      short circuit.
Short circuit

The more observant readers may have noticed a possible predicament. What if the switch connected to positive and the switch connected ground are both closed on the same side? Exactly what you would expect to happen. The electricity travels the path of least resistance, and a motor is certainly more resistant than a wire, so a short circuit is formed. Many H-bridge implementations prevent the ability to close both positive and ground on the same side, and thus prevent the short circuits.

Chips

Two popular H-bridge chips (technically quad half H-Bridge chips) are the SN754410 and its predecessor, the L293D. The two chips are identical in pin layout, but the SN754410 is capable of 1A continuous output current at higher voltages. Plenty of resources are online for using the chips as part of a robot’s motor driver, including my next post.

Further Reading

The objective here was a gentle introduction to H-bridges. The switches shown can be implemented using transistors (bipolar or MOSFET). When dealing with motors, a flyback diode for each transistor is a good idea to help control any voltage generated by the motor. In addition, the Driving Miss Motor and Driving Mister Motor chapters in the Intermediate Robot Building book provide an excellent overview of H-bridges and motor drivers.

blog comments powered by Disqus