Vous êtes sur la page 1sur 26

Types of Chopper Circuits

john
January - 31 - 2012
7 Comments

In chopper circuits, unidirectional power semiconductors are used. If these semiconductor


devices are arranged appropriately, a chopper can work in any of the four quadrants. we can
classify chopper circuits according to their working in any of these four quadrants as type A,
type B, type C, type D and type E. Let us now take a look of these classifications and the
characteristics of various classifications.

Type A Chopper or First–Quadrant Chopper

This type of chopper is shown in the figure. It is known as first-quadrant chopper or type A
chopper. When the chopper is on, v0 = VS as a result and the current flows in the direction of the
load. But when the chopper is off v0 is zero but I0 continues to flow in the same direction
through the freewheeling diode FD, thus average value of voltage and current say V0 and I0 will
be always positive as shown in the graph.

Chopper First Quadrant

In type A chopper the power flow will be always from source to the load. As the average voltage
V0 is less than the dc input voltage Vs

Type B Chopper or Second-Quadrant Chopper


Chopper Second Quadrant

In type B or second quadrant chopper the load must always contain a dc source E . When the
chopper is on, v0 is zero but the load voltage E drives the current through the inductor L and
the chopper, L stores the energy during the time Ton of the chopper . When the chopper is off , v0
=( E+ L . di/dt ) will be more than the source voltage Vs . Because of this the diode D2 will
be forward biased and begins conducting and hence the power starts flowing to the source. No
matter the chopper is on or off the current I0 will be flowing out of the load and is treated
negative . Since VO is positive and the current I0 is negative , the direction of power flow will
be from load to source. The load voltage V0 = (E+L .di/dt ) will be more than the voltage
Vs so the type B chopper is also known as a step up chopper .

Type -C chopper or Two-quadrant type-A Chopper

Type C chopper is obtained by connecting type –A and type –B choppers in parallel. We will
always get a positive output voltage V0 as the freewheeling diode FD is present across the
load. When the chopper is on the freewheeling diode starts conducting and the output voltage v 0
will be equal to Vs . The direction of the load current i0 will be reversed. The current i0 will be
flowing towards the source and it will be positive regardless the chopper is on or the FD
conducts. The load current will be negative if the chopper is or the diode D2 conducts. We can
say the chopper and FD operate together as type-A chopper in first quadrant. In the second
quadrant, the chopper and D2 will operate together as type –B chopper.
Chopper Two Quadrant

The average voltage will be always positive but the average load current might be positive or
negative. The power flow may be life the first quadrant operation ie from source to load or from
load to source like the second quadrant operation. The two choppers should not be turned on
simultaneously as the combined action my cause a short circuit in supply lines. For regenerative
braking and motoring these type of chopper configuration is used.

Type D Chopper or Two-Quadrant Type –B Chopper

Two Quadrant Type B chopper or D Chopper Circuit


The circuit diagram of the type D chopper is shown in the above figure. When the two choppers
are on the output voltage v0 will be equal to Vs . When v0 = – Vs the two choppers will be off
but both the diodes D1 and D2 will start conducting. V0 the average output voltage will be
positive when the choppers turn-on the time Ton will be more than the turn off time Toff its
shown in the wave form below. As the diodes and choppers conduct current only in one direction
the direction of load current will be always positive.

Positive First Quadrant Operation and Negative Fourth Quadrant Operation

The power flows from source to load as the average values of both v0 and i0 is positive. From
the wave form it is seen that the average value of V0 is positive thus the forth quadrant
operation of type D chopper is obtained.

From the wave forms the Average value of output voltage is given by
V0= (Vs Ton-VsToff)/T = Vs.(Ton-Toff)/T

Type –E chopper or the Fourth-Quadrant Chopper

Type E or the fourth quadrant chopper consists of four semiconductor switches and four diodes
arranged in antiparallel. The 4 choppers are numbered according to which quadrant they belong.
Their operation will be in each quadrant and the corresponding chopper only be active in its
quadrant.
E-type Chopper Circuit diagram with load emf E and E Reversed

 First Quadrant

During the first quadrant operation the chopper CH4 will be on . Chopper CH3 will be off and
CH1 will be operated. AS the CH1 and CH4 is on the load voltage v0 will be equal to the source
voltage Vs and the load current i0 will begin to flow . v0 and i0 will be positive as the first
quadrant operation is taking place. As soon as the chopper CH1 is turned off, the positive current
freewheels through CH4 and the diode D2 . The type E chopper acts as a step- down chopper in
the first quadrant.

 Second Quadrant

In this case the chopper CH2 will be operational and the other three are kept off. As CH2 is
on negative current will starts flowing through the inductor L . CH2 ,E and D4. Energy is stored
in the inductor L as the chopper CH2 is on. When CH2 is off the current will be fed back to the
source through the diodes D1 and D4. Here (E+L.di/dt) will be more than the source voltage Vs .
In second quadrant the chopper will act as a step-up chopper as the power is fed back from load
to source

 Third Quadrant

