Connect with us

Reversing motors

Discussion in 'Electronic Basics' started by Danny T, Jan 12, 2005.

Scroll to continue with content
  1. Danny T

    Danny T Guest

    I've got little motors that change direction if you reverse the
    polarity. What's the best way to achieve this from a PIC? I was thinking
    something like this:

    | .------------------------------.
    | | |
    '--)----------o--------. |
    | | | |
    | | V Diode |
    | | - |
    | | '-----. |
    | | | | | __
    | | _-_ | | -o|P |o-
    | |Motor |___| | | -o|I |o-
    | | - | '---o|C |o-
    | .----)--------' | .---o|__|o-
    | | | | | |
    | | | - | |
    | | | Diode ^ | |
    | |D | | D| |
    | ||-+ '--------' +-||-
    |G ||<- ->|| G
    '--||-+ +-||
    | S S |

    (created by AACircuit v1.28.4 beta 13/12/04

    However I'm not sure about the diodes, and power heading for the chip,
    instead of the motor. What's the usual way to do this kind of thing?

  2. Danny T

    Danny T Guest

  3. Andrew Holme

    Andrew Holme Guest

    No, that won't work. The power supply would short-circuit through a
    diode and a MOSFET. You have to use the H-bridge configuration:"h-bridge"
  4. Andrew Holme

    Andrew Holme Guest

    Yes, you could do it with a relay. You need a back e.m.f. protection diode
    across the relay coil and a MOSFET to drive it from the PIC. An
    all-semiconductor solution might be more elegant (H-bridge) but a relay is
  5. Danny T

    Danny T Guest

  6. Danny T

    Danny T Guest

    I've just been looking on rapid ( where I got my
    N-channel MOSFETs, but they don't seem to have any similar P-Channel
    ones. None rated at 1A of the same product, and some of the other
    products are 80-100V, and/or don't say if they're NPN or PNP :-(
  7. Your first schematic shorts the power supply to ground when you turn on
    one of the mosfets.

    What you really want is an H-Bridge. You can use one of the available
    h-bridge integrated circuits, but you may wish to build your own out of
    discrete components.

    You can use the mosfets you've already obtained for the low side
    switching, but you will need something different for the high side
    switch. You could use some standard p-channel mosfets, but switching
    them on can be a pain. I really like these things, they are quite neat:
    They are often called smart power switches because they contain more
    than just a p-channel mosfet, they are usually short-circuit protected
    and have the ability to tell you if the circuit is open. They also
    contain all the necessary circuitry to take a logic level input and
    apply the appropriate gate drive to the internal transistor. I think
    they were primarily developed for the automotive industry, but would
    work well in your application.
  8. Danny T

    Danny T Guest

    That all sounds fantastic, but while I'm testing and potentially
    destroying things, they're probably a bit OTT (and expensive),
    especially in comparison to the low-side ones I've got! (about 50p each!)
  9. Ban

    Ban Guest

    Don't try it out, unless you want to smoke the components. You will need a
    H-bridge to reverse current flow with the appropriate drivers. and
    aditionally some snubber across the FETs. There are ready made solutions
    available in intregrated form like, the data sheet will give more
    details. You can control the motor with a PWM-signal and need only 1 line
    from the PIC.
  10. Andrew Holme

    Andrew Holme Guest

    Yep, that's an H-bridge; using bipolar transistors.
    You need P-channel MOSFETs. The terms NPN and PNP apply to bipolar
    transistors. MOSFETs are either: N-channel, or P-channel.
    Only via an inverter: the high-side MOSFETs turn-on when the gate is

    The high-side transistors are tricky to drive when the motor runs off a
    different voltage to the controller. You might be better off looking
    for a monolithic high-side driver like Anthony suggested.
  11. each!)

    Well, like I said, the nice thing about the smart switches is that they
    are often short circuit and reverse polarity protected. I paid US $1.60
    ea for some 9A 36V (VN820) switches. Keep in mind that most things
    designed for automotive use are usually pretty durable. This is what I
    have, in the pentawatt case (5-pin TO-220):
    I really don't like the case (pin layout), it's workable.
  12. This thread
    Subject: Motor Control Circuit Problem
    Date: 28 Oct 2004 15:48:41 -0700
    may be of interest
  13. Sorry, no. If either mosfet turns on, it forward biases the diode it
    is connected to, forming a near short across the supply. You need 4
    mosfets (each of those diodes has to be replaced with an active
  14. peterken

    peterken Guest

    There IS another way, but it needs building a half-supply-voltage-regulator
    (if it isn't available yet as a middle connection of a transformer)

    something like this....

    \ | |
    R/ |c s|
    \ |/ +-||
    +---| npn <-||
    | |\e d+-||--- hi drive
    | | |===| |
    | +----| M |---+
    | |e |===| |
    | |/ d+-||
    +---| pnp ->||
    \ |\ +-||--- low drive
    R/ |c s|
    \ | |

    note the "half-supply" on the left, might be the middle-connection of the
    supply transformer
    (and yes, I disregarded snubber-diodes, I know, but it's the principle....)
  15. Danny T

    Danny T Guest

    Then how about tunning the PNP and NPN from the same side on a single
    pin? Would they change properly together, or could there be a period
    where the P-channel has closed (on a low) before the N-channel has
    opened (on the low)?

    I don't understand :(
    I've been thinking about having seperate supplies for my motors and pic.
    I'll use diodes while it's plugged into the wall, but when running on
    batteries, I'll have a set for the motors, and a set for the pic. Should
    I connect the grounds together, or keep everything seperate? (surely I
    need to connect them since the MOSFETs drain and gate both need source
    to be grounded for their circuits?

  16. Andrew Holme

    Andrew Holme Guest

    Yes, you can do that.
    Yes, the logic transition needs to be fairly fast; but that shouldn't be a

    There's an example circuit in the thread Terry P cited.
    For the lower (N) transistors, the PIC has no problem producing the OFF
    voltage (zero).
    For the upper (P) transistors, the OFF voltage = motor power supply.
    Some sort of level conversion stage may be required in-between.
    If you ran the motor from 3V, a P-channel logic-level drive MOSFET would
    need 3-5 = -2V to turn-on. You would be better of making the H-bridge with
    bipolar transistors for 3V motors.
    Yes, you must connect the grounds together to establish the common reference
  17. Danny T wrote:
    <snip quest for a reversable motor>

    Regarding motor reversal, you probably want to use an integrated IC that
    is designed for this. One that I use is this one:

    (I probably wouldn't buy it there though. You could probably buy 4 at
    arrow for the price of one here).

    There are lots of advantages to this chip over the discrete solution you
    are considering, including the ability to drive a higher voltage motor,
    circuitry to prevent 'shoot through', which must means having the high
    and low driver on one side turned on at the same time (which causes
    spikes on the supply), etc. It takes 4 PIC pins to run 2 motors (or 6 if
    you want to separately control the enables).

    You need to buy some 'fast' diodes as well to protect the drivers from
    reverse voltages. Look at the datasheet for more info.

    The only real liability is the power limit.

    Robert Monsen

    "Your Highness, I have no need of this hypothesis."
    - Pierre Laplace (1749-1827), to Napoleon,
    on why his works on celestial mechanics make no mention of God.
  18. Don't worry, it gets harder. ;-)
    Yes, you will want to connect the grounds together.

    High side switching is kind of a pain (go read a p-channel MOSFET
    datasheet and pay close attention the voltage that is needed on the gate
    with respect to the source voltage, also look at the horrid RDSon
    values), that is why the monolithic power switch devices exist. They
    also make it possible to apply the same +5V signal that you are applying
    to the low-side MOSFET to switch them on, instead of needing a voltage

    You can also use N-channel transistors on top, but then you have to come
    up with a voltage higher than your motor supply to turn them on fully.
    That's because the Vds is really small when the transistor is on, AND
    (for the transistor to be fully on) the Vgs has to be at least 4V for a
    logic level MOSFET. In order to get the gate at a high enough voltage,
    you will have to apply 16V (if your motor supply is 12V) to the gate.
    How ya gonna do that? ;-)
  19. Danny T

    Danny T Guest

    Andrew Holme wrote:


    (and others on Rapid) don't say if they're N-channel or P-channel. I've
    checked a few datasheets with no avail too. They're called "power
    MOSFETs", but I don't know if that means they're P or not... The item
    number (VNP10N06) has both an N and P in! It also says "omnifet", if
    that suggests either! :-\

    The datasheet (if I'm reading it right) says a min of 3.2V will switch
    it, but it says "Vdd = 16". My supply is only 4-5V - would this be a
  20. Andrew Holme

    Andrew Holme Guest

    The schematic in the PDF, with the source arrow pointing into the
    MOSFET, indicates N-channel.

    This device looks a bit OTT for your application.

    Where does it say "Vdd=16"? Do you mean "Vdd=15" in the "Test
    Conditions" column? That's just the voltage they took the measurement
    at. The MOSFET will switch any voltage up to the specified max.
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