Welcome to the Parallax Discussion Forums, sign-up to participate.

# stepper motors sequences

Posts: 47
edited 2010-11-16 - 04:56:59
Hey guys, trying to drive stepper motors
been on it for 3 days now.
I'm using the SX28.

I know, Ummm.... I think, the sequence for the parallax 12-Volt Unipolar Stepper Motor is some think like:

1 = %1000
2 = %1001
3 = %0001
4 = %0101
5 = %0100
6 = %0110
7 = %0010
8 = %1010

My stepper motors are

Can some one help with the sequences for my stepper motors or give me a link with some info.

SXlee.

• Posts: 47
edited 2010-10-12 - 11:01:12
SXlee wrote: »
Hey guys, trying to drive stepper motors
been on it for 3 days now.
I'm using the SX28.

The SX forum seems a little dead:skull:, is there a thread for stepper motors in parallax forums?

I fond this Full step sequence for the BI-POLAR(4 LEADS):
```    A-  B-   A   B
1  +   -    -   -
2  -   +    -   -
3  -   -    +   -
4  -   -    -   +
5  +   -    -   -
6  -   +    -   -
7  -   -    +   -
8  -   -    -   +

```
At:
http://members.home.nl/bzijlstra/hardware/stepper/stepper.htm

Is it possible to have a half step-sequence with a Bipolar stepper?
and what would the sequences be for the UNI/BI-POLAR(8 LEADS)?

SXlee.
• Posts: 2,300
edited 2010-10-12 - 12:23:58
It would help if you have a schematic to show how you have the motors connected to the SX processor and also some of the example code you are trying to drive them with.

As far as more info on steppers there is a ton out there on the web:

http://en.wikipedia.org/wiki/Stepper_motor

http://www.imagesco.com/articles/picstepper/01.html

A search on Google brings up some more....

http://lmgtfy.com/?q=stepper motor microcontroller
• Posts: 47
edited 2010-10-12 - 19:06:15
It would help if you have a schematic to show how you have the motors connected to the SX processor and also some of the example code you are trying to drive them with.

As far as more info on steppers there is a ton out there on the web:

http://en.wikipedia.org/wiki/Stepper_motor

http://www.imagesco.com/articles/picstepper/01.html

A search on Google brings up some more....

http://lmgtfy.com/?q=stepper motor microcontroller

Hi RobotWorkshop,

I don't have a schematic yet, I was thinking of doing some think like an Dual H-Bridge Configuration.

The code, may-be like this:
```Forward  inc Position      ;new forward location and desired motor coil state
call Step         ;lookup the new motor state
mov port,w        ;output the new motor coil state

Reverse  dec Position      ;new reverse location and desired motor coil state
call Step         ;lookup the new motor state
mov port,w        ;output the new motor coil state

Step     mov w,Position    ;get the new position
and w,#%0000_0011 ;pay attention only to least significant four states
add pc,w          ;jump into the table and return with the coil combination

Table00  retw %0000_0001   ;state 00 return with selected motor coil combination... can be any desired combination
Table01  retw %0000_0010   ;state 01 return with selected motor coil combination... can be any desired combination
Table10  retw %0000_0100   ;state 10 return with selected motor coil combination... can be any desired combination
Table11  retw %0000_1000   ;state 11 return with selected motor coil combination... can be any desired combination

'Code by: Peter (pjv)
'http://forums.parallaxinc.com/forums/default.aspx?f=7&m=147178
```

I would like full, 1/2, 1/4, & 8th Microstepping Resolution for the UNI/BI-POLAR(8 LEADS) and BI-POLAR(4 LEADS).
I thought I'd look in to the sequences be for looking in to the schematic for outputting sequences, but the more I learn, the more I realize what I don't know.

The first two links are very good, they expanded my knowledge a lot, the third I liked, but been searching on Google 4days now.

Regards, SXlee.
• Posts: 47
edited 2010-10-14 - 10:20:39
If a Full step sequence for the BI-POLAR(4 LEADS) is:
```    A-  B-   A   B
1  +   -    -   -
2  -   +    -   -
3  -   -    +   -
4  -   -    -   +
```

What would a "Half Step" look like?

and what would the Full step sequences be for the BI-POLAR(8 LEADS)?
```    A-  B-  C-  D-  A   B   C   D
```

SXlee.
• Posts: 2,300
edited 2010-10-15 - 08:46:48
I've always used the Unipolar motors in my projects so I can't really speak directly to the bi-polar motors. I do have some bi-polar motors and will eventually use them in a project.

I found a couple other sites that seemed to show a half-step sequence for these motors. Hopefully they will help:

http://www.stepperworld.com/Tutorials/pgBipolarTutorial.htm

http://www.piclist.com/techref/piclist/jal/drivingbipolarsteppermotors.htm

