| 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:
saqib053
on:
29 Jul 2010 |
Re: 5A H-Bridge motor controllers |
|
 |
@ Poncho Magilakutti but our project includes controlling through h-bridge circuit. so i think it should control servo motor. and please if you could refer some dc servo motor models which could b found easily. motor should be 12v or 24 v. can u give some suggestions please
|
|
|
|
 |
Posted
by:
poncho magilakutti
on:
29 Jul 2010 |
Re: 5A H-Bridge motor controllers |
|
 |
Quoting saqib053: hi brother,my name is saqib. we are building a final year project named twin rotor system. for that we are using servo motors. we have to control them so the circuit u mentioned can control the servo motors? and also if u could let me know some cheap servo motors smaller in size and easily available. hope u gona corporate. |
Well, normal hobby servos like these http://www.hobbypartz.com/servos.html have control boards inside them that use a PWM input signal from a microcontroller to dictate how much power should be fed to the servo. A pot is used to provide feedback so you can control the servo with a fair amount of precision. If you are using one of these servos, you do not need a controller like this, you only need a PWM input signal from a microcontroller, and power supply, and ground.
|
|
|
|
 |
Posted
by:
saqib053
on:
29 Jul 2010 |
5A H-Bridge motor controllers |
|
 |
hi brother,my name is saqib. we are building a final year project named twin rotor system. for that we are using servo motors. we have to control them so the circuit u mentioned can control the servo motors? and also if u could let me know some cheap servo motors smaller in size and easily available. hope u gona corporate.
|
|
|
|
Posted
by:
otaromece
on:
11 Jul 2010 |
5A H-Bridge motor controllers |
|
 |
good day. i am planning to use the 5A h-bridge motor controller on my project. but i don't know how to interface the h-bridge via parallel port and what programing code should be use. thanks
|
|
|
|
Posted
by:
otaromece
on:
11 Jul 2010 |
Re: 5A H-Bridge motor controllers |
|
 |
good day master.. i am planning to use the 5a h-bridge motor control on my project.. my question is that is it possible for me to interface the h-bridge via parallel port instead of using micro-controller? if possible can you teach me how????
|
|
|
|
Posted
by:
otaromece
on:
11 Jul 2010 |
5A H-Bridge motor controllers |
|
 |
hello to all., i am new here in ikalogic. i have a school project to do and im planning to use the 5a hbridge motor driver because it is practical and easy to construct. so my question is., is it possible if i interface the h bridge via parallel port instead of using a micro-controller. if its possible can somebody teach me how??? hoping for kind consideration. thanks a lot masters
|
|
|
|
Posted
by:
ikalogic
on:
28 Jun 2010 |
Re: 5A H-Bridge motor controllers |
|
 |
Quoting heraldo: One more question: the TIPs 122 and 127 already have a protecting diode from collector to emitter (see the datasheet); why did you put another external diode in parallel ?
(I intend not to use these extra diodes, unless you give me a good reason) |
Just extra protection. the first thing that will let you down in such a system are the freewheel diodes.
|
|
|
|
Posted
by:
heraldo
on:
28 Jun 2010 |
Re: 5A H-Bridge motor controllers |
|
 |
One more question: the TIPs 122 and 127 already have a protecting diode from collector to emitter (see the datasheet); why did you put another external diode in parallel ?
(I intend not to use these extra diodes, unless you give me a good reason)
|
|
|
|
 |
Posted
by:
heraldo
on:
28 Jun 2010 |
Re: 5A H-Bridge motor controllers |
|
 |
First of all I want to thank you for sharing this very smart and useful 5A H-Bridge project.
Right now I am trying to build it in a protoboard, using the simplified digital logic suggested by Chapo (I've checked and confirmed that Chapo's smaller digital circuit is actually equivalent to the original one).
However, in my case the PWM control signals will be generated by a PIC microcontroler whose power is supplied by a laptop computer USB interface.
In order to protect the laptop from eventual switching transients, I intend to isolate the +5VDC power supply that feeds the digital ICs from the +12VDC power supply that feeds the motor and the TIPs.
My idea is to replace transistor Q1, Q2, Q3 and Q4 by 4N25 optoisolators.
It seems to me that all the rest of the circuit can remain just the same, including all resistor values, since the 4N25 optoisolator works fine with the 10 mA input current set up by the 470 ohm resistor and its npn output can easily drive the 1.5 mA set up by the 820 ohm resistor to saturate the TIPS (the 4N25 can drive up to 150 mA collector current).
Do you see any problem in this idea ? Any suggestion ?
|
|
|
|
 |
Posted
by:
chapo
on:
03 Jun 2010 |
Re: 5A H-Bridge motor controllers |
|
 |
Well, I've redone the logic stage of your circuit .. Same inputs, same outputs, but cheaper (since there is no need to buy a quad NOR gate IC), maybe this one will be more efficient (not that much I know) cause one chip is saved, and equilibrated (speaking of propagation delays)..
what do you think?
|
|
|
|
You have
to be a member to post replies. |
|
|
|