1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Basic stepper control - PIC18F and L293D

Discussion in 'Robotics & Mechatronics' started by jshayden, Apr 6, 2006.

  1. jshayden

    jshayden New Member

    Joined:
    Apr 6, 2006
    Messages:
    6
    Likes:
    0
    Ok... I'm not trying to do anything complex. No microstepping/current limiting, etc. All I need is basic movement: foward, reverse, and turning. I am using bipolar steppers and the circuit shown below. I am having trouble with the sequence, though. The motors move, but the direction seems arbitrary, and can be forced to reverse by grabbing the wheel attached to the shaft. The torque is ridiculously low.

    Any ideas?
     

    Attached Files:

  2. Papabravo

    Papabravo Well-Known Member

    Joined:
    Mar 9, 2006
    Messages:
    2,889
    Likes:
    25
    Location:
    Michigan, USA (GMT-5)
    It sounds like you have no idea what kind of motors you have and how they are wound.

    How many wires are coming out of the motor?
    The top guess is four
    The next best guess is five
    Any other number is trouble

    If the answer is four then it is a bipolar motor and you will need a different driving arrangement. If it is five then all five wires have to go somewhere.
     
  3. jshayden

    jshayden New Member

    Joined:
    Apr 6, 2006
    Messages:
    6
    Likes:
    0
    I know the arrangement exactly. There are 4 (as shown in the schematic) and they ARE bipolar (as previously stated). And.. I've seen this arrangement used to control bipolar steppers before, I simply am confused with the pulsing, I believe.

    Josh
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Papabravo

    Papabravo Well-Known Member

    Joined:
    Mar 9, 2006
    Messages:
    2,889
    Likes:
    25
    Location:
    Michigan, USA (GMT-5)

    The motor has four wires as shown in the schematic, that's good. Now you have to connect the phases as the L293 expects. If you dont know which pair of wires goes to one of the two phases then you need to find it with an ohmmeter.

    Also the L293 needs to supply both voltage and current to the motor. If the motor needs more current than the L293 can supply then you will have trouble making the motor move or producing enough holding torque so you cannot move the shaft by hand.

    I'll have a look at the data sheet.
     
  6. jshayden

    jshayden New Member

    Joined:
    Apr 6, 2006
    Messages:
    6
    Likes:
    0
    Ok. I have recently switched motors.
    The new motors are ABCD while the old (as on the schematic) were ACBD [where AB are 1 coil and CD are the other].
    This problem is easily solved by making up a little cable and twisting the wires. That's not a problem.
    The problem I'm having is the pulsing sequence, and possibly this current issue. Thanks for bringing that up. The motors ar rated at 0.42A, by the way.

    Thanks Alot,
    Josh
     
  7. jshayden

    jshayden New Member

    Joined:
    Apr 6, 2006
    Messages:
    6
    Likes:
    0
  8. Papabravo

    Papabravo Well-Known Member

    Joined:
    Mar 9, 2006
    Messages:
    2,889
    Likes:
    25
    Location:
    Michigan, USA (GMT-5)
    Bipolar Stepper Sequence

    You want to alternate the coils and the direction in each coil. The following table may be helpful

    http://www.eio.com/jasstep.htm#types

    Is there a reason why you don't show GROUND connected to pins 4, 5, 12, and 13 on your schematic?

    Are you sure the battery can supply the load at its rated voltage? Put a scope on the L293 pin 8 and watch the battery votage sag if the current demand is to large.
     
  9. jshayden

    jshayden New Member

    Joined:
    Apr 6, 2006
    Messages:
    6
    Likes:
    0
    Ok.. I've seen several tables like this. I understand the concept of pulsing the coils according to the chart with +/-'s. I guess what I don't understand is the input to the hbridge. I'm unsure of what combination of 1's and 0's to use when pulsing the hbridge itself. The hbridge table only gives...

    A B 1a 1b
    0 0 0 0
    0 1 - +
    1 0 + -
    1 1 0 0


    But, when describing how to pulse the motor, ++ and -- are used.

    Maybe I'm reading something wrong?

    Thanks,
    Josh


    EDIT: Oh, I think I see. 1 hbridge per coil = 2 hbridges per motor, which the L293 provides. I should be able to figure out the sequence from there. The real question is, I'm pretty sure I tried that sequence, and I'm still having the torque issue.
     
  10. Papabravo

    Papabravo Well-Known Member

    Joined:
    Mar 9, 2006
    Messages:
    2,889
    Likes:
    25
    Location:
    Michigan, USA (GMT-5)
    Stepper Motor Symbols

    The notation ++ or -- means both ends of the coil need to be at the same potential. If both ends of the coil are at the same potential then it does not matter what the potential is - no current will flow.

    Each input/output pin on the L293 can connect one end of one coil to either the positive supply on pin 8, or GROUND on pins 4, 5, 12, 13
    If you arrange things correctly then you should be able to step by changing only two lines at a time, from some convenient initial condition.

    Establishing an initial condition on a stepper with an unknown orientation often causes a small movement from where it is to the new holding position.
     
  11. jshayden

    jshayden New Member

    Joined:
    Apr 6, 2006
    Messages:
    6
    Likes:
    0
    Ok. It's working great! The old motors must just be crap.

    Thanks so much for your help. I certainly have a better understanding of what's actually going on now.

    Josh
     
  12. Papabravo

    Papabravo Well-Known Member

    Joined:
    Mar 9, 2006
    Messages:
    2,889
    Likes:
    25
    Location:
    Michigan, USA (GMT-5)
    No problem. I'm glad I was able to help.
     
  13. jiadong

    jiadong New Member

    Joined:
    Dec 1, 2014
    Messages:
    1
    Likes:
    0
    hi, jshayden. could you show us how your table looks like? because i have problems as you had.
     
  14. alec_t

    alec_t Well-Known Member Most Helpful Member

    Joined:
    Jul 10, 2011
    Messages:
    9,255
    Likes:
    1,218
    Location:
    Cardiff, Wales
    Welcome to the forum!
    I doubt you will get a reply. You have hijacked an 8-year old thread :(.
     

Share This Page