| Build
a 5A H-Bridge motor driver!
Using cheap
TIP127 and TIP122 transistors
Small & high efficiency home-made solution!
By
Ibrahim Kamal
Last update:
5/6/08
Overview
In this article, I am going to show you how to build a relatively
High power H-bridge motor controller (which is the most common
way to control DC motors) With cheap TIP transistors..
My goals were:
1-To build a small module, that can be added to any robot
or any system where motor control is required.
2- To build a high efficiency device with a relatively high
continuous current rating. 5 Amperes
of continuous current through an H-bridge module may not seen
"high power" to some
of you, depending on your field and experience,
That's why i used the word "relatively".
But in the field of hobby electronics and robotics,
yes a controller capable of controlling motors with currents
as high as 5A at 24V is considered a high power device.
|
|
Key Features:
5A Continuous current, 8A peak
High performance cooling system
Protection Circuit included
Compact
Design
Unexpensive components |
This article will be splitted in two main parts The
Theory and the Hardware construction
The
H-Bridge & DC Motors..
The
H-Bridge is principally a configuration of 4 switches, that are
switched in a specific manner to control the direction the
of the current through the motor. (For brushed DC motors,
the direction of rotation of the armature of the motor is changed
by changing the direction of the current flowing though it). While
we are talking about DC motors, here is a small useful note to bear
in mind: "Current flowing though a motor is proportional
to the output torque, while the angular velocity (rpm) of the the
output shaft is proportional to the the voltage across the motor
windings"
Below is a simplified diagram showing the operation of the H-Bridge
configuration.
(you
can notice the shape of the schematic, it looks like an
'H' letter.. this is how this famous circuit got this name!)
There are 2 possible paths for the current:
1- The red path,
where the the current is directed to the motor through the
switches S3 and S2, causing
the motor to turn clockwise
2- The green path,
where the current is directed to the motor through the switches
S1 and S4, causing the
motor to turn anti-clockwise.
The only difference between this simple H-Bridge and the
real H-bridge module explained on this page, is that the
switches are replaced by Transistors, in order to electronically
control the flow of current in the motor, Hence, allowing
us to |
 |
control the speed and direction of the motor from
a microcontroller, for example.
In case you are a beginner or just not familiar with transistors,
I am going to explain in the next section most of what you need
to know about transistors to understand and build an H-Bridge.
Introduction
to switching transistors:
One very simple way to use transistors is to use them as switches,
to electronically control the flow of current though other electrical
elements. The same transistor may be used as a signal amplifier,
but this is the messy part of the transistor studies, and we don't
need this for our H-bridge. Using transistors as a switch is also
called "using transistors in saturation and cut-off
mode".
This schematic below simply shows the meaning of using a transistor
as a switch. the only difference between a mechanical switch and
a transistor switch is that a normal switch is turned ON or OFF
mechanically while a transistor switch is turned ON and OFF using
small
electrical currents
applied on the Base,
usually smaller than 20 mA. For
an NPN transistor, when a small current flows into the Base
of the transistor, current will flow from the Collector
to the Emitter,
otherwise, no current will through the CE junction (Collector-Emitter
junction). On the other hand, for a PNP transistor,
when a small current is allowed out from the base of the transistor,
current will flow from the Emitter
to the collector.
In order to use the transistor as a switch, the base voltage
has to be
|
 |
