April 1998, Written by Jim Brown
September 2002, page format revised, links updated by Bob Jordan
What’s all this talk about H-Bridges? How do they work? Well let’s see . . .
How do we make a motor turn?
You take a battery; hook the positive side to one side of your DC motor. Then you connect the negative side of the battery to the other motor lead. The motor spins forward. If you swap the battery leads the motor spins in reverse.
Ok, that’s basic. Now lets say you want a Micro Controller Unit (MCU) to control the motor, how would you do it? Well, for starters you get a device that would act like a solid state switch, a transistor, and hook it up the motor.
NOTE: If you connect up these relay circuits, remember to put a diode across the coil of the relay. This will keep the spike voltage (back EMF), coming out of the coil of the relay, from getting into the MCU and damaging it. The anode, which is the arrow side of the diode, should connect to ground. The bar, which is the Cathode side of the diode, should connect to the coil where the MCU connects to the relay.
If you connect this circuit to a small hobby motor you can control the motor with a processor (MCU, etc.) Applying a logical one, (+12 Volts in our example) to point A causes the motor to turn forward. Applying a logical zero, (ground) causes the motor to stop turning (to coast and stop).
Hook the motor up in this fashion and the circuit turns the motor in reverse when you apply a logical one (+12Volts) to point B. Apply a logical zero, which is usually a ground, causes the motor to stop spinning.
If you hook up these circuits you can only get the motor to stop or turn in one direction, forward for the first circuit or reverse for the second circuit.
Motor Speed
You can also pulse the motor control line, (A or B) on and off. This powers the motor in short burst and gets varying degrees of torque, which usually translates into variable motor speed.
But if you want to be able to control the motor in both forward and reverse with a processor, you will need more circuitry. You will need an H-Bridge. Notice the “H”-looking configuration in the next graphic. Relays configured in this fashion make an H-Bridge. The “high side drivers” are the relays that
control the positive voltage to the motor. This is called sourcing current.
The “low side drivers” are the relays that control the negative voltage to sink current to the motor. “Sinking current” is the term for connecting the circuit to the negative side of the power supply, which is usually ground.
So, you turn on the upper left and lower right circuits, and power flows through the motor forward, i.e.: 1 to A, 0 to B, 0 to C, and 1 to D.
Then for reverse you turn on the upper right and lower left circuits and power flows through the motor in reverse, i.e.: 0 to A, 1 to B, 1 to C, and 0 to D.
CAUTION: You should be careful not to turn on both circuits on one side or the other, or you have a direct short which will destroy your circuit; Example: A and C or B and D both high (logical 1).
Semiconductor H-Bridges
We can better control our motor by using transistors or Field Effect Transistors (FETs).
Most of what we have discussed about the relays H-Bridge is true of these circuits. You don’t need diodes that were across the relay coils now. You should use diodes across your transistors though. See the following diagram showing how they are connected.
These solid state circuits provide power and ground connections to the motor, as did the relay circuits. The high side drivers need to be current “sources” which is what PNP transistors and P-channel FETs are good at. The low side drivers need to be current “sinks” which is what NPN transistors and N-channel FETs are good at.
If you turn on the two upper circuits, the motor resists turning, so you effectively have a breaking mechanism. The same is true if you turn on both of the lower circuits. This is because the motor is a generator and when it turns it generates a voltage. If the terminals of the motor are connected (shorted), then the voltage
generated counteracts the motors freedom to turn. It is as if you are applying a similar but opposite voltage to the one generated by the motor being turned. Vis-ã-vis, it acts like a brake.
To be nice to your transistors, you should add diodes to catch the back voltage that is generated by the motor’s coil when the power is switched on and off. This flyback voltage can be many times higher than the supply voltage! If you don’t use diodes, you could burn out your transistors.
Transistors, being a semiconductor device, will have some resistance, which causes them to get hot when conducting much current. This is called not being able to sink or source very much power, i.e.: Not able to provide much current from ground or from plus voltage.
Mosfets are much more efficient, they can provide much more current and not get as hot. They usually have the flyback diodes built in so you don’t need the diodes anymore. This helps guard against flyback voltage frying your MCU.
To use Mosfets in an H-Bridge, you need P-Channel Mosfets on top because they can “source” power, and N-Channel Mosfets on the bottom because then can “sink” power. N-Channel Mosfets are much cheaper than P-Channel Mosfets, but N-Channel Mosfets used to source power require about 7 volts more than the supply voltage, to turn on. As a result, some people manage to use N-Channel Mosfets, on top of the H-Bridge, by using cleaver circuits to overcome the breakdown voltage.
It is important that the four quadrants of the H-Bridgecircuits be turned on and off properly. When there is a path between the positive and ground side of the H-Bridge, other than through the motor, a condition exists called “shoot through”. This is basically a direct short of the power supply and can cause semiconductors to become ballistic, in circuits with large currents flowing. There are H-bridge chips available that are much easier, and safer, to use than designing your own H-Bridge circuit.
H-Bridge Devices
The L 293 has 2 H-Bridges, can provide about 1 amp to each and occasional peak loads to 2 amps. Motors typically controlled with this controller are near the size of a 35 mm film plastic canister.
The L298 has 2 h-bridges on board, can handle 1amp and peak current draws to about 3amps. You often see motors between the size a of 35 mm film plastic canister and a coke can, driven by this type H-Bridge. The LMD18200 has one h-bridge on board, can handle about 2 or 3 amps and can handle a peak of about 6 amps. This H-Bridge chip can usually handle an average motor about the size of a coke. There are several more commercially designed H-Bridge chips as well.
There! That’s the basics about motors and H-Bridges! Hope it helps and be safe!
See also the DPRG H-Bridge Project for a do-it-yourself H-Bridge design with full schematic and PCB artwork.
More H-Bridge information
- Robot Room H-Bridge – David Cook’s load-protected H-Bridge design
- Tilden H-Bridge – Mark Tilden’s 6-transistor H-Bridge for BEAM robots
- H-Bridge Theory & Practice – Chuck McManis
- H-Bridge Spikes – Chuck McManis on Voltage Spikes in H-Bridges
- Servo Pulse to H-Bridge Interface – The missing link for your BattleBot