You can learn how to build h-bridges from many on- and off-line resources. After all these circuits are not terribly complicated. Some of those resources are good, some are not so much. However when I’ve started working with them, I’ve realized that many of my experiences were not documented and some of the things I’ve learned seemed to be missing from those descriptions. So I decided to write down what I’ve learned and try to organize that description into an easy to understand yet comprehensive structure.
This work started off as a three-part series I’ve written, while developing the µModule H-bridge. While the current material is based on those articles, it corrects many errors and is expanded and updated greatly.
My intention is to cover more ground than most articles I’ve seen on the subject. While I don’t expect the you, dear reader, to be familiar with h-bridges or motors controllers in general, I do build upon basic electrical circuit understanding. So if you don’t know what a resistor, an inductor or a capacitor is, if you don’t understand at least the basics of time- and frequency-domain circuit analysis, you’re not reading the right article. You probably won’t be able to follow the discussion. But if you’re interested in motor control background information, if you want to understand the reasons behind design decisions, if you want to gain deeper knowledge not just in the h-bridges, but in what goes on before and after them, you have found your place.
My plan is to eventually expand these articles to cover not just h-bridges but control circuits and electromechanical systems as well.
In general an H-bridge is a rather simple circuit, containing four switching element, with the load at the center, in an H-like configuration:
The switching elements (Q1..Q4) are usually bi-polar or FET transistors, in some high-voltage applications IGBTs. Integrated solutions also exist but whether the switching elements are integrated with their control circuits or not is not relevant for the most part for this discussion. The diodes (D1..D4) are called catch diodes and are usually of a Schottky type.
The top-end of the bridge is connected to a power supply (battery for example) and the bottom-end is grounded.
In general all four switching elements can be turned on and off independently, though there are some obvious restrictions.
Though the load can in theory be anything you want, by far the most pervasive application if H-bridges is with a brushed DC or bipolar stepper motor (steppers need two H-bridges per motor) load. In the following I will concentrate on applications as a brushed DC motor driver.
The basic operating mode of an H-bridge is fairly simple: if Q1 and Q4 are turned on, the left lead of the motor will be connected to the power supply, while the right lead is connected to ground. Current starts flowing through the motor which energizes the motor in (let’s say) the forward direction and the motor shaft starts spinning.
If Q2 and Q3 are turned on, the reverse will happen, the motor gets energized in the reverse direction, and the shaft will start spinning backwards.
In a bridge, you should never ever close both Q1 and Q2 (or Q3 and Q4) at the same time. If you did that, you just have created a really low-resistance path between power and GND, effectively short-circuiting your power supply. This condition is called ‘shoot-through’ and is an almost guaranteed way to quickly destroy your bridge, or something else in your circuit.
Because of this restriction from the four possible states the side-A switches could be in only three make sense:
Similarly for side-B:
Altogether this allows for 9 different states for the full bridge to be in:
We will get into much more detail in a minute, but before we do, let’s spend a few minutes understanding the basics of our load, the DC motor.
While modeling DC motors is a complicated topic, one that you can read on extensively here, for this article, let’s just start with a very simple model! This model will not be useable for control applications, where you try to electrically compensate for the effects of mechanical components. The main assumption in the model introduced here is that the mechanical time-constants in your system are much higher than the electrical ones, in other words we can consider the shaft speed to be constant for our analysis. That’s true in almost all cases, but you’ll need to read other articles to understand why. For now, you’ll have to take my word for it.
A DC motor is an energy conversion device: it takes electrical energy and turns it into mechanical energy. When operated as a generator, it does the opposite: converts mechanical energy into electrical.
In this very simple motor model, the mechanical parameters are completely ignored. On the electrical side, the motor basically contains a number of inductors, that move in a magnetic field. The inductors themselves of course have an inductance, and some internal resistance. Their movement in the field will generate a voltage – called generator voltage and denoted by Vg – across the inductors. From this description, the following model can be drawn:
In fact in many cases, the internal resistance of the inductors can be disregarded, and an even simpler model, an ideal inductor in series with a voltage source can be used:
In both cases, all the elements are in series, so they share the same current, but the voltage across them of course is different.
The generator voltage (Vg) depends only on the speed by which the inductors move in the field, in other words on the rotational speed of the motor.
The force (or torque in a rotational system, like a DC motor) these electromagnets – inductors – exert is proportional to the current flowing through them.
Previously we’ve only considered static operation, when nothing was changing. If less than full-speed operation is intended the switches are controlled in a PWM fashion. A PWM signal has two phases, the ‘on-time’ and the ‘off-time’ as I’m calling them in the diagram below:
It is a periodic signal, with a constant frequency. The information content – that is used to change the operating parameters of the bridge – is the ratio between the on-time and the off-time. The various drive modes differ in how the switches are set during the on-time and the off-time.
If we want the motor to do anything interesting, we will have to connect it to the power supply in at least one of the phases. Let’s say it is the ‘on-time’. We have two choices: either we turn on Q1 and Q4 or we turn on Q2 and Q3.
But what about the off-time? We have nine states to chose from. These are:
If you look back at our motor model, you’ll see that it’s basically an inductive load. Inductors have the property that you can’t change the current flowing through them instantaneously. So, whenever the bridge changes state with the motor current being non-zero, the new state has to make sure that the current can continue to flow in some way. The catch diodes are usually not used for this purpose, because (as you will see later) they would heat up too much. There are of course exceptions, but those are just that: exceptions.
Now, during the on-time the motor inductor is connected between the power supply and GND. Consequently the current will start rising through the inductor. It is very unlikely that by the time the on-time is over, and we’re ready to switch the bridge into its off-time state, the current would be 0. So its best to choose a state for the off-time where we can provide a path for the inductor-current to flow. In order to do that, we’ll have to close one switch each on both sides of the motor, and that prunes out our possible off-time states quite a bit:
If we combine those four choices with the two possible on-time states, we get eight possible configurations. In two of them however both the on-time and the off-time states are the same, and those are not terribly interesting: the bridge operates in a static way. That leaves us with six meaningful mappings, that I’ll summarize below:
You can find some interesting symmetries in the tables.
For example mapping 3 and 4 change both sides. However if we swap side-A and side-B in mapping 3, we get mapping 4, and vice versa. We call these mappings the ‘lock anti-phase drive’.
The other four mappings (1, 2, 5 and 6) only change the state of one side of the bridge. Mapping 1 and 5 are however mirrors of each other the same way as 3 and 4 were: by swapping side-A and side-B we can transform one into the other. The same holds true for mapping 2 and 6. We call this type of operation the ‘phase-magnitude drive’.
In future parts of the article, I’ll talk in detail about both drive modes.
This simple categorization of drive modes works for most cases but not for all. There are some more esoteric drive modes that can be beneficial under certain rare circumstances.
If you look through the mappings above, you’ll see that both in the on-time and in the off-time one switching element is on on each side of the bridge. We did that in order to provide a continuous path for the motor current to flow. But if that’s true, what’s the purpose of these diodes? Can we leave them out? The answer is resounding no, and the reason is the following: it is impossible in any real circuit to turn on or off the high- and low-side switches at exactly the same time. They are either a bit early or a bit late. In one case, both the high- and low-side switch would be on for a short while, in the other both would be off momentarily.
If both are on, you created a shoot-through condition that is very very bad. We want to avoid short-circuiting the supply – even momentarily – by any means. So all practical bridge designs are biased in the other way, making sure that the two switches are never on at the same time, but as a consequence they will be both off for a short while during switching.
Now, when both switches are off on one side, the motor current has nowhere to flow. That’s bad in a different way: the motor voltage will jump as high as it needs to create a path for the current to flow. That voltage jump will probably kill one of the switches and the current path is created through the damaged switch. That’s not a nice way for the bridge to go, so some protection is necessary. The role of the catch-diodes is to provide a path for the current during these short switching periods without the motor voltage needing to rise too high. In some implementations, the intrinsic diodes of the MOSFET switches are used as catch diodes, in others, for example when BJTs are used as switching elements, the diodes must be provided externally.
The other thing to discuss is why not to use the diodes to conduct the off-time current? The main question that determines the answer is heat dissipation. Which one runs cooler: the diode or the switch?
In most bridge setups, the current changes relatively little during the on- and off-time compared to the average current flowing though the motor, so for the following discussion I will pretend the current is constant.
The difference between a diode and the switch (independent of switch technology) is that while your switching elements (when they’re closed) have a relatively constant and low resistance, a conducting diode has a relatively constant voltage drop on it. This means that the power dissipated on the switch is proportional to the square of the current:
Pswitch = Vswitch * I = Rswitch * I2
while the power on the diode scales linearly:
Pdiode = Vf * I (where Vf is the forward voltage drop of the diode)
From this you see that as long as the current is lower than Vf/Rswitch, you’re better off using the switches to conduct the off-time current. For most diodes Vf is in the range of 0.2 to 1V, while Rswitch is normally way lower than 1Ω, usually lower than 100mΩ. It’s also much easier to lower Rswitch than Vf if you get into trouble with heat dissipation, not to mention that Vf usually goes somewhat higher with the current. You can find MOSFETs with an on-resistance of lower than 10mΩ without too much trouble. Even integrated H-bridges contain FETs with an on-resistance of less than 25mΩ these days. If we take that bridge for example, it’s internal diode has a 0.8V forward voltage drop and a 23mΩ on-resistance (these are typical values). With those numbers you’ll see that the cross-over point is at 35A, which is over the rated 30A current limit for that part. This is typical except for extremely high-current applications: you operate the bridge under the cross-over point, where it’s more beneficial to use the switches to conduct the off-time current.
In this article we went through the basic construction of an H-bridge and created a catalog of the useful operating modes. We’ve identified two main categories: phase-magnitude drive and lock-anti-phase drive. In future parts of the series I’ll look in detail at both of those drive modes.
We’ve also briefly discussed the role of the catch diodes, why they are essential and why they’re not used to conduct more current than absolutely necessary.
If you feel the discussion here was fairly high level and maybe elementary, don’t worry, there’s plenty of detail to come.