http://www.doc.ic.ac.uk/~ih/doc/stepper/control2/connect.html

http://www.8051projects.net/stepper-motor-interfacing/step-sequence.php

Robert
• Posts: 47
edited 2010-10-15 - 11:53:33
I've always used the Unipolar motors in my projects so I can't really speak directly to the bi-polar motors. I do have some bi-polar motors and will eventually use them in a project.

I found a couple other sites that seemed to show a half-step sequence for these motors. Hopefully they will help:
Robert

The links, all of them were very help-full.
I learnt a lot, and the 4 LEADS motors sequence is resolved for me.
I may not of found those links if it wasn't for you, so,
Thank you so much!!!.

I'm thinking it may be a good idea to kick this thread down to the Sandbox,
should I start a new thread? in the Sandbox?, It may/would, help others there.

:idea:Parallax Forums could do with a Public Forum "motors".:idea:

SXlee.
• Posts: 31
edited 2010-11-16 - 04:56:59
Here's what I have for a dual H Bridge (L293N type) controlled setup for a 4 wire Bipolar that I purchased from www.sciplus.com. the stepper isn't shown online, but I figured I'd post it up here for anyone that did grab it.

' {\$STAMP BS2}

' {\$PBASIC 2.5}

' Bipolar stepper motor drive code for DFRobot Dual H-Bridge V1.3 with a Parallax BS2.

' Stepper tested is Sciplus.com 2.4v, 1.8A 1.8Deg per step.

' Motor controller logic supply from BS2

' Motor Supply, (3) "D" Dry cells in series.

' This program uses about 7% of the BS2 ram.

'

'M1 and M2 select the direction of current flow

'E1 and E2 activate the current to the coils in the stepper.

'VD (logic supply) on motor controller connects to VDD (+5v) on the stamp.

'GND on motor controller connects to VSS (-) on stamp AND if you are

' using seperate motor supply, ground that at GND too.

'VS on motor controller connects to (+) of the motor supply you use.

'

'Pull the jumper "VD=VS" IF you are using a separate motor supply.

'I just hang the jumper ON one of it's pins so not to loose it.

'

'My motor supply is 3 D batts in series, even though my stepper is rated 2.4V,

'the controller needs about 4.5 to run the H Bridge circuitry.

'

'I/O pins are used to control direction and activation of the motor controller.

'Select any actual pins you wish just below after the CON statement.

P VAR Byte 'pause time between steps in ms

PB VAR Byte 'return pause time between steps

directiona CON 0 'pin 0 on BS2 connects to M1

directionb CON 1 'pin 1 on BS2 connects to M2

activea CON 2 'pin 2 on BS2 connects to E1

activeb CON 3 'pin 3 on BS2 connects to E2

X VAR Word 'just a variable for the loops below

P=50 'change this dwell time for a slower step rate. 5 is the least dwell that worked.

PB=5 'reverse rotation dwell time

AGAIN: 'Reference point to repeat the following forward/reverse cycle.

LOW 0

LOW 1

LOW 2

LOW 3

FOR X = 1 TO 50 'this is one revolution on a 1.8 deg stepper

'*******************************

'Note the sequence of directiona and directionb steps the motor forward or reverse

'Clockwise or Counterclockwise may depend on your actual connections

'Coil A and coil B leads can be deterimined by shorting two leads of the stepper

'with a paperclip or jumper wire.

'the motor will become hard to turn. Thus you can identify each coil's set of leads.

'*******************************

'1

LOW directiona

LOW directionb

HIGH activea

HIGH activeb

PAUSE P

LOW activea

LOW activeb

'2

HIGH directiona

LOW directionb

HIGH activea

HIGH activeb

PAUSE P

LOW activea

LOW activeb

'3

HIGH directiona

HIGH directionb

HIGH activea

HIGH activeb

PAUSE P

LOW activea

LOW activeb

'4

LOW directiona

HIGH directionb

HIGH activea

HIGH activeb

PAUSE P

LOW activea

LOW activeb

NEXT

PAUSE 1000

'SECOND HALF

FOR X = 1 TO 50 'REVERSE ROTATION, NOTE SEQUENCE OF directiona and directionb in the steps.

'1

LOW directiona

HIGH directionb

HIGH activea

HIGH activeb

PAUSE PB

LOW activea

LOW activeb

'2

HIGH directiona

HIGH directionb

HIGH activea

HIGH activeb

PAUSE PB

LOW activea

LOW activeb

'3

HIGH directiona

LOW directionb

HIGH activea

HIGH activeb

PAUSE PB

LOW activea

LOW activeb

'4

LOW directiona

LOW directionb

HIGH activea

HIGH activeb

PAUSE PB

LOW activea

LOW activeb

NEXT

PAUSE 1000

GOTO AGAIN

END