Shop OBEX P1 Docs P2 Docs Learn Events
stepper motor — Parallax Forums

stepper motor

just mejust me Posts: 7
edited 2009-05-25 13:52 in BASIC Stamp
hi I'm trYing to run 3 stepper motor with a basic stamp home work board and darlintons I'm only able to run one please any body help me with the code and conection

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-05-16 02:19
    You can't do it without additional parts. Show us your code and a drawing of how you plan to hook up the steppers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • just mejust me Posts: 7
    edited 2009-05-16 02:38
    i don't have a drawing the aplication that i need is just to rotate each stepper motor 10 time clockwise
    thanks
  • FranklinFranklin Posts: 4,747
    edited 2009-05-16 02:41
    So what is your code? A drawing would help if you can get one together. Tell us about the steppers, how are they powered how many wires?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • just mejust me Posts: 7
    edited 2009-05-16 20:59
    This was the code that I was using it work only for one motor but I need 3 motor

    File...... Stepper_27964.BS2
    ' Purpose... Simple Stepper Motor Demo
    ' Author.... Parallax, Inc. (Copyright (c) 2004, All Rights Reserved)
    ' E-mail.... support@parallax.com
    ' Started...
    ' Updated... 18 MAR 2004
    '
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    '
    ' =========================================================================


    '
    [noparse][[/noparse] Program Description ]
    '
    ' Simple stepper motor (Parallax #27964) demonstration rotates motor one
    ' full revolution clockwise, pauses, then rotates one full revolution
    ' counter-clockwise. After another short pause, the process repeats.
    '
    ' Connections:
    '
    ' P4 -> ULN2003.1, ULN2003.16 -> Phase 1 (Black)
    ' P5 -> ULN2003.2, ULN2003.15 -> Phase 2 (Orange)
    ' P6 -> ULN2003.3, ULN2003.14 -> Phase 3 (Brown)
    ' P7 -> ULN2003.4, ULN2003.13 -> Phase 4 (Yellow)
    '
    ' Note: Do NOT connect stepper motor wires directly to the BASIC Stamp.
    ' See Parallax documentation for complete connection schematic.


    '
    [noparse][[/noparse] Revision History ]


    '
    [noparse][[/noparse] I/O Definitions ]

    Phase VAR OUTB ' phase control outputs


    '
    [noparse][[/noparse] Constants ]


    '
    [noparse][[/noparse] Variables ]

    idx VAR Byte ' loop counter
    stpIdx VAR Nib ' step pointer
    stpDelay VAR Byte ' delay for speed control


    '
    [noparse][[/noparse] EEPROM Data ]

    Steps DATA %0011, %0110, %1100, %1001


    '
    [noparse][[/noparse] Initialization ]

    Setup:
    DIRB = %1111 ' make P4..P7 outputs
    stpDelay = 15 ' set step delay


    '
    [noparse][[/noparse] Program Code ]

    Main:
    FOR idx = 1 TO 48 ' one revolution
    GOSUB Step_Fwd ' rotate clockwise
    NEXT
    PAUSE 500 ' wait 1/2 second
    FOR idx = 1 TO 48 ' one revolution
    GOSUB Step_Rev ' rotate counter-clockwise
    NEXT
    PAUSE 500 ' wait 1/2 second
    GOTO Main
    END


    '
    [noparse][[/noparse] Subroutines ]

    ' Turn stepper clockwise one full step (7.5 degrees)

    Step_Fwd:
    stpIdx = stpIdx + 1 // 4 ' point to next step
    GOTO Do_Step


    ' Turn stepper counter-clockwise one full step (7.5 degrees)

    Step_Rev:
    stpIdx = stpIdx + 3 // 4 ' point to previous step
    GOTO Do_Step


    ' Read new step data and output to pins

    Do_Step:
    READ (Steps + stpIdx), Phase ' output new phase data
    PAUSE stpDelay ' pause between steps
    RETURN
  • vaclav_salvaclav_sal Posts: 451
    edited 2009-05-17 00:34
    Here is a simple modification to your code.
    The steppers are connected to ports A, B and C.
    And the Phase value ( original code ) is just copied to these ports.


    It does not do anything fancy. It runs all steppers in same fashion - forward and backwards.
    Of course you could run them independently·with some more changes to your code.
    You·could use array of Phase instead of individual port assigments.
    Have fun "coding".

    PS I use BS2E and have not changed the processor selection back to·yours.

    ·

    Whoops, I forgot to change the output direction!

    Unless there is a conflict just do DIRS = $FFFF

    Post Edited (vaclav_sal) : 5/17/2009 12:43:57 AM GMT
  • just mejust me Posts: 7
    edited 2009-05-17 01:06
    thanks
  • just mejust me Posts: 7
    edited 2009-05-24 04:04
    I'm trying the code that you gave me but it not working and I'm using one darlington ULN2803A for each motor Idont know if I'm conecting it rigth can you help me please
  • LeonLeon Posts: 7,620
    edited 2009-05-25 11:40
    Post the schematic!

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • Radridz3Radridz3 Posts: 49
    edited 2009-05-25 13:45
    Hears the code I used for a demo it uses DIRB,C,D.... I had a thread on hear asking for help on this 1 but it only ended up being a typo problem. Here's the link
  • Radridz3Radridz3 Posts: 49
    edited 2009-05-25 13:52
    Oops sorry forgot the code hear it is...>>>>
Sign In or Register to comment.