H-Bridge on a Breadboard

312,266

213

64

Introduction: H-Bridge on a Breadboard

The H-Bridge is a circuit which can drive a motor in forward and reverse. It can be a very simple circuit that requires only a handful of components to build. This Instructable demonstrates how to breadboard a basic H-Bridge. Upon completion you should be familiar with the basic operation of an H-Bridge and be ready to move on to more complicated versions that can support larger, more powerful motors.

Step 1: Gathering the Parts



Only a handful of parts are needed.

1) A bread board
2) A small DC motor capable of operating at ~7 volts
3) A 9-volt battery and battery snap
4) Four small signal NPN transistors. We're using the 2N2222A here. 2N3904 is another common part number and thousands of others will do.
5) Four 22k ohm resitors
6) Two push button switches
7) Jumpers or spare wire to hook everything up

Step 2: H-Bridge Theory


The H-Bridge is a circuit which can drive a DC motor in forward and reverse. The motor direction is changed by switching the polarity of the voltage in order to turn the motor one way or the other. This is easily demonstrated by applying a 9-volt battery to the leads of a small motor and then switching the terminals to change directions. The H-Bridge is given it's name based on the basic circuit which demonstrates it's operation.

The circuit consists of four switches which complete the circuit when applied in pairs. When switches S1 and S4 are closed the motor gets power and spins. When S2 and S3 are closed the motor gets power and spins in the other direction. Note that S1 and S2 or S3 and S4 should never be closed together in order to avoid a short circuit.

Obviously physical switches are impractical since no one is going sit there flipping switches in pairs to get their robot to move forward or in reverse. That's where the transistors comes in.

A transistor acts as a solid state switch that closes when a small current is applied to it's base. Because only a small current is required to activate a transistor we are able to complete one half of the circuit with a single signal.

That's enough theory to get started so let's start building.

Step 3: Powering the H-Bridge


We'll start by laying out the power lines. Connect your battery snap to one corner of the power bus. The convention is to connect the positive voltage to the upper row and the negative to the bottom row to denote the HIGH and LOW signals respectively. We then connect the top and bottom sets of power buses.

Step 4: The Transistor As a Switch


The next step is to set up the transistors. Recall in the theory section that we need four switches to build an H-Bridge, so we'll be using all four transistors here. We're also limited to the layout of a breadboard so the actual circuit will not resemble the letter H.

Let's take a quick look at a transistor to understand the current flow. There are three legs on each transistor known as the collector, base, and emitter. Not all transistors share the same order so be sure to consult a datasheet if you're not using one of the part numbers mentioned in step one.

When a small current is applied to the base, another larger current is allowed to flow from collector to emitter. That's important so I'll say it again. A transistor allows a small current to control a larger current. In this case the emitter should always be connected to ground. Note that the current flow is represented by a small arrow in the figure below.

Step 5: Switching Polarities


Now we're going to line up the transistors on the bottom half of the breadboard, flipping the orientation for every other transistor. Each pair of adjacent transistors will serve as one half of the H-Bridge. An adequate space needs to be left in the middle in order to fit some jumpers and eventually the motor leads.

Next we'll connect the transistors' collector and emitter to the positive and negative power buses respectively. Lastly we'll add the jumpers which will connect to the motor leads.

The transistors are now ready to pass a current when the base is activated.

Step 6: Applying a Signal



We need to apply a small current to each of the transistors in pairs. First we need to hook up a resistor to each transistor's base.

Next we'll connect each set of resistors to a common point in preparation to connect a switch.

Then we'll add the two switches which also connect to the positive bus. These switches will activate one half of the H-Bridge at a time.

And finally we hook up the motor. That's it. Connect your battery and test your circuit. The motor should spin one direction when one button is pushed and the opposite direction when the other button is pushed. The two buttons should not be activated at the same time.

Step 7: Getting a Clear Picture


Here's a diagram of the complete circuit in case you want to save it for reference. The original graphics are courtesy of Oomlout.

Step 8: More Power to Ya



Okay, so you have a shiny new H-Bridge on a breadboard. Now what? The important thing is that you understand how a basic H-Bridge works and that the essentials are the same no matter how much power you're pushing. Here are a few tips to take it a step further in order to support larger motors and more power.

- You can use Pulse Width Modulation (PWM) in place of the two switches to control the speed of the motor. This is easy when you have a microcontroller at your disposal and can also be accomplished with a 555 or 556 timer IC and a few passives without too much trouble.

- The key to supporting higher power motors is higher power transistors. Medium power transistors and Power MOSFETs in TO-220 cases can handle significantly more power than the low power TO-92 transistors we're using here. Proper heatsinks will also increase the capacity.

- Most H-Bridges are built using both NPN and PNP transistors in order to prevent short circuits and optimize current flow. We used only NPN here to simplify the circuit.

- Flyback diodes are usually used in higher power H-Bridges to protect the rest of the circuit from dangerous voltages that are produced by the motor's coils when the power is disconected. These diodes are applied across the transistor in the direction of current flow and resist these harmful EMF back voltages.