In third quadrant operation CH1 will be kept off , CH2 will be on and CH3 is operated. For this
quadrant working the polarity of the load should be reversed. As the chopper CH3 is on, the load
gets connected to the source Vs and v0 and i0 will be negative and the third quadrant operation
will takes place. This chopper acts as a step-down chopper

 Fourth Quadrant
CH4 will be operated and CH1, CH2 and CH3 will be off. When the chopper CH4 is turned on
positive current starts to flow through CH4, D2 ,E and the inductor L will store energy. As the
CH4 is turned off the current is feedback to the source through the diodes D2 and D3 , the
operation will be in fourth quadrant as the load voltage is negative but the load current is
positive. The chopper acts as a step up chopper as the power is fed back from load to source.

Introduction
A number of web sites talk about H-bridges, they are a topic of great discussion in robotics clubs
and they are the bane of many robotics hobbyists. I periodically chime in on discussions about
them, and while not an expert by a long shot I've built a few over the years. Further, they were
one of my personal stumbling blocks when I was first getting into robotics. This section of the
notebook is devoted to the theory and practice of building H-bridges for controlling brushed DC
motors (the most common kind you will find in hobby robotics ...) I've got an image of one
below with both as a unit and "expanded" in an exploded view.
Basic Theory
Let's start with the name, H-bridge. Sometimes called a "full bridge" the H-bridge is so named
because it has four switching elements at the "corners" of the H and the motor forms the cross
bar. The basic bridge is shown in the figure to the
right.

Of course the letter H doesn't have the top and


bottom joined together, but hopefully the picture is
clear. This is also something of a theme of this
tutorial where I will state something, and then tell
you it isn't really true :-).

The key fact to note is that there are, in theory, four


switching elements within the bridge. These four
elements are often called, high side left, high side
right, low side right, and low side left (when
traversing in clockwise order).

The switches are turned on in pairs, either high left


and lower right, or lower left and high right, but
never both switches on the same "side" of the
bridge. If both switches on one side of a bridge are turned on it creates a short circuit between the
battery plus and battery minus terminals. This phenomena is called shoot through in the Switch-
Mode Power Supply (SMPS) literature. If the bridge is sufficiently powerful it will absorb that
load and your batteries will simply
drain quickly. Usually however the
switches in question melt.

To power the motor, you turn on two


switches that are diagonally opposed.
In the picture to the right, imagine that
the high side left and low side right
switches are turned on. The current
flow is shown in green.

The current flows and the motor


begins to turn in a "positive"
direction. What happens if you turn on
the high side right and low side left
switches? You guessed it, current
flows the other direction through the
motor and the motor turns in the
opposite direction.
Pretty simple stuff right? Actually it is just that simple, the tricky part comes in when you decide
what to use for switches. Anything that can carry a current will work, from four SPST switches,
one DPDT switch, relays, transistors, to enhancement mode power MOSFETs.

One more topic in the basic theory section, quadrants. If each switch can be controlled
independently then you can do some interesting things with the bridge, some folks call such a
bridge a "four quadrant device" (4QD get it?). If you built it out of a single DPDT relay, you can
really only control forward or reverse. You can build a small truth table that tells you for each of
the switch's states, what the bridge will do. As each switch has one of two states, and there are
four switches, there are 16 possible states. However, since any state that turns both switches on
one side on is "bad" (smoke issues forth), there are in fact only four useful states (the four
quadrants) where the transistors are turned on.

High SideHigh Side Lower Lower


Left Right Left Right Quadrant Description

On Off Off On Motor goes Clockwise

Off On On Off Motor goes Counter-clockwise

On On Off Off Motor "brakes" and decelerates

Off Off On On Motor "brakes" and decelerates

The last two rows describe a maneuver where you "short circuit" the motor which causes the
motors generator effect to work against itself. The turning motor generates a voltage which tries
to force the motor to turn the opposite direction. This causes the motor to rapidly stop spinning
and is called "braking" on a lot of H-bridge designs.

Of course there is also the state where all the transistors are turned off. In this case the motor
coasts if it was spinning and does nothing if it was doing nothing.
Building the H-Bridge
I really like this H-bridge for a number of reasons, not the least of which is that if you buy your
parts in quantities of 1, all the parts cost under $5 (excluding tax & shipping of course) for a 1 - 5
amp capable H-bridge. This keeps the final circuit in the "cheap" category which was one of the
design parameters we're optimizing for. The complete schematic for the bridge is shown below.
The fast recovery diodes (shown in light blue) are optional when you are using the TIP102/107
as those transistors have a diode built into them. However you can include them for greater
protection at higher currents and still keep the cost at $5 per bridge. In the table below is a parts
list, with prices from November of 2003, using part numbers from Mouser Electronics. You will
note that I also take advantage of the symmetrical nature of the bridge by using resistor packs
rather than individual resistors. These packs allow for a tighter design while still using through
hole technology. If size is an issue, you'll probably go with surface mount rather than this type of
circuit.

Qty Mouser Part # Description Each Total

