Serial Wombat Unipolar Stepper Mode
Note: The protocol for stepper motor mode has changed slightly
for version 2.0 and above. Users of previous versions should
download documentation specific to their version on the download
page.
The Serial Wombat can control up to 8 unipolar stepper motors
using 8 sets of four pins.
Using your Serial Wombat as a stepper motor controller is
easy! Just follow these simple steps:
- Build your interface hardware. The Serial Wombat is a
logic level device, and can't power stepper motors
directly. For high
current motors I typically tie the common wire to the
power supply, and use
logic level low-side MOSFETs to switch the coils. For
lower
current motors I often save a couple of bucks and use
a darlington
pair array.
- Tell the Wombat which pins are connected to the four
motor wire drivers.
- Tell the Wombat what to do: Spin one direction or the
other, or move the motor to a certain position. You can
select half steps for greater precision, full steps with
one coil to reduce current, or full steps with two coils
to increase torque.
Repeat the above steps for up to 7 more unipolar stepper
motors
Each stepper motor requires at least two messages to
configure: message 200 and 201. Message 202 can be used after
initialization to move the motor to a new absolute position
without changing any other parameters.
Message 203 is used to allow the stepper motor to move in one
direction or the other until a digital input changes. This allows
the Wombat to automatically stop the motor if a limt switch is
used.
Message 204 is used to move the motor an arbitrary number of
steps clockwise or counterclockwise. This can be used without any
knowledge of absolute motor position.
Message 205 is used to specify the current motor position.
This command can be used to initalize the internal step count
within the Wombat, so that future absoulte position commands are
referenced from that number and the current position.
Message format:
| Data Sent to the Wombat: |
200 |
Pin # |
23 |
2nd Pin |
3rd Pin |
4th Pin |
Pin Level to energize each
coil |
Pin Level to deenergize each
coil |
| Meaning: |
Configure Pin First message |
Pin Number to be set to
Unipolar Stepper Mode |
Unipolar Stepper Mode |
Pin Number of the 2nd of 4
pins |
Pin Number of the 3rd of 4
pins |
Pin Number of the 4th of 4
pins |
0: Low
1: High
2: Input |
0: Low
1: High
2: Input |
| This message is echoed back by
the Wombat. |
| Data Sent to the Wombat: |
201 |
Pin # |
23 |
Mode: |
Step time: |
Step Method: |
Control Data |
Control Data |
| Meaning: |
Configure Pin Second message |
Pin Number to be set to
Unipolar Stepper Mode |
Unipolar Stepper Mode |
0: Off
1: Spin Clockwise (CW) with fixed delay
2: Spin Counterclockwise (CCW)with fixed delay
3: Spin CW with delay between steps determined by another
pin
4: Spin CCW with delay between steps determined by
another pin's public data
5: Move motor to position commanded by host
6: Move motor to position commanded by another pin's
public data |
Number of frames to delay
between steps for modes 1, 2, 5 and 6. Pin to control
delay for modes 3 and 4. |
0: Half Step
1: Full Step low current
2: Full Step High Torque |
In mode 5, the
position to which the motor should go. In mode 6, the
pin which commands the stepper motor's positon. (First
byte is 0, second byte is pin #)
|
| This message is echoed back by
the Wombat. |
| Data Sent to the Wombat: |
202 |
Pin # |
23 |
Control Data |
Control Data |
0x55 |
0x55 |
0x55 |
| Meaning: |
Configure Pin Third message |
Pin Number to be set to
Unipolar Stepper Mode |
Unipolar Stepper Mode |
In mode 5, the
position to which the motor should go. In mode 6, the
pin which commands the stepper motor's positon.
|
Unused |
Unused |
Unused |
| This message is echoed back by
the Wombat. |
| Data Sent to the Wombat: |
203 |
Pin # |
23 |
Zeroing pin |
Zeroing asserting state |
0x55 |
0x55 |
0x55 |
| Meaning: |
Configure Pin Fourth message |
Pin Number to be set to
Unipolar Stepper Mode |
Unipolar Stepper Mode |
If this pin is asserted, the
internal position counter will be reset to zero. 255 for
none. |
0: Low
1: High |
Unused |
Unused |
Unused |
| This message is echoed back by
the Wombat. |
| Data Sent to the Wombat: |
204 |
Pin # |
23 |
Direction |
Control Data High Byte |
Control Data Low Byte |
0x55 |
0x55 |
| Meaning: |
Configure Pin Fifth message |
Pin Number to be set to
Unipolar Stepper Mode |
Unipolar Stepper Mode |
0: Counter clockwise
1: Clockwise |
Number of steps
to move the motor. |
Unused |
Unused |
| |
| Data Returned From the Wombat: |
204 |
Pin # |
23 |
16 bit value indicating current positon |
16 bit value indicating final desired
position, based on the latest change request. |
Unused |
| Data Sent to the Wombat: |
205 |
Pin # |
23 |
Position Counter Value High
Byte |
Position Counter Value Low
Byte |
0x55 |
0x55 |
0x55 |
| Meaning: |
Configure Pin 6th message |
Pin Number to be set to
Unipolar Stepper Mode |
Unipolar Stepper Mode |
16 bit value to
which the internal counter should be set. |
Unused |
Unused |
Unused |
| This message is echoed back by
the Wombat. |
The pin assigned to Unipolar Stepper Mode provides the current
step position as its public data.
Examples:
Configure pins 33,34,35, and 36 to drive a unipolar Stepper
Motor Clockwise in half steps with a 4 frame delay between steps.
A darlington pair is being used to switch the motor, so drive a
pin high to energize a coil, and low to deenergize it.
200 33 23 34 35 36 1 0 ; Set pin 33 to Unipolar Stepper Mode
; Pins 34,35,36 are other pins
; Pin high to energize a coil
; Pin low to deenergize it.
201 33 23 1 4 0 0x55 0x55 ; Second configuration message, pin 33 to Unipolar stepper
; Mode 1 (Spin CW)
; 4 frames between steps
; Half Step (0)
; Last two bytes aren't used in this mode
Configure pins 33,34,35, and 36 to drive a unipolar Stepper
Motor Clockwise in full high torque steps with a delay determined
by pin 2's public data between steps. A darlington pair is being
used to switch the motor, so drive a pin high to energize a coil,
and low to deenergize it.
200 33 23 34 35 36 1 0 ; Set pin 33 to Unipolar Stepper Mode
; Pins 34,35,36 are other pins
; Pin high to energize a coil
; Pin low to deenergize it.
201 33 23 1 4 0 0x55 0x55 ; Second configuration message, pin 33
to Unipolar stepper
; Mode 1 (Spin CW)
; 4 frames between steps
; Half Step (0)
; Last two bytes aren't used in this mode
Background:
Check out this great tutorial
by Microchip on stepper motors.
|