- The TIP 102 and TIP 107 are a pair of complementary power transistors that have built in flyback diodes. The TIP 122/127 and 142/147 are similar pairs of power transistors.



That should be enough to put you in the right direction if you want to keep you going.

4 People Made This Project!

Recommendations

  • For the Home Contest

    For the Home Contest
  • Make It Bridge

    Make It Bridge
  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge

64 Comments

0
manallomichaeljoshua
manallomichaeljoshua

Question 1 year ago

Sir i thought only npn and pnp transistor is used in h bridges not all npn

0
cce_man
cce_man

Question 3 years ago

If i were to put a RPi or Aduino GPIO pin into the PWM part, would it run properly (assuming i didnt change anything)

0
AlanH2
AlanH2

8 years ago on Introduction

Dose this work with MOSFET's as well.. I am doing this project for uni which involves constrcting a H-Bridges.. but it specfies using MOSFETS. not NPN transistors.

Can you use the same design for MOSFET's

0
DerpS
DerpS

Reply 7 years ago on Introduction

Yes, you can. MOSFETs are simply transistors that can handle higher power. When powering higher power motors, MOSFETs are the usual choice.

0
JamieJ22
JamieJ22

Question 3 years ago on Step 4

I don't understand how the top transistors in the H switch on. I'm trying to understand the calculations that are needed to make this circuit work. I've tried reading various tutorials but it's not clicked yet.

0
Tanmay Deuskar
Tanmay Deuskar

6 years ago

Hello,

Really nice project!! But can I use BC-547 transistors instead, and what is the use of the 22 k resistor?

Thanks

0
karthick.ashwath
karthick.ashwath

Reply 5 years ago

Its used to ensure that only a specific current goes to the base when a signal is given to it.

0
IsmailJ6
IsmailJ6

6 years ago

hi,

i need circuit diagram of this circuit pls help

0
BiswajitN4
BiswajitN4

6 years ago

Hi,


I have receiver of rc car, but i don t have Transmitter remote. How to make of this?
How to make dual H- Bridge RX -2 Transmitter?
Can you send the diagram of the remote?
Thanks
Biswajit

IMG_8351.JPGIMG_8352.JPGIMG_8355.JPG
0
prws
prws

7 years ago

Sorry if this is a naive question - I'm just starting :) - but could you make do with just 2 resistors in the base circuit by putting them before the switches?

0
AnirudhA9
AnirudhA9

7 years ago

I have a question. How do I replace those switches with an impusle from arduino/beaglebone to allow current to flow through? What I want to do is if the micrcontroller says '1' one set of transistors get activated and allow the flow of current to spin the motor. I hope I dont sound stupid if this problem is very easy

0
gzip
gzip

Reply 7 years ago

The diagram in step 7 shows two dark blue dots where you would connect. Basically the same place as the switch output.

0
ProBodger
ProBodger

11 years ago on Introduction

great instructable, I first had some problems with only one button working however, this proved to be a dodgy transistor. It now works great, I made a copy of this on stripboard, really easy to do. Here are some photos:

H bridge on stripboard.JPGUnderside of H bridge on strip board.JPG
0
kaisi
kaisi

Reply 7 years ago on Introduction

can you provide circuit diagram and the motor part number and specification thanks

0
gzip
gzip

Reply 11 years ago on Introduction

Cool, thanks for sharing your photos.

0
RoyL4
RoyL4

7 years ago on Introduction

Hi all,

I have just built this using the same parts apart from my transistors are 8c547c and an unknown motor from a DVD drive (I assume 5v). The motor runs if I connect direct to the 9v battery but the motor won't run inline with the circuit. I have checked the output from the I get the following:

Battery = 8.07vDC - 50mA

Power leaving circuit to motor = 7.43vDC - 3.4mA!!!!

I then changed the resistors to 10K and get 2.0mA!!!

How am I losing so many Amps?

0
gsandhu2
gsandhu2

8 years ago on Introduction

I’m working on a project which is about making a rescue
robot . I have struggling with it for 4 months and now all the mechanical works
had been done . but I’m facing difficulty in make the robot to work with rf
module can u plzz help me…

I want make transmitter and receiver that can control the
motion…I mean that receiver should have control 8 dc gear motor and each dc
motor should have a forward and backward botton to control the motion ……can u
kindly help me with this project ….if u can make the circuit board diagram for
the PCB ….or any other suggestion plz reply……mail me at “sunny1995gagan@gmail.com”

0
DerpS
DerpS

Reply 7 years ago on Introduction

Build one of these circuits for each of your motors, and connect all the bases of the transistor to a microcontroller. Then write a program on the microcontroller that takes the signal output from the reciever and then closes the transistors required to make the motor spin. For example, if you were getting a 50% PWM signal from channel 1 of your reciever, then the microcontroller would output a HIGH value to one of the transistors going from ground to motor 1, and output a 50% PWM signal to one of the transistors going from your power supply to motor 1.