How Can We Help?

Print

Move a stepper motor to several locations using the MotionOut function

 

Stepper Motors are continuous rotation motors. These motors have a defined number of steps per rotation. You control position and speed by telling the motor :

  • how many step
  • which direction

The number of wires differ, but control done by sending step and direction signals.

If you use stepper motors within their limits, they can be very accurate. They do not, however have any feedback to tell you they are at the location you specified. If your application needs this feedback you can add it with an encoder.

Using vBuilder’s MotionOut functions, you can control up to 3 Stepper Motors per PLC.

Stepper motor example

Wiring ACE to stepper motor

Your PLC will provide the step and direction pulses, and take care of any needed ramping up/down of speed.

You will need a Stepper Driver to interface between the PLC’s step and direction signals and the Stepper Motor.

Often the inputs to Stepper Drivers include differential pairs for Step and Direction, consisting of Step+, Step-, Dir+ and Dir-.

All ACE digital outputs are sinking transistor type, so they can make the negative connections (Step- and Dir-) in this arrangement and you’ll connect the positive connections (Step+ and Dir+) to the VDC voltage you’re using to power your PLC.

Below is an example showing this wiring.

The Stepper Driver may include other options like Enable.  These are often optional and can be controlled using an additional digital output.

PLC Programming for Stepper Motors

Start out by pressing the “Setup Hardware button”.

After selecting your hardware, you’ll make it to the Motion Setup page (shown below).  You will assign digital outputs to up to 3 stepper motors.  Each Motor requires a Step and Direction Pin.

Once you’ve configured your project for at least 1 Stepper Output, you’ll be able to use the MotionOut function.

Parameters are the following:

  • at which position you must move
  • at what rate to move
  • in which tag to store the current location

Optionally,

  • assign a soft start/stop length, telling it how long to take to reach the speed you specified in “Rate” field or to stop.

To control you’re motion, you’ll need 1 more tool: a compare decision block (shown below)

You’ll compare your “StoreCurrentLocation” Tag to your “Move motor to” value (or Tag).

When they are equal, you’ll know that your motion is completed.

Stepper Motor Programming Example

Here are the files used in this example : stepper_example.zip

This example is setup like a “State Machine”.  If this is a new concept to you, please check out our “State Machine” and other tutorials on our Support page

In this example, we tell the Stepper Motor to move a motor.  The program waits for a digital input to turn ON, then starts a sequence of movements.  The Motor will move:

  • to location 200
  • to location 0
  • to location 400
  • to location 0
  • to location 600

Note: OnTime should not be set within 3 microseconds or within 3 microseconds of the period.