Electronics
Mini projects
robotics
Tutorials
H-Bridge - Basics and Operation
5:09 PMH-Bridge - Basics and Operation:
The H-bridge is a circuit used in electronic control of high current devices, particularly where the device polarity may be reversed, e.g. DC motors. The name comes from the fact that the circuit typically looks like a letter "H".
Full bridge operation:
The circuit shown has four switches and a motor. To apply a voltage across the motor a pair of diagonally opposite switches need to be turned on. Depending on which pair of switches are turned on the motor will turn one way or another. If both the top or both the bottom switches are turned on the motor will have no voltage difference across it so it won't move at all. If the top and bottom switches on one side are turned on together by accident we will short out the supply, so you need to be careful if you're building your own H-bridge. Most pre-packaged ones will have internal logic to prevent this.
You can build an H-bridge like this out of relays instead of switches and control them with a lower current to drive big motors but most often the switches are replaced with transistors, a pair of PNP transistors (or p-type MOSFETS) at the top and a pair of NPN (or n-type MOSFETS) at the bottom.
PWM Control of a full bridge:
PWM is a method of digitally controlling an output with a variable equivalent voltage. Essentially if you take the average of the signal over time then it has a varying analog level, however in the short term it is digital. This makes it easy to generate and efficient as transistors are most efficient when on or off rather than partially conducting. Most modern microcontrollers have the ability to generate PWM built in, including the Arduino and derivatives.
To control a plain H-bridge you need 4 signals to control the 4 transistors, to control it with PWM you need two PWM signals and two plain digital signals. You could theoretically use just the two PWM outputs, however you need to be careful about the polarity of the signal compared to the transistor you're driving. Some microcontrollers include a full bridge driver (Microchip call this Enhanced Capture/Compare/PWM or ECCP on their 8bit PIC chips) which drives 4 outputs and you can hook up to the H-bridge. However it still needs 4 control lines. If you can drive both your PNP and NPN transistors from the same logic line (i.e. your motor power and logic rails are the same) you can connect the PWM to both A and B inputs and a direction control to C and D. In this configuration however you have to invert the duty-cycle when you are running in reverse because it's the low part of the duty cycle that turns the motor on, shown as "Inverted PWM" above.
Better PWM control:
There are a couple of ways I can think of to make the H-bridge much simpler to control. Essentially what we want is to add an over-all enable line to the H-bridge so we can use one enable line controlled by PWM rather than using a complex H-bridge driver. One way is to add another transistor to the circuit that only connects the bottom rail of the H-bridge to the negative supply. Pulsing this will make the motor run only while the control is high so PWM on this would make an overall speed control without having to worry about which direction the motor is running. The cost of the extra transistor could be quite high if you're using high power transistors or MOSFETS and depending on your voltage rails this might be eating into your motor voltage as there'll be a 0.7-0.4V drop across each transistor or MOSFET. The other option then is to use logic to filter the control lines so that the PWM signal is combined with the direction signals.
Using an H-bridge chip:
In a lot of cases, especially with little toy motors, you don't need to build a whole H-bridge circuit from scratch. In fact using a chip can save you a lot of trouble with offset voltages; if you have a different motor supply voltage from your logic voltage you'll need drivers between the logic and the power transistors. There are a couple of chips I'd recommend and it depends really on how powerful your motors are which one to use, both are dual H-bridge chips (so you can control 2 motors) and both have 2 enable lines so you can connect a PWM line for each motor.
L298
The 298 is a high power dual-H-bridge driver which can handle 2A continuous current on each channel. It's in a big heat-sinkable package and if you're running it close to the limit I'd recommend using this heat sink. The 298 also has current sense lines on each of the two channels which you can add a low value resistor to ground and monitor the current being drawn by each motor. If you need to save some pins you can bridge the direction lines with a not gate and only use one line for direction control. Yu can also parallel up the inputs and outputs on this chip to make a 4A continuous drive bridge but you need to be careful to wire up the inputs in the right order. You need to provide your own protection diodes to suppress the inductive response of the motor and protect your circuit from negative voltages, these are wired "backwards" across your motor supply.
L293/SN754410
The L293 (and pin compatible SN754410) have a very similar block diagram to the L298 but a much lower current capacity. The continuous running current is 1A for the L293/SN754410 or 0.6A for the L293D. It is packaged as a normal DIP IC so if you need to heat sink it you're recommended to have a big ground plane connected rather than a heat sink block. This is fine if you have a PCB but it can be a bit difficult to achieve on strip board. The L293D can only handle about half the current of the L293 but has internal protection diodes so it really is a single component solution for driving low power motors. The SN754410 has the protection diodes for running inductive loads as well but can handle up to 1.1A continuous current, it has identical pinout and better absolute maximum ratings so is a safe drop in replacement for the L293D.
Datasheets:
st.com L298 Farnell: 403-295 ti.com L293/L293D Farnell: 147-0423 ti.com SN754410NE Farnell: 147-0411
0 comments