Connect with us

Need help with H-bridge circuit running printer motor

Discussion in 'Sensors and Actuators' started by michan, Feb 21, 2015.

Scroll to continue with content
  1. michan


    Feb 21, 2015
    Hi there,

    I am new to the electronics world and have just put together an H-bridge circuit complete with two buttons to control a motor i have recently removed from an old printer, however when the circuit is hooked up to the motor, it does not run at all. Im running the circuit from a 5v psu that is able to supply up to 40 amps and when the motor is run directly from this it works fine and only draws 0.25 amps, yet with the circuit connected it does not run at all. I am just wondering what in the circuit would be causing this as the H-bridge circuit runs fine by itself as well?

    I have been copying the circuit exactly (except for the power source) from these instructions

  2. Laplace


    Apr 4, 2010
    Since it seems to work OK without the load, the obvious problem would be that the 22KΩ base resistors are too large. Try 5600Ω or 4300Ω resistors instead.
    KrisBlueNZ and michan like this.
  3. michan


    Feb 21, 2015
    thank you! would those smaller resistors allow too much current through the base of the transistors though? Also how did you figure those resistances out? or are they just educated guesses haha, sorry for the hundreds of questions i just want to learn how to do it myself
    Last edited: Feb 21, 2015
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    Hi there and welcome to Electronics Point :)

    As is common with electronics-related articles on, the author of the instructable is a beginner himself and doesn't fully understand the circuit. There are many minor and some major errors in the article. If you copied the breadboard layout, it won't work.

    The first reference for an electronic design is the circuit diagram, aka schematic. There is no schematic provided with the article so I have drawn up the circuit that I believe he intended to show.


    That schematic includes four diodes, D1-4, which aren't in the instructable but should be. They're needed to protect the transistors from damage due to inductive kickback from the motor, which is an inductive device.

    The resistor values are quite high as Laplace pointed out in post #2. This, in conjunction with the lower supply voltage (5V instead of 9V), limits the amount of current the transistors will pass and could be the reason why your circuit isn't working. (Although as I said, if you copied the breadboard layout in the instructable, it won't work.)

    Here's a description of how that circuit works.

    The circuit uses four NPN transistors. Actually to be specific I will call them BJTs (bipolar junction transistors), because there are other types of transistors - MOSFETs, for example. These NPN BJTs are controlled switch devices. Current flowing into the base (the left terminal on Q1) causes the BJT to conduct current through its collector-emitter path (downwards, as they're drawn on the schematic). This base current comes from the pushbuttons, via the resistors.

    With both pushbuttons open (not pressed), there is no voltage available to turn any of the BJTs ON. Points A and B in the circuit sit at 0V. No current flows and the motor doesn't run.

    With SW1 pressed, point A in the circuit is pulled up to VCC, i.e. 9V. Q1 receives base bias via R1, and Q4 receives base current through R4. Both Q1 and Q4 conduct, and current flows in a complete circuit: battery positive, through the VCC rail, down through Q1, across through the motor, down through Q4, through the 0V rail and back to battery negative. Therefore the motor turns forwards, because the voltage applied to it has the polarity marked on the motor wires.

    When SW2 is pressed, point B is pulled up to VCC, and the circuit does the same thing except that the current path is through Q3 and Q2, and the battery voltage is applied across the motor with the opposite polarity so it runs backwards.

    If you press SW1 and SW2 simultaneously, all four BJTs will conduct and current will flow down both sides of the H-bridge. This current will not be limited by the resistance of the load, and the BJTs will overheat pretty quickly and may be damaged. So don't press both buttons simultaneously!

    When a button is released and the current to the motor is interrupted, because of the inductive nature of the motor it will generate a voltage spike called inductive kickback. This spike may be several times higher than the battery voltage and it can damage the BJTs - it can cause immediate destruction, or gradual deterioration. Therefore it is important to clamp both sides of the motor so they can't exceed the power supply rails. This is the reason for D1~4, which can be type 1N4001 or similar.

    Warning - getting a bit more technical...

    In that design there is an important difference between the operation of Q1/Q3 (the top halves of the 'H') and Q2/Q4 (bottom halves). Q1 and Q3 are operated in common collector configuration, also called emitter follower configuration. In this configuration they cannot saturate - they cannot turn ON fully. This means that they will always drop some voltage between their collectors and emitters; typically, at least 0.7V each. This is different from Q2/Q4 which are used in common emitter configuration and will typically drop about 0.2~0.3V from collector to emitter.

    This means that when the motor is running (in either direction), there will be about 0.7~0.8V across the top BJT, and 0.2~0.3V across the bottom BJT, so the voltage across the motor will be about 1V less than the battery voltage. This is why, in the instructable, the motor is described as operating from 7V, not 9V. With a 5V supply, this voltage drop is an even bigger percentage of the total voltage.

    Warning! Going a bit deeper into theory here...

    The reduced supply voltage also reduces the amount of base current available for the BJTs. Current flow through a resistor can be calculated using Ohm's Law, which says:
    I = V / R where
    I is the current flowing, in amps;
    V is the voltage across the resistor, in volts;
    R is the resistance of the resistor, in ohms (Ω).

    Because the top and bottom BJTs are used differently, the calculations are different. It's simplest to calculate the base current for the bottom ones. I'll do this for Q2. A small BJT with moderate current flowing into its base has around 0.7V between the base and emitter. Therefore, when SW2 is pressed, R2 will have 9V on the left end, and 0.7V on the right end (because Q2's emitter is connected to 0V). So R2 will have about 8.3V across it, and its resistance is 22 kΩ. Use Ohm's Law:

    I = V / R
    = 8.3 / 22,000
    = 0.000377A (amps)
    = 377 µA (microamps).

    That assumes a 9V power supply. Repeating the calculation with a 5V power supply gives a base current of only 195 µA - about half as much.

    I described a BJT as a kind of switch, but actually, it's a current amplifier. A small amount of current flowing into the base controls a larger amount of current flowing through the collector-emitter path. Every BJT has a characteristic called current gain, denoted hFE, which tells you how much collector-emitter current will flow for a given base current: for a base current IB, collector current IC will be IB × hFE.

    Actually there are several real-world factors that complicate matters, but I'll ignore those. The P2N2222's hFE specification is around 100, which means that a base current IB of 377 µA (0.377 mA) will allow a collector current IC of around 38 mA. That's not very useful when your motor needs 250 mA!

    In fact, even if your motor draws 0.25A when running, it may need a lot more than that to get started. In the real world, if a BJT doesn't have enough base current, it will not turn ON properly, and voltage will be dropped across it - voltage that should be across the motor. In this situation the BJT may overheat - quite quickly, for a small device like that.

    So you need to provide a lot more base current to Q2 and Q4. Reducing R2 and R4 from 22 kΩ to 2.2 kΩ (also written 2k2) will increase the base current by a factor of ten, but I would take it up by a factor of at least 20, because you want to saturate Q2 and Q4. I won't get into detail about saturation here, but it's explained in some resources on this site (future reading if you're keen!)

    So I would reduce R2 and R4 to 1 kΩ each.

    The situation for R1 and R3 is different because there should be very little voltage across them, and I won't go into the calculations here. I would guesstimate that 100Ω each would be good for them. It's arguable that they aren't needed at all and could be replaced with short circuits.

    If you want to avoid the 1V voltage drop between your 5V power supply and the 4V (approximately) maximum that you can supply to your motor, there are other designs for H-bridges that are a lot better. I would normally recommend an H-bridge IC, but the ones that will work at 5V have transistor output stages and suffer from the same voltage loss problem, and the more modern ones, with MOSFET output stages, need at least 8V power supplies.

    It's possible to design a MOSFET-based H-bridge that will perform very well, but it will be quite a bit more complicated. Let me know if you want to go down that route.
    Last edited: Feb 21, 2015
    michan, hevans1944 and BobK like this.
  5. michan


    Feb 21, 2015
    Thankyou so so much! that was more than helpful and i will definitely try using those resistances recommended. I would like to get this working before i move on to using the H-bridge IC's so i can learn from it and have a better understanding of what its doing rather than just using something that does its job but in my eyes is still some kind of magic. What you have explained has definitely taught me a lot more than i ever thought to learn from making this circuit hahah thankyou.
    KrisBlueNZ likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day