Connect with us

h-bridge problem . transistor question

Discussion in 'Electronic Basics' started by Elia, May 26, 2004.

Scroll to continue with content
  1. Elia

    Elia Guest

    I am trying to drive a 9vdc motor using a pic microcontroller. I build
    the h-bridge but it is not working.
    The problem is that :
    The transistor is functioning more or less as a relay . So this
    diagram should output 9v . Instead I get a 3 vdc .
    Can you tell me why ?

    +9vdc
    |
    collector
    /
    +5-----base|< [tip122]
    \
    emitter
    |
    |
    |
    ground

    thanks .
     
  2. Soeren

    Soeren Guest

    Hi Elia,
    I suspect you have connected the load between emitter and ground (since
    you get 3V out.
    That would be correct when (mis)using the transistor this way, as you
    cannot get the emitter higher than V_b - V_be
    V_b is your 5V from the PIC and V_be (the voltage drop from base to
    emitter) is ~2V for a darlington.

    To remedy the situation use a PNP (eg. TIP127) and invert the base
    drive.

    You will probably not get more than ~8V over the load, as you are using
    darlingtons.


    --
    Regards,
    Soeren

    * If it puzzles you dear... Reverse engineer *
    New forum: <URL:http://www.elektronikteknolog.dk/cgi-bin/SPEED/>
     
  3. Elia

    Elia Guest



    I am using 4 tip122 in a H-bridge configuration.

    You think I should use 2 npn and 2 pnp , That make sense . Because I
    will have the load on the correct side of the transistor . (hmmm Is
    that correct ? )


    thanks .:)
     
  4. CFoley1064

    CFoley1064 Guest

    Subject: h-bridge problem . transistor question
    Hi, Elia. I'm not sure you know what you mean here. This is an "H-Bridge"
    example (use fixed font or view in M$ Notepad):

    H-Bridge
    VCC
    +
    .------o-------.
    | |
    | |
    |< >|
    -| PNP PNP |-
    |\ /|
    | ___ |
    o-----UUU------o
    | Motor |
    |< <|
    -| NPN NPN|-
    |> <|
    | |
    | |
    '------o-------'
    |
    ===
    GND

    You want to use an H-bridge when you want bidirectional control of your motor.
    In the diagram above, the motor will spin one way (say, CW) when the PNP on the
    left is on (sourcing current to the motor) and the NPN on the right is on
    (sinking current). If you want to reverse the direction, you turn the right
    PNP and the left NPN on. Note the similarity to an "H" -- that's how it gets
    its name.

    If you just want your DC motor to go in one direction, you can just use a
    transistor as a switch to turn it on, like this:

    Motor Switch

    VCC VCC
    + +
    | |
    | C|
    - C|
    ^ C|
    | |
    '---o
    |
    ___ |/
    o-|___|-o-| NPN
    R | |>
    .-. |
    | | |
    R| | |
    '-' |
    | |
    === ===
    GND GND

    When you turn on the base input with a logic "1" from the PIC, the transistor
    will turn on, and the 9V will be impressed across the motor, turning it on.
    When there's a logic "0" at the input, the transistor will turn off. You might
    want to use an NPN TO-220 darlington transistor and 10K resistors for R, and a
    1N4002 diode if it's a fairly small motor (less than 1A)

    Good luck
    Chris
     
  5. Soeren

    Soeren Guest

    Hi Elia,

    Yes, that would work. And you could drive the PNPs with small signal
    NPNs like so:

    +V O-------------+----------+-----+
    | | |
    | | [R]
    |/e e\| |
    ---| PNP PNP |---+
    b |\c c/| b |
    | | |
    +--[Load]--+ [R]
    | | |
    b |/c c\| b |
    A O----+--[R]--| NPN NPN |---------------O B (equal to A)
    | |\e e/| | (but I'm lazy :)
    | | | c\|
    | | | NPN |--[R]--+
    | | | e/| |
    | | | | |
    Gnd O------------+----------+-----+ |
    | |
    +------------------------------------+

    (You will still get the darlingtons voltage drop of >~1V, to change
    that, you would have to use non-darlington BJTs or better MOSFETs)


    --
    Regards,
    Soeren

    * If it puzzles you dear... Reverse engineer *
    New forum: <URL:http://www.ElektronikTeknolog.dk/cgi-bin/SPEED/>
     
  6. Marlowe

    Marlowe Guest

    If you can get a copy of John Iovine's book "PIC Microcontroller Project
    Book", look on page 145. He has a project of a PIC controlling a H-Bridge
    of 4 TIP120 NPN transistors.
     
  7. Rich Grise

    Rich Grise Guest

    This will never do.
    B ahouldn't be equal to A, it should be its inverse, which is
    what it looks like the lower-right transistor is for. And there's
    no base drive to the upper-left transistor.

    Even laziness can't account for that! :)

    I shouldn't just whine, without providing some kind of answer:

    +V O---+---------+----------+-------------+
    | | | |
    [R] | | [R]
    | |/e e\| |
    +--[R]--| PNP PNP |---[R]-----+
    | b |\c c/| b |
    | | | |
    | +--[Load]--+ |
    | | | |
    | b |/c c\| b |
    A O----+--[R]--| NPN NPN |---[R]-----+
    | |\e e/| |
    | | | c\|
    | | | NPN |--[R]--+
    | | | e/| |
    | | | | |
    Gnd O------------+----------+-------------+ |
    | |
    +--------------------------------------------+

    Hmmm - actually, this looks more like a time bomb. Being a
    coward, I'd probably turn the transistors upside down:

    +V O---+---------+----------+----------+
    | | | |
    [R] | | [R]
    | |/c c\| |
    +-------| NPN NPN |--------+
    | b |\e e/| b |
    | | | |
    [D] +--[Load]--+ [D]
    |k | | |k
    | b |/e e\| b |
    A O----+-------| PNP PNP |--------+
    | |\c c/| |
    | | | c\|
    | | | NPN |----+
    | | | e/| |
    | | | | |
    Gnd O------------+----------+----------+ |
    | |
    +------------------------------[R]-----+
    |
    [R]
    |
    Gnd

    Have Fun!
    Rich
     
  8. This is a supplement to other answers. NPN transistors will,
    generally, try to keep the emitter at about 0.7V below the base if
    they can. The TIP122 is a darlington NPN transistor, so there are
    actually two NPN transistors in there, and so the drop will be
    something like 2 times 0.7 or 1.4V.

    One way to overcome this would be to connect your load between the
    collector and 9V. Use a 1000 ohm resistor between the PIC and the base
    of the transistor. Then, when you output 5V, it will turn on the
    transistor, and allow current to flow through your load. When you drop
    the output to 0V, it will turn off the transistor, and cut off current
    through your load.

    To make an H-bridge out of these, you need complimentary PNP
    transistors for the 'high side'. The complimentary PNP transistor is
    the TIP127.

    In order to use those NPN and PNP transistors, you have to ensure that
    your base voltage is properly biased. If you just hook up the bases,
    current will flow through them in a 'bad' way. That means resistors,
    etc. You can do it, but its much easier with MOSFETs, which have
    practically no gate current. Additionally, the voltage drop across the
    devices will be less for good MOSFETs, so the heat generated by the
    devices will also be less. Here is a simple circuit which you might
    use as the basis of a design.

    VCC
    +
    |
    +-----+------+
    | |
    | | P-MOSFET
    +--||-+ +-||--+
    | ||-> <-|| |
    | ||-+ LOAD +-|| |
    |\ |\ | | .----. | |
    CTL -| >O-+-| >O--+ +---| |---+ +--+
    |/ | |/ | | '----' | | |
    | | | | | |
    | | ||-+ +-|| | |
    | | ||<- ->|| | |
    | +--||-+ +-||--+ |
    | N-MOSFET | | |
    | | | |
    | +-----+------+ |
    | | |
    | === |
    | GND |
    | |
    +-----------------------------------+
    created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

    When CTL is high, the right gate voltages will be low, so the upper
    right P-MOSFET will be on and the lower N-MOSFET will be off. Also,
    the left gate voltages will be high, due to the inverter, so the lower
    left N-MOSFET will be on, and the upper P-MOSFET will be off. Thus,
    the current will flow through the load from right to left.

    When CTL is low, the converse is true, that is, current flows through
    the load from left to right.

    Note that there are H-BRIDGE chips which do more than just gate
    current. They also ensure that there is never current flowing through
    both the top and bottom transistors on one side by using a delay.
    Also, they usually feature enables, and other cool features, along
    with a nice package to fasten to your heatsink.

    One chip I've used for this is an S754410, called a 'Quadruple 1/2 H',
    and features tristate outputs, and will do an amp per driver. It
    protects against glitches on power up (which is a good thing), and
    interlocks output channels so you don't have to worry about both sides
    of your H conducting. It also allows split voltages, so you can
    control it with logic levels of 5V from your PIC, while using higher
    voltage power output levels.

    For beefier apps, another chip is the venerable L298, which will
    support up to 4A.

    For low current applications, these may be a better buy. If you are
    doing 20A, then I think you'll have to roll your own.

    Regards,
    Bob Monsen
     
  9. Soeren

    Soeren Guest

    Hi Rich,

    You assume a single drive line I suppose ?

    I am gunning for using 2 output lines from the PIC, that way you can
    easily do PWM.
    (And it works pretty OK for our ~30 pound autonomous robot ;)

    The upper left has no base drive because, as I wrote, I was too lazy to
    finish the drawing and it is supposed to be the mirror image of the
    other "side", so I thought any reader could finish it up mentally
    (obviously a mistake :).

    Bwaaahaaahaaaaa, now you're kidding, right ?
    This will only (at best) provide bang-bang control and worst case...
    Holy Smoke Batman... and it's gettin' out of 'em ;)

    I use something similar (in a very different app.) to ensure a dead-band
    in the shifts, but motorcontrol with only full speed in either direction
    is not very useable and a simple relay would be muy choice if I ever
    needed it.

    I do... Have some too :)


    --
    Regards,
    Soeren

    * If it puzzles you dear... Reverse engineer *
    New forum: <URL:http://www.ElektronikTeknolog.dk/cgi-bin/SPEED/>
     
  10. Soeren

    Soeren Guest

    Hi Bob,


    And what then if you (heaven forbid it) want the motor to stop ;)


    --
    Regards,
    Soeren

    * If it puzzles you dear... Reverse engineer *
    New forum: <URL:http://www.ElektronikTeknolog.dk/cgi-bin/SPEED/>
     
  11. Elia

    Elia Guest

    I am sorry I wasnt really clear in my question . So , what I am trying
    to do is to change the direction of a 9v dcmotor using a H-bridge
    controled by the pic microcontroller and I am using pic 2 lines ( RB1
    , RB2 ) .



    |-------------------------------|
    | 9vdc |
    | | |
    | C---+--C |
    rb1---[1k]--+-----B PNP PNP B-----+ |
    E E | |
    | | | |
    |-[LOAD]-| | |
    | | | |
    C C | |
    rb1---[1k]-+-[R10k]--B NPN NPN B----[R10k]-|
    | E E |
    | | | |
    | GND GND |
    | |
    |------------------------|

    This is the design that I am using . The pic Power Supply is 5vdc and
    the H-bridge supply is 9vdc . So my question is WHAT IS WRONG !!! . I
    am unable to figure it out . I am using the tip122. For a moment I
    got out of the 9v that I am feeding the circuit a .5 v from the
    h-bridge . or nothing .

    i also tried the diagram found in the pic microcontroller book using 4
    tip120 . And that was not working well either .
    (Am I doing everything wrong? :(
    ..


    thanks for the help!!!
    Elia .
     
  12. CFoley1064

    CFoley1064 Guest

    Subject: Re: h-bridge problem . transistor question
    Hi, Elia. Thanks for a more complete description of the problem -- it usually
    helps. First of all, you've got the emitters and the collectors of the PNP
    transistors reversed (that's shown in one of my prior posts as well as another
    one -- the emitter is the side with the "arrow", and the emitters of the PNP
    transistors should be on the 9V side, not the motor side.

    Second, you're not going to turn off the PNP transistors unless you apply an
    input voltage to the base of the transistors that's around 9V. Logic "1" for
    the PIC is around 5V, which won't cut it.

    Also, you might want to consider downloading Andy's ASCII Circuits to help you
    draw your circuit fragments in ASCII art. It's available at

    http://www.tech-chat.de/

    Look for the AACircuit1.24 link.

    Why don't you try something like this (view in fixed font or M$ Notepad):

    PIC H-Bridge Driver VCC
    +
    |
    .--------. .-.
    | | | |1 OHM 3W
    | | | | .--------.
    .-. | '-' | |
    1K| | | | | .-.
    | | '---o---' | |1K
    '-' | | |
    | .------o------. '-'
    | | | |
    | | | |
    ___ | |< >| | ___
    .-|___|--o---| PNP PNP |---o--|___|-.
    | |\ /| 1K |
    ___ |/ | | <| ___
    ..--|___|-o-| 2N3904 | ___ | 2N3904|- -|___|--.
    | 10K | |> o-----UUU-----o /| | 10K |
    | .-. | | Motor | | .-. |
    | 10K| | GND | | GND | |10K |
    | | | RB1 ___ |/ <| ___ RB2 | | |
    | '-' o-o-|___|-o-| NPN NPN |-o-|___|-o-o '-' |
    | | | 10K | |> /| | 10K | | |
    | GND | .-. | | .-. | GND |
    | | 10K| | | | | |10K | |
    | | | | | | | | | |
    | | '-' '------o------' '-' | |
    | | | | | | |
    | | GND === GND | |
    | | GND | |
    | '-------------------------------------|---------------'
    '-----------------------------------------------------'


    created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

    This looks a little complicated, and there are unfortunately quite a few
    resistors, but this is one way of doing things that will work. The 1 ohm 3W
    resistor on the top is to prevent blowing something during the microseconds
    that both the PNP and NPN are on. Depending on your power source, you might
    not need that.

    Try this circuit, and I'll bet you get a working bidirectional motor driver.

    Good luck (which is the residue of hard work, so you'll be OK if you use your
    head)
    Chris
     
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

-