2 511-TIP107 TIP107, PNP Power Darlington Transistor (TO-220AB) $0.70 $1.40

2 511-TIP102 TIP102, NPN Power Darlington Transistor (TO-220AB) $0.70 $1.40

1 652-4608X-102-10K 10K Ohm, SIP Resistor network (independent resistors) $0.23 $0.23

1 652-4608X-102-560 560 Ohm, SIP Resistor network (independent resistors) $0.23 $0.23

1 652-4608X-102-1K 1K Ohm, SIP Resistor network (independent resistors) $0.23 $0.23

1 551-PS2501-4 Quad Opto-coupler (16 pin DIP) $1.31 $1.31

4 625-1N4933 1A Fast Recovery Rectifier (Optional) $0.05 $0.20


$5.00
Total For Components

Table 1) Parts List for the Simple H-Bridge

In the previous section we discussed the individual parts of this design, here they are gathered
together in a single circuit. You should notice that the opto-isolator LEDs are connected to three
wires labeled "FWD", "REV", and "ENA*." These wires deserve a bit of explanation.

Processor Interface

The FWD, REV, and ENA* lines are the interface between the bridge and the microprocessor.
You will notice their is no "ground" signal. When you connect these pins to a BASIC stamp or a
68HC11 or what-ever, combinations of 1's and 0's on the line turn on different pairs of
transistors. The following table lists all possible combinations of input.

FWD REV ENA* Description

1 0 0 Turn on upper left source and lower right sink. (go forward)

1 0 1 Disable lower right sink. When fed a PWM signal the bridge modulates
the "forward" current through the motor.

1 1 0 Turn on both lower left sink and lower right sink, shorting the motor. This
causes a rotating motor to stop rotating so this mode is called "Braking."

1 1 1 Disable both lower sinks. When fed a PWM signal the bridge modulates
the "braking" of the motor.

0 1 0 Turn on the upper right source and lower left sink. (go backward)

0 1 1 Disable lower left sink. When fed a PWM signal the bridge modulates the
"reverse" current through the motor.

0 0 0 Turn off all sources and sinks. "Coast" motor is not engaged at all.

0 0 1 Turn off all sources and sinks in a different way, same effect though.

This works because the processor pins become a connection to ground when they are outputting
a logic 0. Thus when FWD is 1 and ENA is 0, the lower right sink is getting current from FWD
which it is returning through the pin connected to ENA. At any given time the pin must be able
to supply enough current to turn on two LEDs and when set to zero sink the current of two
LEDs. With the 560 ohm resistors and a 5V processor like the PIC this is not a problem. From
the data sheet on the opto-isolator, each LED has a forward voltage drop of 1.2V, so (5 - 1.2) /
560 is 6.8mA per LED or 14mA of load total. The PIC is specified to be able to drive 20mA.
You can replace the 560 ohm resistors with 680 ohm resistors to reduce the current through the
LEDs still further. However the LED voltage drop can be as high as 1.4V and the PIC's operating
voltage can be as low as 4.5V, in that condition with 680 ohm resistors you would only put
4.5mA into each LED which is below the 5mA specified in the datasheet. The 560 ohm resistor
is the better choice as it maintains sufficient margin.

So why go to all this trouble? The interface as designed gives you access to all of the interesting
combinations of sinks and sources enable, while not allowing for any "illegal" states. An illegal
state in a full quadrant H-bridge (4 inputs, one for each quadrant) is one that turns on the upper
source and lower sink on the same side. This combination causes a direct short circuit to be
created between the battery terminals (not good!) and usually causes one or both of the
transistors that are on to go up in smoke. Further, as the low end PIC chips like the PIC16F628
has a single hardware PWM line, this lets you connect that line to the bridge and a couple of
GPIO pins to the FWD and REV lines to get a hardware PWM on the bridge. Just remember not
to go above 2.5Khz unless you replace the opto-isolator with a faster one.

Summarizing

So before we solder it all together, lets analyze the design and try to characterize its performance.
This will give us confidence that this H-bridge will meet the requirements we need it to meet,
and we won't be surprised by it not working on us.

Building a Test Bench


So we've got a parts list, a schematic, and you could just jump in and build this bridge to see if it
will work. However, as this is both a theory and a practice tutorial I'll dive in a bit deeper than
that.

To understand how this bridge performs in


practice, I built one half of it on a piece of proto-
board. I only had to build "half" the circuit
because the circuit is symmetrical, anything I can
learn about this half is equally applicable to the
other half. The only thing this won't tell me is
what the behavior would be if the bridge switches
from full forward to full reverse in one go. The
picture on the right shows the half bridge and a
Basic Stamp II board next to it on the left.
The Basic Stamp is used as a test pattern
generator for my experiments.

The schematic of the test circuit is shown


on the right. Inputs to this circuit are P0
and P1 which reflect the names of the Basic Stamp 2 pins to which those test points are
connected. On the right side of the schematic are four test points labeled TP1 through TP4 which
correspond to the battery and motor connections in the full schematic.

