Stepper Motors

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply

Please rate this article out of 5: (1 being the worst and 5 being the best)

1
0
No votes
2
0
No votes
3
0
No votes
4
1
25%
5
3
75%
 
Total votes: 4

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Stepper Motors

Post by Sean »

Image

Stepper motors
Stepper motors provide one of the best solutions for driving mechanical loads where precise control of speed and/or position are required.
Most standard stepper motors can be powered in one of four phases, each represented by the presence or polarity of the current flow in each of the motor coils.

Phases
Each phase has:
• One neighbouring phase that represents a small angular movement in one direction
• One neighbouring phase that represents a small angular movement in the opposite direction
• A third alternative phase that represents an illegal transition.

The angular movement represented by a 'step' is determined by the mechanical construction of the motor.

Applying a single (legal) phase change to the motor drive will cause the motor shaft to move by a single step angle and stop. Sequencing through the states in the appropriate order produces continuous rotation of the drive shaft. The frequency of the phase changes is a precise measure of the speed of rotation of the motor shaft. A count of the phase changes (incremented in one direction, decremented in the other) provides a precise representation of the position or angle of rotation.

Motor types
The two main types of stepper motor under consideration are:
• uni-polar (6-wire) 1 wire each from 4 coils + 2 common connections
• bi-polar (4-wire) 2 wires each from 2 coils

Image

The diagrams above show the drive sequence required to turn a very basic, 4 step per revolution, stepper motor through a single revolution.
Legal phase changes are those that move from any phase to either of its neighbours (first and last are neighbours). The most efficient direction of rotation is clearly defined in these cases.
Illegal phase changes are those that involve jumping to a non-adjacent phase, rotation in either direction is equally likely.

In practice, a greater number of magnetic poles are used so the four step sequence will move the motor shaft through a much smaller angle. The bi-polar stepper motor supplied as part of the Locktronics range has a resolution of 48 steps per revolution (7.5 degrees per step).

Half-stepping
Half-stepping can increase the resolution, torque, and maximum speed of a stepper motor. This is achieved by creating control phases that are a combination of two adjacent mechanical phases

Image

The smoother transitions between mechanical phases can increase the available torque when running continuously and effectively doubles the angular resolution of the motor.

MIAC is capable of directly controlling bi-polar stepper motors. The full-bridge outputs also allow the MIAC to control uni-polar stepper motors with their common connections connected to either 0V or V+.

Flowcode Stepper Component
The Flowcode Stepper component can be configured to operate with motors connected in any of the listed configurations. Macros are provided are:

IncrementStep - One step in the forward directioj
DecrementStep - One step in the reverse direction
EnableMotor - Configure the device outputs
DisableMotor - Release the device outputs

These macros allow full control of the speed and position of a stepper motor from within a Flowcode program.

Example program
The example program linked to this article uses a MIAC to control the Locktronics bi-polar stepper motor in half-step mode. Four inputs and the LCD are used to demonstrate some of the capabilities of a stepper motor:

I1 drives the motor in its forward direction at constant speed.
I2 drives the motor in its reverse direction at constant speed.
I3 captures the current position of the motor and stores it as a reference.
I4 causes the motor to move to its captured reference position from any location.
The LCD continuously displays the current position of the stepper motor, and which of the eight half-step phases is currently being executed.

Alternative hardware
As an alternative to MIAC, the EB006 multi-programmer or HP488 development board can be connected to EB011 Power E-Blocks (up to 2 stepper motors per EB011 ), or EB022 Motors E-Blocks (1 stepper motor per EB022) to perform the same function. Check that the current and voltage specifications of these boards meet the requirements of the motors.
The Matrix Multimedia HPACT Actuators board contains a stepper motor and on-board drive circuitry, allowing direct interfacing to microcontroller port pins capable of supplying 5V logic levels.
Multiple instances of the Stepper component can be loaded onto each flowchart and the pins used for each motor can be freely allocated.

KeithSloan
Posts: 114
Joined: Fri Jul 27, 2007 10:50 am
Been thanked: 1 time
Contact:

Re: Stepper Motors

Post by KeithSloan »

This article is good as far as it goes. What it really need is some details on how to wire up the stepper motors
(unipolar & bipolar) to a EB011 power board so that Flowcode Stepper Component works. Or does the wiring not matter? can I just wire each of the four wires from a bipolar stepper to each of the four connectors on the board, without worrying which goes to which. Similarly for a unipolar but with both of the common wires going to either 0v or V+, does not matter which . Ideally I would like to see some commented assembler source, but I guess I should be able to get something from Flowcode.

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Stepper Motors

Post by Sean »

Here is a link to an example MIAC program using the Stepper component:
stepper control.fcf
(14.05 KiB) Downloaded 1828 times
Connection details depend on the equipment being used.

In the case of the MIAC, a bipolar motor should be connected with one coil across the A/B outputs, and the other coil across the C/D outputs. If the motor turns in the wrong direction, simply reverse the connections to one of the coils.

The case of the unipolar motors can be slightly more complicated (depending on how the coils are marked and physically arranged). Start by connecting the coils, in the order indicate in the data sheet, to the ABCD outputs of the MIAC (and the commons to a suitable supply voltage). If this does not work correctly, or a data sheet is not available, it is usually possible to sort out the connections by stepping the motor very slowly and determining the direction of movement for each step (use full stepping for this process). Incorrect movement during any step change should indicate the ciol connections to change.

When all connections are correct, continuous rotation in the desired direction should be achieved.

Post Reply