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.
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.
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...