By building one half of the full h-bridge, I can turn on one low side (sink) transistor and one high
side (source) transistor and then look at the waveforms and voltages under controlled conditions.
The difference between this schematic and the one in the previous section is that half of the
bridge is missing, and I've added independent control of the transistors. thus the FWD, REV, and
ENA* lines aren't present.

For the static tests I have the Basic Stamp II simply turn on the transistors and leave them on.
One additional piece of information gathered was that 470 ohm resistors work as do 560 ohm
resistors. (560 turned out to be my final value that I used). If you don't have a Stamp or some
other piece of equipment that generates signals you can simply connect the 1K resistors to TP1
and TP4 respectively. That will force the transistors on while you are doing the tests.

Static Tests
The first set of tests are static analysis of the transistor behavior. The three parameters I was most
interested in were the voltage drop across the "source" transistor, the voltage drop across the
"sink" transistor, and heat dissipation in the transistors. These tests are run with a voltmeter and
an adjustable power supply. The datasheets include graphs of these parameters because they
change for different currents. I thought I would pick three currents from which to take
measurements of 10mA, 100mA, and 1000mA then plot the results. Note that the next step for
current in a log scale would be 10 amps but the circuit is not rated for 10 amps. You could go to
2 amps (pretty much the limit without using heatsinks) or to 6 amps if the transistors had
heatsinks installed.

Test #1 : Source side Voltage Drop

Purpose: The purpose of this test was to ascertain the voltage drop across the high side (source)
transistor. The motor will see the battery voltage minus this voltage and the voltage drop across
the sink transistor so knowing these values help define the lowest voltage that is practical with
this bridge.

Description: A variable output bench top power supply is connected to TP1 and TP4. To create
a load, a 4.7 ohm, 10 watt, power resistor is connected between TP2 and TP4. A digital voltmeter
was connected between TP1 and TP2 and set to "DC Volts".

The power supply was turned on and its current output adjusted to 10 mA, a reading was taken
on the voltmeter, then the current is increased to 100 mA and finally 1000 mA.

Test Results: The results of this test are collated in the table below. As the current through the
transistor is changed from 10mA to 1000mA the voltage drop changes from a low of about .6 V
to a high of about .9V. This change is plotted in the chart on the right side of the table.
Measured
Current Chart
Voltage Drop

10 mA
0.602 V

100 mA 0.687 V

1000 mA 0.950 V

What this tells us is that as the current gets larger the transistor is less like a conductor and more
like a resistor. The physics behind this change are due to the fact that silicon, unlike other metals,
is transferring charge carriers (electrons and holes) through a crystal lattice. The larger the
current, the more charge carriers are required, and the space in the lattice is finite. The result is
that more charge carriers collide with the lattice generating heat, and the difference in charge
going in vs. that going out is measured as a voltage drop. (recall that the voltage potential
between two points is simply the difference in charge between those points)

Test #2 : Sink side Voltage Drop

Purpose: The purpose of this test was to ascertain the voltage drop across the low side (sink)
transistor. The motor will see the battery voltage minus this voltage and the voltage drop across
the source transistor so knowing these values help define the lowest voltage that is practical with
this bridge.

Description: A variable output bench top power supply is connected to TP1 and TP4. To create
a load, a 4.7 ohm, 10 watt, power resistor is connected between TP1 and TP3. A digital voltmeter
was connected between TP3 and TP4 and set to "DC Volts".

The power supply was turned on and its current output adjusted to 10 mA, a reading was taken
on the voltmeter, then the current is increased to 100 mA and finally 1000 mA.

Test Results: Again I've collected the results into a table below. To bring this back to a global
point about this web site, there is a page in my "physical" robotics notebook where I hand drew a
box with 10, 100, and 1000 in the left hand side, then as I got measurements I wrote them to the
right. Around the box I identified these results as being "Sink Experiment #2" and the date. I can
go back later and refer to the notebook pages I created during this project and easily re-create my
experiment or refresh my self on the results of that experiment.

Measured
Current Chart
Voltage Drop

10 mA 0.576 V
100 mA 0.637 V

1000 mA 0.763 V

When that transistor is "off" the voltage rises to the input voltage of 10V, when the transistor is
"on" it drops to the difference between the voltage on the low side collector and the battery
minus connection. Again its in the neighborhood of .75V. In the chart I've shown the sink
voltage drop in red and the source voltage drop in green.

Test #3 : Thermal Constants for the TIP107 and TIP102

Purpose: The purpose of this test was to ascertain what the current capacity for the bridge will
be when it does not have heat sinks on the transistors. This value will vary with ambient
conditions but this test attempts to establish a baseline which will help us decide if we must put
heat sinks on the transistors in general or only in special cases.

Description: The half bridge is set up with a variable power supply


attached to the "Battery Positive" and "Battery Negative" test
points. A resistor is connected between the sink resistor and
"Battery Positive" which will provide a regulated load. The
transistor was instrumented with a type K thermocouple that was
attached to my Fluke meter. The transistor with the thermocouple
attached is shown in the picture to the right. I took great care to put
an insulator between the transistor tab and the bolt to prevent the
bolt from becoming part of the thermal mass being measured.

