Connect with us

Huge trouble driving a stepper motor with an h-bridge

Discussion in 'Sensors and Actuators' started by loamobn1, Feb 23, 2012.

  1. loamobn1

    loamobn1

    10
    0
    Feb 23, 2012
    I'm trying to drive a stepper motor with an h-bridge. The motor has four input leads, so uses two h-bridges. I need to be able to reverse the current through the coils (thats why I'm using the h-bridges), and control the mosfets on either side of the h-bridge with one 5V output pulse from an Arduino.

    My first attempt was to put P-Channel mosfets on the top half, N-Channel mosfets on the bottom half, and have one signal feed the gate of the correct N-Channel and go through an inverter and feed the corresponding P-Channel. That didn't work, because (for some reason unknown to me) the Hex Inverter IC's LOW was about 1V, and didnt put the P-Channel into conduction.

    Then I tried the circuit that I have attached, to actively drive the P-Channel gate low. The output (either side of the coil) looks fine from an oscilloscope when the motor isn't connected, but when it IS, the voltage at these points dies out.

    I've seen a half dozen H-bridge circuits, and tried most of them (the simpler ones), but none of them have worked. I think that the problem may be that the P-Channel drain voltages are about equal to the gate voltage...but the gate threshold voltage is 2V, so it doesn't turn on.


    I've been working on this thing non-stop for weeks, asked a handful of EE students, and no one knows....any help or suggestions would make you a celebrity around here.

    (P.S. The "resistance" of the coil is 12 ohms. The control voltages come from an arduino [5v] and feed into the bases of Q5 and Q6 as well as the gates of the n-channel mosfets)

    Thanks
     

    Attached Files:

  2. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    were you using logic level mosfets? What was the voltage applied to the source/gate of the p-channel mosfet?

    From the schematic it looks like your p-channel mosfets are wired wrong. You need the gate to be more negative then the source for a p-channel to turn on yet you have the source attached to ground? Hard to see, maybe I need glasses.
     
    Last edited: Feb 23, 2012
  3. loamobn1

    loamobn1

    10
    0
    Feb 23, 2012
    Not your fault, the diagram is tiny.

    I have the top side p-channel sources connected to supply voltage.

    The threshold voltage for my N-Channels is 3-5V, and P-Channel threshold voltage is -2 to -4V. I suppose that would classify them as logic level?
     
  4. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    it doesn't look it, enlarge that schematic and post another picture.

    [​IMG]
     
    Last edited: Feb 23, 2012
  5. loamobn1

    loamobn1

    10
    0
    Feb 23, 2012
    I'm actually at the lab now (with the circuit), not near my schematic computer. I may have done the schematic wrong...the sources of the P-Channels are at Vcc in reality, and the drains of the N-Channels are connected to the drains of the P-Channels. Its a 'generic' h-bridge circuit, except for the BJTs driving the P-Channel gates.

    When I test this circuit with LEDS (that is, but LEDS facing both ways at the points where the coil would be), they blink correctly and at a decent intensity. If I plug a motor in, the circuit consumes almost no current (according to my power supply), but if I listen hard I can hear some clicking inside the thing...
     
  6. loamobn1

    loamobn1

    10
    0
    Feb 23, 2012
    its really simple:

    void setup() {
    pinMode(0, OUTPUT); //Red
    pinMode(1, OUTPUT); //Blue
    pinMode(2, OUTPUT); //Green
    pinMode(3, OUTPUT); //Black
    }

    void loop() {
    digitalWrite(0, HIGH);// Phase 1F
    digitalWrite(1, LOW);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    delay(50);
    digitalWrite(0, LOW);// Phase 2F
    digitalWrite(1, LOW);
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    delay(50);
    digitalWrite(0, LOW);// Phase 1R
    digitalWrite(1, HIGH);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    delay(50);
    digitalWrite(0, LOW);// Phase 2R
    digitalWrite(1, LOW);
    digitalWrite(2, LOW);
    digitalWrite(3, HIGH);
    delay(50);
    }

    Pin 0 and Pin 2 are connected to one h-bridge, Pin 1 and Pin 3 to the other.
     
  7. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    I wonder if a mosfet driver would help you? You are trying to drive two mosfets from the same arduino pin.


    delay() is in what mS uS?

    edit: I am going to bed, later on the experts will come on as they live in australia and are sleeping. If you haven't got it figured out, take a nap and check back in the morning. Someone will have an idea
     
    Last edited: Feb 23, 2012
  8. loamobn1

    loamobn1

    10
    0
    Feb 23, 2012
    Thanks for your help so far...

    delay is indeed in milliseconds.

    I'm going to try the circuit you posted and see if that works.
     
  9. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    I give up. it is late and my brain has stopped working.
     
  10. twister

    twister

    155
    5
    Feb 12, 2012
  11. loamobn1

    loamobn1

    10
    0
    Feb 23, 2012
    jackorocko:

    Your circuit worked (with some n-channel pulldown resistors)!

    Why did you choose the resistor values you did? Whats the purpose of the 100ohm between the p-channel gate and the NPN collector? Why can't you just connect the two without a resistor?
     
    Last edited: Feb 23, 2012
  12. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,174
    2,690
    Jan 21, 2010
    It will limit the current through the transistor to a safe value.
     
  13. loamobn1

    loamobn1

    10
    0
    Feb 23, 2012
    I really appreciate the help from everyone, thanks very much.
    Ryan
     
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

-