PBASIC -2- Stepper Motor Driver -2- Stepper Motor

Hi,

I have a simple Parallax PBASIC program that will step the stepper motor in two directions using an Easy Stepper Motor Driver board. I want to learn more about doing single steps and microsteps before I invest in another 2A Stepper Motor Driver like the https://www.pololu.com/catalog/product/2134 or the https://www.pololu.com/catalog/product/2132 boards.

From looking at the control pins they are similar to the EAsy Stepper Motor Driver board I bought in Hong Kong for half-price.

Here’s my current code;

’ EasyStepperDrive-05.bs2
’ PIN 0 - DIR
’ PIN 1 - STEP
’ PIN 2 - MS1
’ PIN 3 - SLP
’ PIN 4 - MS2

’ {$STAMP BS2}
’ {$PBASIC 2.5}

’ Declare Variables
i VAR Word
j VAR Word

’ Main Body
DO
GOSUB forward
PAUSE 300
GOSUB back
PAUSE 300
LOOP

’ Subroutines
forward:
DEBUG CR, “back”, CR
FOR j = 1 TO 300
LOW 0 ’ Direction
’ HIGH 2 ’ MS1
’ HIGH 4 ’ MS2
PULSOUT 1, 1 ’ STEP
PAUSE 5
NEXT
RETURN

back:
DEBUG CR, “forward”, CR
FOR j = 1 TO 300
HIGH 0 ’ Direction
’ HIGH 2 ’ MS1
’ HIGH 4 ’ MS2
PULSOUT 1, 999 ’ STEP
PAUSE 5
NEXT
RETURN

END

I’ve been playing with the MS1 and MS1 pins but getting nothing … I’m stuck finding the loop I need to take one full step and one 1/8th step etc?

Once I can fully control my motors;
Stepper Motor - NEW
These were originally intended for use in ATM machines. New Old Stock.
Diebold Part Number: 49-006172
Dimensions: Shaft: 0.25 x 0.94 in.
Faceplate: 2.22 x 2.22 in. Length without shaft: 2.19 in.
Steps: 200 Holding Torque: 83.3
3.0 V 2.0 A DC
Continuous Duty
80 C Rise Class B
Connector is 2 rows by 6. Pin 1=x, 2=x, 3=BK, 4=W, 5=x, 6=x, 7=BL, 8=Y, 9=Gr, 10=R, 11=x, 12=x

Then I can be comfortable moving onto a more powerful driver board.

Brainless.org/ wperko@

Hi.

We do not have any experience with your boards, so we cannot really help you out, but if it operates like our DRV8824/DRV8825 carrier boards, you might need to drive the sleep pin (pin 3) high. Perhaps someone on the forum has some experience with your driver. Otherwise, you might have to get in touch with the manufacturer of the board to determine how it operates.

-Derrill

Hi,

Actually I now have steps and micro-steps figured out … the board does seem to be very similar to the Pololu boards and is why I’m looking at one of those to drive these 3V 2A motors I have.

OTOH, I still don’t know how to just tell the motor to spin at full speed … Got any ideas how that PBASIC line might look like?

I found that to make the motor take a dozen steps I needed to do a simple For/Next loop;

FOR i = 1 TO 50
LOW 0 ’ Direction
LOW 1
HIGH 1 ’ STEP
PAUSE 100
NEXT

For micro-steps;

FOR i = 1 TO 50
LOW 0 ’ Direction
HIGH 2 ’ MS1
HIGH 4 ’ MS2
LOW 1
HIGH 1 ’ STEP
PAUSE 100
NEXT

Now my last quest before spending more money is to get full speed spin of the motor …

“Full speed” for a given motor depends on lots of things (beginning with how quickly you toggle the step pin): the motor supply voltage, the load on the motor and how you accelerate the motor rotational velocity. As a first step, experiment with reducing the number following PAUSE.

Hi,

I hate these sort’a answers … but what I can gleam from your text is that the simple For/Next loop or a do/loop can step the motor around as fast as the motor will go from µController control …

Hence;
FOR i = 1 TO 10000
LOW 0 ’ Direction
LOW 1
HIGH 1 ’ STEP
NEXT

OR

DO
LOW 0 ’ Direction
LOW 1
HIGH 1 ’ STEP
LOOP

are the speed solutions for a BS2 based system … a much simpler answer albeit an incomplete answer to how stepper motors work.

Thanks for the hint …

www.brainless.org is listed by Google Safe Browsing as an attack page:

Hi,

Yeah, the last few days the hackers have been adding the Blackhole Exploit to my webpages, but the pages are clean again and the hole the hackers found is closed-up.

Sorry, but I just can’t stop the hackers myself … and this kind of attack is the kind of thing that is turning the web into a big buck money drain.

One of two bubbles will pop … either private websites will go away or the hackers will goto jail.

Hello. That’s too bad you are having trouble with your website. What hosting service are you using? You tried changing your password, right?

–David

Hi,

The website is cleaned and fixed now … after a couple of nasty calls to support they got off their butts and closed the hole.

OTOH, This is NOT the forum for website hacking …

See my D.A.I.R. kit … FREE downloading all the files too;

brainless.org/DAIR-Kit.html