Under three loads, 10mA, 100mA, and 1000mA, the temperature is


measured until it stabilizes. Note that for both the 100mA and 1000mA tests the voltage is
constantly adjusted to keep the current level the same. This is because BJT transistors have a
'negative' temperature coefficient, when they get hotter they conduct more current. This can lead
to thermal runaway if the supply and load can conduct higher currents. In addition to the
temperature measurements, the voltage drop is measured across the transistor.

The power being dissipated by the transistor will be equal to the current multiplied by the Vce
voltage. The Rtheta(ca) value (case to ambient) will be the difference in temperature (from the
initial reading) divided by the dissipation in watts giving a value in °C/Watt.

Initially I used a non-contact thermometer to measure the temperature of the transistor. I have
the IR-101 from La Crosse Technology. This can measure either Centigrade or Fahrenheit and
also maintains min/max measurements. The challenge was reading the transistor and not the
resistor (which gets really hot), and the emissivity of the transistor tab doesn't give good readings
(accurate to 2.5 degrees).
Test Results: Initial measurements put the TO-220 case at 20.1 °C, The temperature measured
at each current level is recorded in the table below. The value for Rtheta(ja) is computed for each
measurement point.

Voltage Power Measured Computed


Current Drop Dissipation Temperature Rtheta(ja)

0 mA N/A N/A 20.1 °C N/A

10 mA 0,576 V .006 W 20.8 °C (+ 0.7 °C) 116.7 °C/W

100 mA 0.637 V .064 W 27.6 °C (+ 7.5 °C) 117.2 °C/W

1000 mA 0.717 V .717 W 67.7 °C (+ 47.6 °C) 66.4 °C/W

The interesting thing to me was that the temperature coefficient got a lot smaller when the
current was greater. The data sheet for the TO-220 specs a value of 62 °C/W which is pretty
close to the last measurement. When I thought about it I realized that this effect stems from the
"thermal resistance" of the ambient air. The energy transfer is proportional to the difference in
temperature, as the temperature difference goes up, more heat is pushed "into" the air more
quickly. Further, a convection current is established as the air next to the transistor heats up and
rises allowing cooler air to replace it. By blowing on the transistor I could easily bring the
temperature down to 60 °C.

Static Tests Summary

The transistors have a voltage drop that is between .7 and 1V under load. Its "between" these
numbers because as the current through the transistor increases so does the voltage drop. Given
that the torque output of a motor is proportional to its current, we must insure that the voltage the
motor "sees" will be sufficient to get the maximum torque. Referring to the Mabuchi RS-
280RA/SA data sheet, we see that the 7.2V model (RS-280RA-2485) delivers maximum torque
(220g*cm) at 6.6Amps of current when it is stalled. To get this much current requires a full 7.2V
of voltage potential so the motor, so allowing for 2V of voltage drop means the input batteries
should probably be 9.6V NiCd's. However, the nominal power this motor consumes is 1.18A
when pushing 33.3 g·cm of torque (at 14,300 RPM). If you've geared this down 10:1 your
looking at 333 g·cm of torque at 1430 RPM. A "fast" robot can move at 10'/second so to travel at
1430 RPM that is 24 revolutions per second, and to cover 120" each revolution would have to
move the robot 5". Dividing 5 by π gives a diameter of 1.6" (or a radius of 2 cm). So torque
delivered by the motor to the rim of a wheel 4cm in diameter behind a 10:1 gearbox will be
about 150 gm. Two of these motors would provide 300gm of torque to the ground while cruising.
Startup torque (to accelerate from a dead stop) 1.1Kg per wheel or 2.2Kg for two wheels.
Basically enough to accelerate a 3Kg Sumo robot at nearly 1G if the traction held.
The bottom line is that for a robot that weighs 5 to 16 lbs (2 - 8 Kg) a pair of these bridges
driving a pair of the Mabuchi motors with 10:1 gearboxes would make for a pretty peppy robot.
The closer you got to an 8Kg robot the more likely you would need to add heatsinks to the bridge
(more often pulling more than 1.5A) and for robots of 2 or 3 Kg the bridge as is will be fine.

Dynamic Tests
In order to investigate how this bridge responds
when it is driving an inductive load, a slight
change was made. The modification consists of
adding two fast recovery silicon rectifiers. I've
used a pair of 1N4936 diodes which are a bit of
overkill with a 400V reverse voltage limit but they
are inexpensive. Further, having a better margin
for error is always good. The updated schematic is
shown to the right. You will recall these diodes are
shown as "optional" in the full H-bridge circuit.
The newly added diodes are installed in place of
the sink transistor in the lower left of the bridge
and the source transistor in the upper right area.

The two transistors are sporting light blue diode


symbols to remind you that the TIP 102 and TIP
107 transistors have a built in freewheeling
diode. If you re-arrange the circuit it would like
like the schematic shown on the left.

