Shop OBEX P1 Docs P2 Docs Learn Events
bipolar stepper control — Parallax Forums

bipolar stepper control

ArchiverArchiver Posts: 46,084
edited 2002-11-28 00:32 in General Discussion
I'm having trouble controlling a stepper with my stampII and I was
wondering if someone could help me out.
it's a 3V bipolar stepper that I'm trying to run from a L298 H bridge
and all I can get out of it is some vibrations, even if I set my step
time to 500ms
I've got one coil connected to outputs 1 and 2, and the other coil
connected to outputs 3 and 4. I had to ground the current sense pins on
the L298 to get it to work at all.
I've had a unipolar stepper working with this setup but never a bipolar.
is there something wrong with my setup, my sequencing, or is there a
problem trying to run the L298 at 3v? (I have the logic input connected
to 5v)

I'd appreciate any help you guys can provide.
thanks.

Jason Lavoie

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-05-14 02:48
    Jason:
    I just looked at the L298 data sheet, and several thoughts come to mind:

    1) The bridge always drives with two transistors in series, and the spec
    indicates that the total drop will be ~2V. If you are supplying it with
    only 3V, this leaves only ~1V for the motor winding. Try running it with 5
    or 6 volts.

    2) The current sense pins must be grounded, either directly, or through a
    low value current sense resistor. If a resistor is used, you need even more
    supply voltage.

    3) Pin 9 (Vref) should be connected to 5V.

    4) Hopefully, you have the clamp diodes shown on the example circuits.

    If this doesn't help, maybe the phase sequence is wrong.

    Let us know how you make out,
    Ray McArthur

    Original Message
    From: Jason Lavoie <jlavoie@e...>
    To: <basicstamps@egroups.com>
    Sent: Saturday, May 13, 2000 6:09 PM
    Subject: [noparse][[/noparse]basicstamps] bipolar stepper control


    > I'm having trouble controlling a stepper with my stampII and I was
    > wondering if someone could help me out.
    > it's a 3V bipolar stepper that I'm trying to run from a L298 H bridge
    > and all I can get out of it is some vibrations, even if I set my step
    > time to 500ms
    > I've got one coil connected to outputs 1 and 2, and the other coil
    > connected to outputs 3 and 4. I had to ground the current sense pins on
    > the L298 to get it to work at all.
    > I've had a unipolar stepper working with this setup but never a bipolar.
    > is there something wrong with my setup, my sequencing, or is there a
    > problem trying to run the L298 at 3v? (I have the logic input connected
    > to 5v)
    >
    > I'd appreciate any help you guys can provide.
    > thanks.
    >
    > Jason Lavoie
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-14 06:10
    rjmca wrote:

    > Jason:
    > I just looked at the L298 data sheet, and several thoughts come to mind:
    >
    > 1) The bridge always drives with two transistors in series, and the spec
    > indicates that the total drop will be ~2V. If you are supplying it with
    > only 3V, this leaves only ~1V for the motor winding. Try running it with 5
    > or 6 volts.
    >

    although I was running it at 3v I was able to get the motor to turn by manually
    connecting each input to ground in sequence (touching wires together) I will
    bump it up to 5v though.


    >
    > 2) The current sense pins must be grounded, either directly, or through a
    > low value current sense resistor. If a resistor is used, you need even more
    > supply voltage.
    >

    yup, grounded.

    >
    > 3) Pin 9 (Vref) should be connected to 5V.
    >

    done.

    >
    > 4) Hopefully, you have the clamp diodes shown on the example circuits.
    >

    I haven't added the diodes yet, would this cause it not to work at all?

    >
    > If this doesn't help, maybe the phase sequence is wrong.
    >

    see answer to #1, I'm pretty sure I've got the sequence right. would it be a
    different sequence than a uni-polar stepper? (excluding half-steps)

    thanks, I'll see what happens.

    Jason
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-14 06:24
    Hi Jason,

    Original Message
    From: Jason Lavoie <jlavoie@e...>
    To: <basicstamps@egroups.com>
    Sent: Sunday, May 14, 2000 1:10 AM
    Subject: Re: [noparse][[/noparse]basicstamps] bipolar stepper control


    > I haven't added the diodes yet, would this cause it not to work at all?
    >
    ** The lack of diodes shouldn't stop it from running, but it protects the
    IC.
    >
    > see answer to #1, I'm pretty sure I've got the sequence right. would it be
    a
    > different sequence than a uni-polar stepper? (excluding half-steps)

    ** Don't know...will sketch it out, hopefully tomorrow.

    Regards,
    Ray McArthur
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-14 06:33
    > I haven't added the diodes yet, would this cause it not to work at all?

    The chip may not last very long without the diodes. You can get a pretty
    good spike when the magnetic flux in the coils collapse.

    > see answer to #1, I'm pretty sure I've got the sequence right.
    > would it be a
    > different sequence than a uni-polar stepper? (excluding half-steps)

    Here is the code I used in PICBasic Pro to drive a bipolar stepper through a
    L293D. PORTA.0 & PORTA.1 were hooked to one bridge and PORTA.2 & PORTA.3
    were hooked to the other. If you want to visualize the bits directly on the
    coils the coils are hooked up as AaBb. I would just uncomment the half step
    code and comment the full step stuff or visa versa. No real reason that the
    For loop is decrementing. It would work as well the other direction except
    the motor rotation would be reversed.

    myLoop:
    For i = 3 TO 0 STEP -1 'Full Step
    ' FOR i = 7 TO 0 STEP -1 'Half Step
    LookUp i,[noparse][[/noparse]%1010,%0110,%0101,%1001],mystep 'Full Step
    ' LOOKUP i,[noparse][[/noparse]%1010,%1000,%1001,%0001,%0101,%0100,%0110,%0010],mystep 'Half
    Step
    PORTA = mystep
    Pause mySpeed
    Next i
    GoTo myLoop

    Hope that helps you and get those diodes in place before the chip goes pop.

    Tim
    [noparse][[/noparse]Denver, CO]
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-14 07:46
    hey thanks! I got it working.. I guess I just didn't have the right sequence.. I
    had something
    that looked similar, but for some reason it wasn't working.

    Jason Lavoie


    > Here is the code I used in PICBasic Pro to drive a bipolar stepper through a
    > L293D. PORTA.0 & PORTA.1 were hooked to one bridge and PORTA.2 & PORTA.3
    > were hooked to the other. If you want to visualize the bits directly on the
    > coils the coils are hooked up as AaBb. I would just uncomment the half step
    > code and comment the full step stuff or visa versa. No real reason that the
    > For loop is decrementing. It would work as well the other direction except
    > the motor rotation would be reversed.
    >
    > myLoop:
    > For i = 3 TO 0 STEP -1 'Full Step
    > ' FOR i = 7 TO 0 STEP -1 'Half Step
    > LookUp i,[noparse][[/noparse]%1010,%0110,%0101,%1001],mystep 'Full Step
    > ' LOOKUP
    i,[noparse][[/noparse]%1010,%1000,%1001,%0001,%0101,%0100,%0110,%0010],mystep 'Half
    > Step
    > PORTA = mystep
    > Pause mySpeed
    > Next i
    > GoTo myLoop
    >
    > Hope that helps you and get those diodes in place before the chip goes pop.
    >
    > Tim
    > [noparse][[/noparse]Denver, CO]
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-15 02:54
    Hi Jason, Ray and Tim

    Information about stepper motors?

    The right sequence (for all types: unipolar, bipolar, etc.) and information
    about H-bridges (and protection diodes for your L298) are very very very
    good explained at:
    www.cs.uiowa.edu/~jones/step

    Regards,

    Ar
  • ArchiverArchiver Posts: 46,084
    edited 2000-05-15 04:15
    Aristides:
    I agree, we use that site, along with one from Thompson/Airpax as excellent
    references.

    Ray

    Original Message
    From: Ar
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-27 19:56
    Hi!

    I'm new to stamp world. I'm looking for code to drive a bipolar
    (4 wire) size 17 stepper motor. I've gotten the code for a unipolar
    motor, but a bipolar motor needs different sequencing.

    Any help would be most appreciated!

    Thank you and Happy Thanksgiving, U.S.A. [noparse]:)[/noparse]

    Ron Yost
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-27 23:26
    Have a look at my web page on driving a stepper motor.

    It goes through some experiments I did in learning how to drive Stepper
    motors.

    Right at the end is a bipolar example - easily converted for a
    Microcontroller design.

    http://www.lennard.net.nz click on circuit ideas, then stepper motor (down
    the bottom of the links.

    Ben Lennard

    *ACSE, ACCE
    *National Certificate in Electronic Engineering
    *Diploma in Electronic and Software Engineering

    "To the optimist, the glass is half full. To the pessimist, the glass is
    half empty. To the engineer, the glass is twice as big as it needs to be."

    No animals were harmed in the transmission of this email, although the
    Dog next door is living on borrowed time, let me tell you! Those of you
    with an overwhelming fear of the unknown will be gratified to learn that
    there is no hidden message revealed by reading this warning backwards.

    > From: Ron Yost <musik42@c...>
    > Reply-To: basicstamps@yahoogroups.com
    > Date: Wed, 27 Nov 2002 11:56:32 -0800
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Bipolar stepper control
    >
    > Hi!
    >
    > I'm new to stamp world. I'm looking for code to drive a bipolar
    > (4 wire) size 17 stepper motor. I've gotten the code for a unipolar
    > motor, but a bipolar motor needs different sequencing.
    >
    > Any help would be most appreciated!
    >
    > Thank you and Happy Thanksgiving, U.S.A. [noparse]:)[/noparse]
    >
    > Ron Yost
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    > of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-28 00:32
    At 12:26 PM 11/28/2002 +1300, you wrote:
    >Have a look at my web page on driving a stepper motor.
    >
    >It goes through some experiments I did in learning how to drive Stepper
    >motors.

    Thank you very much!!

    I also found this one:


    http://www.geocities.com/SiliconValley/Foothills/4312/html/BasicStamp/stepp
    rog.txt

    Hope this hasn't been posted here a zillion times already. [noparse]:)[/noparse]

    Thanks, everyone.

    Ron
Sign In or Register to comment.