Bipolar H-Bridge:

# H-Bridge Motor Driver Using Bipolar Transistors

The classic beginner’s DC motor driver circuit that appears in every electronics textbook is the bipolar transistor H-bridge.

An H-bridge is an arrangement of transistors that allows a circuit full control over a standard electric DC motor. That is, an H-bridge allows a microcontroller, logic chip, or remote control to electronically command the motor to go forward, reverse, brake, and coast.

For the purposes of this article, I’m focusing on a basic H-bridge that is a good choice for most robots (including BEAM robots) and portable gadgets. This H-bridge can operate from a power source as low as two nearly-exhausted 'AAA' batteries (2.2V) all the way up to a fresh 9V battery (9.6V).

In later pages, I'll compare the performance of three different part numbers of popular transistors (2N3904/2N3906 vs 2N2222A/2N2907A vs Zetex ZTX1049A/ZTX968) using a common robot motor from Solarbotics.

The H-bridge circuit (below) looks complicated at first glance, but it is really just four copies of a resistor + transistor + diode.

Schematic of a bipolar transistor hbridge circuit to drive a DC motor. Can you see the letter 'H'?

There are many different ways to draw the circuitry, but the above wiring diagram matches the model of most h-bridges.

• Q1, Q3: These are NPN transistors. They connect the motor to ground (negative terminal of the battery).
• Q2, Q4: These are PNP transistors. They connect the motor to +2.2V to +9.6V (positive terminal of the battery).
• R1-R4: These resistors prevent too much current from passing through the base (labeled B) control pin of the transistor. The resistor value of 1 kilohm (1000 ohms) was chosen to provide enough current to fully turn on (saturate) the transistor. A higher resistance would waste less power, but might cause the motor to receive less power. A lower resistance would waste more power, but wouldn’t likely provide better performance for motors running on consumer batteries.
• D1-D4: Diodes provide a safe path for the motor energy to be dispersed or returned to the battery when the motor is commanded to coast or stop. I notice many H-bridge circuits on the web lack these diodes. I suppose that’s safe enough for light loads at low voltages, but without diodes, a motor voltage spike can force its way through the unprotected transistors, damaging or destroying them.
• M1: This is a direct-current (DC) motor. These are very common. You can find them in surplus stores online or in salvaged toys. The motor should have only two wires. Measure the resistance of the two motor wires using a multimeter. If the motor resistance is less than 5 ohms, then the transistor parts listed in this article are too weak to power the motor.

If you want complete information on how an H-bridge works, or if you want simpler or more powerful motor drivers, then please purchase a copy of my book, Intermediate Robot Building. Chapters 9 and 10 go into extensive detail and contain a lot of variations not shown here.

## Controlling the H-Bridge Motor Driver

The resistors are the inputs that control the H-bridge. By connecting a resistor to either +VDC or GND, it turns on or off the corresponding transistor. (+VDC is the positive end of the battery. GND is the negative end of the battery.) When a particular pair of transistors is turned on, the motor does something.

 Command R1 R2 R3 R4 Coast/Roll/Off: GND or disconnected +VDC or disconnected GND or disconnected +VDC or disconnected Forward: GND or disconnected GND +VDC +VDC or disconnected Reverse: +VDC +VDC or disconnected GND or disconnected GND Brake/Slow Down: +VDC +VDC or disconnected +VDC +VDC or disconnected

Since there are 4 resistors, there are actually sixteen possible ways this circuit can be commanded. Don’t sweat the other variations (they’re in the book if you’re curious). Except...

Never apply +VDC to R1 and GND to R2 at the same time! You'll short circuit the battery.

Never apply +VDC to R3 and GND to R4 at the same time! You'll short circuit the battery.

Next, let’s build the H-bridge circuit using real parts...