With The test circuit I still can't reverse the motor's


direction, but I can change its speed. As the h-
bridge circuit is symmetric, I can use this circuit to
study the behavior of the bridge when it is driving
a motor with a DC signal and a PWM signal.

To generate control signals for the dynamic tests


I've used a test pattern generator. My "test pattern
generator" in this case is a Parallax Basic Stamp II
that is running The following simple program:

'{STAMP BS2}
'
' A Simple Test Program to run my test bench setup
'
DIRA = 3 ' Set up pins 0 and 1 as outputs
OUTA = 0 ' Initial state, transistors off.
Loop:
OUTA = StateA ' Transistor state set to "A"
PULSOUT 2,100 ' A finer grain delay than PAUSE
OUTA = StateB ' Transistor state set to "B"
PULSOUT 2,100 ' A finer grain delay than PAUSE
GOTO Loop
END

When pin P0 on the BS2 is set to be an output and "high" (logic 1 level) it puts 5V on the P0
input of our test circuit. This causes the opto-isolator's LED to illuminate and that causes the
transistor to turn "on." The opto-isolator's transistor connects the base of the TIP107 transistor to
ground and that turns that transistor on. Similarly when P1 is made "1" by the BS2, it turns on
the sink transistor using a similar mechanism. As you can see in the program the transistors are
changed from state "A" to state "B" and back again, but neither "A" nor "B" are specified. That is
because there are many ways you might want to drive your bridge.

There are two primary ways of driving an H-bridge, one is called "sign magnitude" and "locked
anti-phase." A good description of the difference can be found on Larry Barrello's site (see the
motion control pages). I tend to use sign-magnitude as it does not depend on specific timing
relationships between the source and sink transistors. Specifically, transistors do not turn on and
off at the same speed. The locked anti-phase technique of motor control requires that the bridge
switch directions "instantly" so that there isn't an opportunity for both the source and sink
transistors of the same side of the bridge, being active at the same time. Bridges that support
locked anti-phase will have logic inside the bridge to specifically delay the turn on of the sink
our source to match the turn off time of that element's counterpart.

Test #1 : Contributions of Resistance and Inductance

Purpose: A permanent magnet DC motor can be modeled by three components in series;, a


resistor, an inductor, and a voltage source. Resistance is due to the wire resistance of the motor's
windings, inductance is due to the geometry of those windings, and the voltage source arises
from the interaction between the permanent magnets in the motor and the windings. The purpose
of this test was to look at the waveform of the voltage across the motor when the bridge was
operating and to determine how each of these three components contribute to that waveform.

Description: An oscilloscope is set up to take a differential measurement between TP2 and TP3.
This is accomplished by hooking channel 1 to TP2, channel 2 to TP3 and then using the "add"
and "invert" buttons to create a composite output. The result can be expressed mathematically as
"CH1 + (- CH2)." As they are both measuring a waveform with respect too a common ground,
any difference in the two waveforms will show up in the composite waveform. Three sub-tests
tests are run, one with a resistor connected between TP2 and TP3, one with an inductor
connected between TP2 and TP3, and one with a motor connected between TP2 and TP3. Each
test generated a waveform and each waveform is photographed and recorded. The Basic Stamp II
is connected to P0 and P1 and the test program is run. StateA was set to 3 (both transistors on)
and StateB was set to 0 (both transistors off).

Test Results: The results of this test were fairly interesting to me, they gave me a good picture
of what the components of the waveform observed were.
The first sub-test used a resistor. The results were photographed and are shown in
the scope trace to the right. There isn't a whole lot of surprise here, the output is an
amplified version of the square wave that the BS2 is generating. The scope was set to
10V per division so the resulting square wave is 10V peak to peak. The bottom trace
is an expanded view of the upper trace.
Resistor

The second sub-test used an inductor. The photograph of those results is shown on
the right. Again the scope is set to a resolution of 10V per division, but this time when
the transistors turn off there is a -10V "spike". There are two things about the spike
that are interesting, the first is that it is nearly exactly -10V, and the second is that it
is quite short. More about that in a bit.
Inductor

The final sub-test used a permanent magnet DC motor. Again the results are in the
photograph to the right. This one has the square wave from the resistor, the spike
from the inductor, and now a moderately curving up tick to 5V and periodic glitches
to 10V (not visible in this image sorry.)
Motor

I've re-drawn the final waveform and annotated the results, they are shown below.