Higher than the Collector voltage (in case of NPN
transistor), or Lower than the collector voltage (in case of PNP
transistor). Also, to ensure the transistor is saturated, you must
calculate the suitable value of Rb shown in the
schematic (this will be discussed in detail later).
You may wonder why are there two different implementations of the
Transistor switch, one with NPN transistor, the
other with a PNP one. the answer is very simple.
it is to ensure that the base voltage is at a suitable level to
ensure the transistor is saturated whether it is connected to ground
or to 12V. (in the H bridge, 2 transistors are connected to 12V,
while the 2 others are connected to Ground.)
Base
Resistor calculations for an NPN transistor:
Calculating the suitable Base resistance for an
NPN transistor is very easily done by following those steps:
1- Depending on the transistor you are using, gather
from the datasheet the following values. sometimes for beginners,
finding those values in the datasheet, or the nearest suitable values,
need some patience!
| VBE |
The voltage
drop between the Base and the Emitter |
| IBmax |
The maximum current that
can flow into the Base without damaging the
transistor (also called Ib Peak in some datasheets) |
| HFE |
The current gain of the
transistor |
2- chose a suitable value for Ibase
but without getting too close the the value of Ib max.
The value of Ib you choose must be enough to drive the transistor
and deliver the required Collector Current: [ Ib
= Ic / HFE ] (where
HFE is the current gain of the transistor).
You can always choose a value of Ib higher than
what you've calculated, it's even better, as long as it is lower
than the Maximum base current specified in the datasheer.
3-Calculate the volt across the resistance Rb.
Assuming you are controlling the device with a Standard CMOS or
TTL compatible device (5v and 0v outputs):
[ Vr = 5 - Vbe ]
4- Now that we know the voltage across the resistance
(Vr), and the current flowing into the Base through
that resistance, we can calculate its value:
[Rb = Vr/Ib]
Or,
[Rb = (5-Vbe)/Ib]
Another approach by John Hewes in this very interesting
article about switching
transistors is to use this formula:
RB = |
Vc × hFE |
where
Vc = the supply voltage of the device driving the base of
the transistor (5v in our TTL example)
(Ic is multiplied by 5 as a safety factor)
|
| |
5 × Ic |
Base
Resistor calculations for a PNP transistor:
Since NPN and PNP transistors react the same way
(except all polarities are inverted), You can choose the same base
resistor for both types. For the H-bridge circuit, you can calculate
the value of the Base Resistors for the NPN transistors and use
the same value for the PNP transistor.
The
applied circuit
This is the electronics circuit of the device you've
seen in the picture at the top the document.
It will be presented to you in 4 main sections, each one shaded
with a different color.
1- The Protection And Logic circuit, shaded in light yellow.
3- The H-Bridge, composed of the 2 TIP122 and 2 TIP127 Transistors,
shaded in light red.
4- The Fan connections and the 'Power on' LED.
Click on any shaded part to jump to the corresponding explanation
in the rest of the document.
Note:
Any
transistor that is not labled in the schematic, is a 2N2222
BJT
The
protection and Logic circuit:
This
section's job is to prevent the controller device from giving destructive
orders to the H-Bridge, like turning ON all 4 transistors at the
same time (this would cause a terrible short circuit, destructing
at least one or 2 of the transistors)
It also has the function of taking the input
from another control circuit (a microcontroller or any control
device that will control the H-Bridge) with a minimum number of
input wires, and, through this simple gate array, control the 4
transistors.
Each one of the 4 end transistor of this stage (Q1, Q2, Q3 and Q4)
have the function of inverting the signal and performing voltage
& current amplification. They provide Active turn OFF
output to control the power transistors of the H bridge.
Active Turn Off, means that when the transistor is OFF, it provides
output through a pull up or pull down resistor, but when turned
ON, they switch off what ever device attached to their output. Active
Turn OFF provide a smaller Turn-OFF time, increasing the H bridge
performance.
Note that NPN transistors like the TIP122 are switched OFF by applying
a 0V on its base, while a PNP transistors like the TIP127 are switched
OFF by applying a High (12v) on its base.
The 4 resistors R2, R4, R5 and R10
must be at least 1/2 W rating in order to sustain high currents
passing through it, especially if you intend to use this H bridge
with a 24V power supply.
In the truth table below, the 3 inputs to the gates (P1,P2
and P3) and their relation with the outputs of 4 end transistors
in the yellow area (Q1,Q2,Q3 and Q4).
Inputs |
Outputs |
Result
on the H-bridge
|
P3 |
P1 |
P2 |
Q1 |
Q2 |
Q3 |
Q4 |
0 |
X |
X |
1 |
1 |
0 |
0 |
Motor
is Freewheeling |
1 |
0 |
0 |
1 |
1 |
1 |
1 |
breaking the motor (0v
at both leads) |
1 |
0 |
1 |
1 |
1 |
0 |
0 |
Turn
the motor clockwise |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
Turn
the motor anti-clockwise |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
breaking the motor (12v
at both leads) |
*(X mean Don't care), 1 = High level Voltage, 0
= Low level voltage.
The Input P3 is the 'Enable' input. Any professional
H-Bridge, have an enable input to turn On or Off the whole motor
controller, and when turned off, the motor should act as if it wasn't
connected to anything (High Impedance). and this exactly what the
pin P3 does in this circuit. This functionality
is mostly used to control the speed of motors using PWM (pulse width
modulation). I am not going to explain what is PWM in this tutorial,
but briefly PWM is a way to control the speed of a DC motor by turning
it ON and OFF very fast, varying the ON time and the OFF time will
affect the speed of the motor.
All the values of the resistors are calculated using the formulas
at the top the document, to ensure all transistor are in saturation
mode, especially the 4 TIP transistors.
The
H-Bridge, composed of the 4 TIP Transistors:
TIP122/TIP127 are power transistors, each one composed
of 2 transistors in series in one integrated package, with a current
gain of 1000 (which is very high for transistors, causing it to
saturate very easily) which makes this transistor very suitable
to be used as a switch or in an H-Bridge configuration.
The Diodes D2 to D5 are very important to protect the Transistors
from the Back E.M.F. voltages produced by any inductive loads when
switched ON or OFF. (DC motors are inductive loads that can cause
important back E.M.F. currents)
Note that the TIP122/127 have integrated protection diodes,
but we added more diodes as a factor of safety.
| J5 is the jack to connect the motor. |
|
The
Fan connections and the 'Power on' LED:
Nothing critical about this part, just a connection
to power the FAN to cool the transistors, and a red LED as a status
to show whether the module is powered or not.
PART
2: Hardware construction |
Now let's see how to construct this H-bridge module.
Note that I'm am not going to show you how to make PCBs, you can
learn this anywhere on the net.
An
overview on The PCBs
As you can see there are 2 boards. One of them is
the PCB which will hold the control circuit with the 4 TIP transistors.
The
other is a heat sink board. actually its a PCB on which i've
printed 2 regions, all in copper. (those copper surfaces will
act a good heat sink when firmly attached to the transistor)
Why Divide the heat sink in 2 regions? simply because the
the back of the transistor that dissipates heat is internally
connected to the collector of the transistor, thus each group
of 2 transistors (TIP122 & TIP127) have to be electrically
isolated from the other 2 transistors.
Below is a view of the TIP122 and TIP127 mounted
|
on the heat
sink board. notice there are still 4 unused holes. those
will be connected to the Fan and to the main board. |
|
Main PCB |
The
assembly
After
the PCB is ready and all components are soldered, plug the
FAN+Heat sink+Transistors in the main board.
If your drilling is accurate, the assembly process should
be very easy.
Notice How the 6 pins connector is firmly soldered to the
wires by the mean of a piece of PCB. This will make a very
rigid connector.
|
|
|
Now you're done with the construction of the H-bridge
module, start testing your H-bridge with constant currents up to
5A, and peak currents of 8A or even more.. i didn't try beyond this
limit!
Download
the zip file for this project
containing the full schematic, PCB designs and datasheets
to all used transistors.
[note: i use ExpressPCB(FREEWARE)
to design the schematics and the PCB]
|
Preview of the last 15
messages discussing this page. Messages are sorted from the newest to
the oldest. |
Posted
by:
kennyquintens
on:
30 Jan 2012 |
5A H-Bridge motor controllers |
|
 |
I've some big issue with this schematic. When i try to make this it wouldn't work properly. I have tried the parts apart and then it works good, but togeter it gives some big problem. My TIP127 becomes very hot. I think some short circuit, but can't figure it out. I have at two of the four endings of the ic's 1V and at the other two 2V is this normal, can somebody give me the correct values of this? At the four outputs of the 7400 and the 7402.
thanks, Kenny.
|
|
|
|
Posted
by:
yawstick
on:
08 Nov 2011 |
5A H-Bridge motor controllers |
|
 |
I've tried to download your zip file and getting errors when I try to open it... seems to be corrupted... nice article otherwise.
|
|
|
|
Posted
by:
junior
on:
22 Apr 2011 |
|
|
Posted
by:
ikalogic
on:
22 Apr 2011 |
Re: 5A H-Bridge motor controllers |
|
 |
Quoting Junior: Hi I'm new in this so i would you ask that the names of the diodes are need for 5A H-Bridge motor controllers and can that works without diodes. Thanks ! |
there MUST be diodes!
any rectifier diodes will do just fine, (but they should have a forward current of 5 to 10 A
|
|
|
|
Posted
by:
junior
on:
22 Apr 2011 |
Re: 5A H-Bridge motor controllers |
|
 |
Hi I'm new in this so i would you ask that the names of the diodes are need for 5A H-Bridge motor controllers and can that works without diodes. Thanks !
|
|
|
|
Posted
by:
gojko_sisa
on:
16 Apr 2011 |
Re: 5A H-Bridge motor controllers |
|
 |
Salam,
I am currently building a Line following robot, and I want to use this H-bridge for the engine control. I have downloaded this PCB schematic, but I I can't figure out what are the inputs P3, P4, P5 for?? I have already found what you previously said on this forum:
[/quote] P4 = 12V / 24V P5 = 5V P6 = Ground [/quote]
Studying this schematic; however, I have found a few issues. In my opinion this inputs should be connected in this way:
P1 - pin 1 P2- pin 4 P3- (+12v) P4-GND P5-PWM input P6-(+5v) p7-(+FAN) P8-(-FAN)
Can you double-check yours schematic ? Thnx
|
|
|
|
 |
Posted
by:
wesleyross
on:
14 Apr 2011 |
Re: 5A H-Bridge motor controllers |
|
 |
I plan to use your circuit to move a 100lb sliding steel door. No micro or pwm. Just 24v. My only concern is driving the TIP's. You mentioned in previous posts, you used 10-25 VDC. Do you see any problem keeping all resistors the same, but using 24vDC? Thanks to all for their insight and knowledge. Schematic attached.
|
|
|
|
Posted
by:
onibnasir
on:
21 Feb 2011 |
Re: 5A H-Bridge motor controllers |
|
 |
Quoting onibnasir: I made the circuit on breadboard but it is not working. I want to ask one thing. We have to take the output from the collector terminals of the TIP transistors? Please respond quickly
i don't understand the question?
also, you say it's not working, what is the problem exactly? |
The problem is that the potential difference that I am getting at the collector is 0.5 to 0.6 V ....
|
|
|
|
Posted
by:
onibnasir
on:
20 Feb 2011 |
5A H-Bridge motor controllers |
|
 |
I made the circuit on breadboard but it is not working. I want to ask one thing. We have to take the output from the collector terminals of the TIP transistors? Please respond quickly
i don't understand the question?
also, you say it's not working, what is the problem exactly?
|
|
|
|
 |
Posted
by:
kenny6
on:
23 Jan 2011 |
5A H-Bridge motor controllers |
|
 |
I have built a h bridge with these tip transistors and controlling them through an Ardunio and i have biased the bases with 330 ohm resistors.This works ok on 6 volts but i cant work out why when i try to run it on 12 volts the transistors start to fry bad immediatly.Yet when i try to biase the bases with 1000 ohm resistors the thing wont even turn on,yet i think the qs get very hot still.I have tied bases together on each side.I am using small mabuchi motors. Im aware that motors resistance influences collector current I have calculated that the ideal resistor i should use is about 2000 ohms.if the motors resistance is about 10 ohms.mabuchi motors at 6 volts divides by full load current gives around this value for motor resistance.(6/.560). My questions are. What motors are you running on your bridge.? Any sugestions to make improvements thanks back again .I am now using motors by solarbotics and have much better results.I believe these motors draw less current than the Mabuchis.I have a couple of ideas to tinker with when i get time.
|
|
|
|
 |
Posted
by:
ikalogic
on:
05 Jan 2011 |
Re: 5A H-Bridge motor controllers |
|
 |
Quoting karookann: I am still thinking of eliminating these two ICs by appropriate code in my MC, as I have plenty of i/o pins available and enough room for code too. So I would like to have your opinion in this regard. Furthermore I want to know the purpose of transisters Q1-Q4. I suspect these are for power or voltage issues but I want your expert opinion.  |
Hello,
Sure, if you have spare I/O pins, then you can get rid of those ICs.
The transistors Q1 to Q4 are very important, because they provide high enough base current for the TIP transistors. the I/O from logic gates or from the µC do not give enough current.
|
|
|
|
You have
to be a member to post replies. |
|
|
|