Shop OBEX P1 Docs P2 Docs Learn Events
Is a BasicStamp2 fast enough to drive a bipolar stepper? — Parallax Forums

Is a BasicStamp2 fast enough to drive a bipolar stepper?

hotrodhotrod Posts: 14
edited 2009-04-03 03:59 in BASIC Stamp
I have a basicStamp2 driving a bipolar controller, Easydriver3v, and the motor is moving way too slow. My question, is the basic stamp pulses too slow of a frequency?

Should I buy a PWMpal to run the step pulses,or is that unnecessary?

Or, is the pulses I am sending with the stamp to fast making the stepper slip?

Comments

  • Don BuczynskiDon Buczynski Posts: 31
    edited 2009-04-01 20:05
    Based on your code, you have at·40 ms delay in each loop of the program caused by the two PAUSE 20 commands. You might try lowering the pause values which will increase the number of steps per second. If you experience step sync problems, try ramping the step pulses up/down using something similar to the following.

    StepClock······ PIN···· 6·············· ' Stepper chip step input
    StepMin········ CON···· 8·············· ' Minimum step delay
    StepMax········ CON···· 20············· ' Maximum step delay
    StepDelay······ VAR···· Byte··········· ' Step delay working location
    StepRamp······· VAR···· Byte··········· ' Ramp up/down point
    MoveSteps······ VAR···· Word··········· ' Working location

    Loop:
    ·· MoveSteps = 2000
    ·· GOSUB DoSteps························' Move stepper motor
    ·· PAUSE 1000
    ·· GOTO Loop

    '
    ' This code is called to position the turntable. MoveSteps contains the
    ' step count.
    '
    ' The variables StepDelay, StepRamp, StepMin, and StepMax are used to
    ' effect the delay between each step pulse. Stepping begins using StepMax
    ' (slowest motor rotation) and gradually decrease to StepMin (fastest
    ' motor rotation).·Toward the end·of the MoveSteps count, the delay
    ' period will begin increasing toward the StepMax value. This technique
    ' serves to smoothly ramp up/down the motor speed.

    DoSteps:
    ·· StepRamp = 0······················ ' Initialize speed ramp
    ·· StepDelay = StepMax··············· ' Set slowest motor speed
    ·· DO WHILE (MoveSteps > 0)
    ····· HIGH StepClock················· ' Pulse the step pin
    ····· LOW StepClock
    ····· MoveSteps = MoveSteps - 1······ ' Decrement MoveSteps value
    ····· PAUSE StepDelay
    ····· IF MoveSteps <= StepRamp THEN
    ········ StepDelay = StepDelay + 1··· ' Increase delay
    ····· ELSEIF StepDelay > StepMin THEN
    ········ StepDelay = StepDelay - 1··· ' Decrease delay
    ········ StepRamp = StepRamp + 1····· ' Increment slowdown point
    ····· ENDIF
    ·· LOOP
    ·· RETURN

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don Buczynski

    http://www.buczynski.com
  • hotrodhotrod Posts: 14
    edited 2009-04-02 05:09
    That definitely helps. The motor is moving much faster now., but not fast enough!

    I put the Step_min at 0 and the motor is still not as fast as I would like. I just noticed that it takes 1600steps/rev for 1.8degree stepper motor. The EasyDriver is running in an eighth-step wave, since 200 * 8 = 1600. I also, just read that the Easydriver is permanently set to eighth-step mode. DAM!!!!

    If, I need the motor to go faster would the PWMpal help?

    I think I might switch to a brush DC motor with a H-bridge to drive it. My project does not require the precision that the stepper can operate.
    Do you think this a bad Idea? Or, should I buy the PWMpal?



    Thank you so much for the help.
    I am really trying to understand how everything works together. It just takes time..........I wish I had more!!!!!!!
  • Don BuczynskiDon Buczynski Posts: 31
    edited 2009-04-02 19:36
    Not familiar with the PWMpal.

    I had similar issues with step speed in my application. Fortunately, I had some control over the gear ratios used with the stepper motor and device so was able to use a BS2. Pbasic is slow; the reason that the pulse to the stepper chip only needs 1 pause statement. If you are close to your needed rate, there are other BS2 chips that run faster; e.g. BS2px.· The only other thought would be to use·an external·pulse multiplier cuircuit; e.g. 1 pulse in, two pulses out.·There would be some loss in step resolution but you say that is not an issue in your project.

    A better choice might be to use the·propeller chip instead.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don Buczynski

    http://www.buczynski.com
  • FranklinFranklin Posts: 4,747
    edited 2009-04-03 01:31
    The PWMPal is for "pulse width" which is not what you need.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • hotrodhotrod Posts: 14
    edited 2009-04-03 03:59
    Thanks, so much, fellows!!!! I believe I am going to stick with what I have, because I do have the control over the gear ratio. I am just going to make my fly wheel a large diameter. This should compensate for the speed. Thanks again for all the help!!!!!!!!!!!!!!!!!!!!!!!
Sign In or Register to comment.