Starting from the left of the waveform and moving to the right. The voltage across the motor
jumps to 10V when the two transistors are switched "on." This part of the wave form comes from
the resistive nature of the motor, if it were a perfect conductor then the voltage drop across the
motor would be zero according to Ohm's law. Then when they are switched "off" the voltage
makes an apparent reversal (more on this after test #2) and the voltage stays at -10V for a short
period of time while the current in the motor's windings decays. This component is contributed
by the inductance of the motor as it matches exactly the waveform of the inductor only subtest.
Finally the motor returns to zero but then continues to 5V. This is the contribution of the
"generator effect" or back EMF voltage of the motor. Because the motor has mass and it is still
spinning, its inertia causes it to continue to rotate. This rotation moves the windings past the
permanent magnets and the motor becomes a generator.

The interesting thing for me was the spikes in the EMF component. After thinking about it for a
while I realized that a permanent magnet DC motor has brushes that reverse the polarity of the
windings when the stator is turning. When those brushes switch, they disconnect the motor
winding resulting in an inductive spike as well. That spike can be controlled (but not eliminated)
by putting a capacitor across the motor terminals.

Test #2 : Which to switch, High, Low, or Both

Purpose: One of the arguments that you hear in robot groups and on line is how sign magnitude
PWM should be implemented. Specifically, should you switch both the high side and low side
transistors? Or just the high side? or just the low side? The argument goes that switching the high
side eliminates spikes or switching them both increases efficiency, and on and on. This test was
designed to try all three options (high, low, and both) and to analyze the results.

Description: An oscilloscope is set up to take a differential measurement between TP2 and TP3.
This is accomplished by hooking channel 1 to TP2, channel 2 to TP3 and then using the "add"
and "invert" buttons to create a composite output. The result can be expressed mathematically as
"CH1 + (- CH2)." As they are both measuring a waveform with respect too a common ground,
any difference in the two waveforms will show up in the composite waveform. Three sub-tests
tests are run; One by switching off both transistors, one by switching off the sink (low) transistor,
and one by switching off the source (high) transistor. Each test generated a waveform and each
waveform is photographed and recorded. The Basic Stamp II is connected to P0 and P1 and the
test program is run. The following values are used for variable StateA and StateB.

Sub-test StateA StateB

Both Transistors switched 0x03 0x00

Sink Transistor (low side) switched 0x03 0x02

Source Transistor (high side) switched 0x03 0x01

Test Results: The results are collected in the table below.

Resistor Inductor Motor Description


This is the series of tests where I switch both
the source and the sink transistor at the same
time. The interesting thing to note is the
larger spike when the bridge is switched "off"

This is the series of tests where I switched off


the "sink" transistor only. This leaves the
source transistor on during the entire time. In
these sequences you can see the inductive
kick from the inductor is apparently
"missing" (it isn't however...)

As it turned out the last two sub-tests produced identical results so only one set of results is not
shown. It was interesting to me that there were only two unique results out of three possible tests.
To understand that I needed to understand what was going on with the motor inductance.

Remember in test #1 above where the voltage across the inductor appears to go negative? Well
how could that be given that an inductor resists a change in current? The answer is that it isn't
actually negative. Remember that the scope probes are measuring the voltage across the inductor,
when there is a current flowing in the inductor a magnetic field develops around it (this is its way
of storing energy). When the current stops because a switch is thrown open, the collapsing
magnetic field of the inductor continues to push current through. But a current, is really just
charge in motion. The charge in question has no where to go. So that charge "builds up" on the
end of the inductor. And because voltage is simply the difference in charge, the voltage potential
between the ends the inductor begins to rise. Its important to note that the charge came from the
other end of the inductor, so this voltage potential is really relative to that end. The relationship
between the voltage rise relative to the other end of the inductor means that some path needs to
be found to return those electrons to the other side. If you somehow managed to eject the motor
the dielectric constant of the air would break down as the voltage potential rose and you would
get an arc as a circuit was created with ionized air to the other terminal! Fortunately, the h-
bridge has other paths.

When both transistors are switched off, the voltage rises until it begins to be higher than than the
battery voltage. At that point there is a circuit path backwards through the battery to the other
end of the inductor. This, in effect, dumps charge back into the battery. (not a lot, just the amount
of charge stored as flux in the magnetic field of the inductor).

When only one transistor is switched off the story is completely different. Now as the potential
rises it eventually passes the forward voltage of the 1N4963 free wheeling diode. At that point it
sees the "conducting" transistor on the other side of the bridge, Once it is higher than that
transistor's voltage drop the rest can simply pass through to the other end of the inductor. That
wave form looks like the one below.
Now instead of seeing "-10V" the inductor sees something like -1.5 volts. Why not zero volts?
Because the current is traveling through the freewheeling diode and the transistor that is still on,
consequently there are two voltage drops between it and the other end of the inductor. When
summed together those drops add up to about 1.5 volts.

Now I can draw a picture of the test circuit and all the various current paths. This is shown in the
schematic below. The blue dashed line represents the current flow before the PWM wave form is
switched "off." The red dashed lines represent the path of the decay current out of the inductor
depending on which option you use for switching off the transistors.
One of the members of the HBRC asked, "But if you switch just one transistor, isn't the other one
shorting the motor and causing it to brake?" This is an excellent question and one that I might
have answered incorrectly had I not been through this analysis.

When you short a rotating motor the voltage that the motor is generating is opposite to the
voltage that you would need to turn the motor the other way (hence the term 'back' EMF). If you
look at the scope traces and refer to the schematic above, you will note that for our test cases the
back EMF is "positive" with respect to our measuring probes. That means that the voltage
generated creates a higher potential on the left terminal of the motor than the right terminal. If
you create a connection between the left and right terminal of the motor, the current will flow
from the left terminal, into the right terminal and try to drive the motor in the other direction.
(Just as if we had switched the bridge the other way) But this current in our circuit is impeded by
the freewheeling diode on the right terminal that is reverse biased relative to that voltage. Hence,
no braking action occurs. If on the other hand you turn on the upper right transistor while the
upper left transistor is on, there is nothing to impede the flow and the motor slows down rapidly.

Layout Considerations
Generally this circuit is fairly free of layout restrictions, however there are some things that you
can do to make your life easier. A sample layout is shown below.

One of the things to note is that the transistors are arranged "back to back" with their tabs facing
each other. In my layout I have spaced them 3/8" apart which allows me to put a piece of 1" x
3/8" x copper bar stock down the middle and with #4-40 machine bolts to secure it. A 1 - 1/2"
piece of this stock weighs about 3 oz. This basically doubles to current capacity of the bridge,
and if you then bolt the copper bar to a metal enclosure you can triple the capacity to a full 6
amps continuous duty. Further, the two left transistors are the "upper" source transistors and the
two right transistors are the lower "sink" transistors. That means that any thermal solution will
have heat being injected from diagonal corners which further maximizes the benefit by spreading
out the heat injection. The point here is to think about whether or not you are going to put heat
sinks on the transistors and lay them out accordingly.

If you decide you would actually like to build a few PCBs for your club or for a class or
something, there is a ZIP file available that has everything you need to order them from
APCircuits. As of this writing (December '03) it will cost you about $100 to have 14 boards
made up (there is a $66 dollar "hit" just to set up the board, then each board is $2.44 after that.
However, 14 boards for $100 is about $7 each net so you're looking at about a $12 per bridge
cost). The layout in the zip file is very slightly different than the first run, I added more room for
the over-voltage snubber and added a place to put a .01uf capacitor across the motor leads (cuts
down on brush noise).

Alternatively you can build this bridge on a piece of perfboard and just solder it together. Be sure
and use at least 18 ga wire on the legs of the transistors.

Microprocessor Control
To use this h-bridge with a microprocessor, you must connect the three control lines to output
pins on the microprocessor. Using the BasicStamp II as an example, consider the following
hookup diagram.
As you can see three pins from the Basic Stamp are connected to each H-bridge board. In this
example they are P0, P1, and P2 to the board controlling the left motor and P4, P5, and P6 to the
board controlling the right motor. One of the advantages of using three pins that are both right
next to each other, and in the same group of four bits (called nybbles) is that you can use a single
variable (one of OUTA, OUTB, OUTC, or OUTD) to write to four pins at once.

This is really only important on chips like the BASIC Stamp where their can be a millisecond or
more between the execution of one instruction and the next. By connecting them this way you
can cause both motors to start turning with a single instruction such as this assignment:

OUTL = $33

Whereas if you did two instructions :

OUTA = $03
OUTB = $03

You would find that the left motor started turning first, then the right motor. So on a robot that
steered with two motors the motor would make a slight turn to the right, then go straight. If you
turned them off in the same sequence you would find that the robot corrected its heading back to
the original heading but would not have traveled "straight" ahead. For systems that use gear
motors such as the 12V Brevel motors or the Globe motors, this won't be a noticeable problem,
but higher performance motors will definitely suffer.

Alternatively you could use something like my ServoGizmo project to drive one or two of these
boards. The AntWeight ESC code could be easily modified to drive this bridge circuit rather than
the 754410, however you could even drive two of these at the same time with some additional
code. When the 754410 is not mounted on the Gizmo board you get 6 outputs from the PIC. If I
have time I'll write a dual motor control with serial input so that you could connect the Gizmo to
just one pin of the BASIC stamp and send it serial commands to control two motors.

The easiest way to use PWM on the motor is to start with the direction and enable bits "high" or
at a logic 1 value. This turns on the high side (source) transistor and leaves the sink side
transistor off. You can then send "low" pulses out the ENA* line to turn the motor on and off.
This would allow you to use a single 'PWM' output, such as the one that is available on the
PIC16F628, to control the PWM duty cycle in hardware while the PIC managed other aspects of
controlling the motor. The most common use would be to provide encoder feedback into the PIC
that would allow a simple PID algorithm to be implemented. With two bits of encoder input,
three bits of motor control, and two bits for serial I/O the 16F628 would be well engaged.

Summary
The previous pages have gone through the design of simple H-bridge using bipolar junction
transistors. If you read through this tutorial and build the H-bridge, you will be able to use this
information in many future robots. The H-bridge that is presented is well suited to a wide variety
of hobby motors and because you should understand it completely, it should be easily repaired
should something fail. The next step in building H-bridges is to build them out of MOSFETs.
This is a rather more complicated endeavor and the topic of the next section in the H-bridge
Theory and Practice tutorial.

Vous aimerez peut-être aussi