Published using Google Docs
Stepper Motor - based on Pololu
Updated automatically every 5 minutes

Creative Commons (BY SA) licence granted by the authors. First published on Oct 25,  2012

Last Modified on Mai 23, 2014. Please keep us updated if you use this software and make improvements.

Authors: Tibi, Sean ,  James

Only SENSORICA logo is copyright. Content on this document is Creative Commons (BY SA)

Stepper motor driver based on Pololu chip

This is a co-creation document

If you contribute to this doc make sure you respect the Content rules


Characteristics of the Pololo chip

Control based on NI USB 6221 DAQ

LabView program for control with NI DAQ

Control based on LabJack

Hardware connections

LabView program for control with LabJack

Different modes of movement

Constant speed with high precision

Constant speed with lower precision

NMB stepper motor case

Haydon motor case

Characteristics of the Pololo chip

We are using the Pololu md09b A4988 chip. Open manual.

This driver can make the stepper motor move in fractions of a step.

Table 1.  A4988 pin descriptions

Pin

Description

EN

Enable. 0 = operation mode / 1 = outputs disabled.

MS1,2,3

Microstep selection. 111 for 1/16th step.

RST

Reset. 0 = reset mode / 1 = operation mode.

SLP

Sleep. 0 = sleep mode / 1 = operation mode. (1ms delay to wake up)

STEP

Step control. Low-to-High = 1 step.

DIR

Direction. 0 = 1 direction / 1 = the other direction

VMOT

12V analog supply (any +12V voltage regulator).

1,2,A,B

Coils of the motor

VDD

5V digital supply (any +5V voltage regulator)

GND

Ground

Digital inputs of A4988 can be connected to any digital output of the card. STEP is an exception; it has to be connected to one of the clock buffered digital output (89 or 91 on NI USB-6221).

In P0.6(71), 0 is the digital port number, 6 the line number, and 71 the global pin number. They are all indicated on the card.

Control based on NI USB 6221 DAQ

See more about this DAQ card

LabView program for control with NI DAQ

This section presents the LabView Motion instrument NI USB 6211 DAQ card. This module was built using the Instrument driver template for easy integration within the Modular LabView platform for measurement, control, data characterization, conditioning, and analysis, which was designed and built by Tibi. This platform is already used by two labs at McGill University - David Junker and Dilson Rassier, and by others. Thus, it is compatible with all other LabView programs made for this same platform, and makes the stepper motor easy to integrate with other physical instruments into more complex experimental systems.

The name of the Motion Instrument Driver is Motion_NI_DAQ_StepperMotorPololu_LV8.5.vi [ask Tibi]

The most important functions of the program are move and Jog.

The move command sets the motor in constant speed motion for a given number of steps, or for a given distance (linear or angular).

The Jog command sets the motor in continuous, constant speed motion, until the Stop button is pressed.  

NOTE: a detector can be placed at physical limits to stop the motor once it reaches these limits.

 

Both functions take into consideration the Speed, which can be in steps/sec, mm/sec (for linear motion), or deg/sec (for angular motion). The Calibration parameter is used to convert steps into mm (for linear motion), or deg (for angular motion).

For the Jog function we use the Gen Dig Pulse Train-Continuous.vi template/example for DAQmx (see LabView Help/Find Examples).

NOTE: this implementation has no encoder for the motor, therefore the program doesn’t know where the motor is. In other words, we’re running the motor in an open loop.

We could use a counter to count the number of pulses sent to the motor, by sampling from the counter out, but this would still not tell if the motor misses a step. With this implementation it is not possible to perform absolute motion in a reliable fashion.

For the move function we use Gen Dig Pulse Train-Finite.vi  emplate/example for DAQmx (see LabView Help/Find Examples).

Back diagram showing commands for the DAQ card for the move and Jog functions.

Control based on LabJack

Open the Labjack Doc

Hardware connections

PCB with Pololu side up

The other side of the PCB

The driver PCB on top of the LabJack DAQ. \

Wire LJ-driver colors:

  • Blue is EN (Enable)
  • Broun is STEP
  • White Brown is SLP (Sleep)
  • White Green is RST (Reset)
  • Broun VDD - digital supply 5V
  • Grey GND - for digital ports

Wire power supply to driver

  • ...

NOTE: Do not power ON the power supply before connecting the Pololu driver to the stepper motor!!

LabView program for control with LabJack

This section presents the LabView Motion instrument driver built for the U3-HV LabJack DAQ/control card. This module was built using the Instrument driver template for easy integration within the Modular LabView platform for measurement, control, data characterization, conditioning, and analysis, which was designed and built by Tibi. This platform is already used by two labs at McGill University - David Junker and Dilson Rassier, and by others. Thus, it is compatible with all other LabView programs made for this same platform, and makes the stepper motor easy to integrate with other physical instruments into more complex experimental systems.

The name of the Motion Instrument Driver is Motion_LJ_StepperMotorPololu_LV8.5.vi 

[ask Tibi]

The most important functions of the program are move and Jog.

The move command sets the motor in constant speed motion for a given number of steps, or for a given distance (linear or angular).

The Jog command sets the motor in continuous, constant speed motion, until the Stop button is pressed.  

NOTE: a detector can be placed at physical limits to stop the motor once it reaches these limits.

 

Both functions take into consideration the Speed, which can be in steps/sec, mm/sec (for linear motion), or deg/sec (for angular motion). The Calibration parameter is used to convert steps into mm (for linear motion), or deg (for angular motion).

Script

Commands are

Set (number of steps) can take positive and negative values, to move left and right.

The Move command will take in number of steps. Therefore, in the script you need to set number of steps before sending the command Move.

Example of script 

Motion_LJ_StepperMotorPololu_LV85.vi\Set number of steps 60

Motion_LJ_StepperMotorPololu_LV85.vi\Wait 1

Motion_LJ_StepperMotorPololu_LV85.vi\Move

Motion_LJ_StepperMotorPololu_LV85.vi\Wait 3

Motion_LJ_StepperMotorPololu_LV85.vi\Set number of steps -60

Motion_LJ_StepperMotorPololu_LV85.vi\Wait 1

Motion_LJ_StepperMotorPololu_LV85.vi\Move

Motion_LJ_StepperMotorPololu_LV85.vi\Wait 3

Different modes of movement - in development

Constant speed with high precision

See 2.9.1.7 - Frequency Output (Mode 7) in the LabJack manual

This mode generates a square pulse train at a predefined frequency.

For stopping the motion see 2.9.1.9 - Timer Stop Input (Mode 9) in the LabJack manual.

Constant speed with lower precision

This can be done using the Timed Loop structure in LabView, setup for high priority.

Example of timed loop in LabView.

Control based on Arduino

Coming soon from Felipe. Open his doc.

NMB stepper motor case

Used by Ivan for the CSA project

See online manual of the motor or manual from our database.

Haydon motor case

See video of the motor functioning.

Stepper motor

Stepper motor installed in the Micro Gym