Controlling SEEEDStudio Motor Driver with AccelStepper Library/LabView Interface


I’m trying to make a stepper move a step and stop successively and quickly where data will be read while it is stopped by another device using LabView, a graphical coding environment (I’ve determined that this may not be that important based on my analysis of the issue but just in case…).

I am using a ST57H5605 stepper motor with a SEEEDStudio V.2. Motor Shield.

Using just examples from the Arduino Stepper.h library I was able to get the stepper to behave the way I wanted to using this code:

 * Stepper test for Seeed Motor Shield V2
 * loovee @ 15 Mar, 2016

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 200

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 11, 12, 13);

// the previous reading from the analog input
int previous = 0;

void step(int steps)
    digitalWrite(9, HIGH);
    digitalWrite(10, HIGH);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);

void setup()
    // set the speed of the motor to 30 RPMs
    pinMode(9, OUTPUT);
    pinMode(10, OUTPUT);
    digitalWrite(9, LOW);
    digitalWrite(10, LOW);

void loop()


However the LabView Interface for Arduino plugin for LabView uses the Accel Stepper Library which works differently. (See attached files).

From what I can tell, in the original code, the four stepper wires are defined in the “Stepper stepper(STEPS, 8, 11, 12, 13);” line, and then the enable/channel pins are both set to HIGH, and the stepper is then told to move the defined number of steps.

However the way the AccelStepper Library works (for the four-wire configuration at least), is that it just triggers the stepper pins directly without dealing with having to enable any channel pins (probably because this is unique to my stepper driver).

So I know I need to enable those channel pins before telling the stepper to move the designated number of steps. My problem is I don’t know how or where to do that, partially because of how many libraries there are and the nature of the LabView Interface for Arduino plugin.

This plugin seems to write certain commands to the serial port from the LabView program, which the Arduino reads in the form of command where x is some number that defines either the type of command, or the iteration, or an element in an array? I don’t know enough about Arduino coding to figure it out. (see LabVIEWInterface.ino)

My LabView board looks like this:

I’ve defined the 4 stepper pins according to the SEEED Motor Shield page, but there is nowhere for me to define the 2 enable channel output pins (9 and 10). I tried adding them to that array, but only the first four pins are ever parsed.

When running the original program that works, the lights on the motor driver blink from EB followed by the two IN indicators for each channel (3 lights flashing in quick succession for each channel).

When running the LabView program, the two IN lights flash for each channel but not the EB indicators (because they’re not being activated). I tried it with just the two enable pins (9 and 10), but then it just blinks the enable pins but the motor doesn’t move much. (sometimes it wiggles back and forth)

Any ideas on how to change the code in the AccelStepper library to do what I need? OR how to simply use the working code with LIFA (LabView Interface)?

Extra credit: I noticed when using the AccelStepper library (without the stepper, just having it count down the steps) that the step rate decreases very noticeably toward the end of the step cycle. This is not desired, and doesn’t occur in the original program. Acceleration was set to zero by default. When tried with non-zero acceleration, the same issue still happened. Dunno where to even start with this but if you think you have something let me know.

LabVIEWInterface.ino (23.5 KB)

AccelStepper.h (17.5 KB)

AccelStepper.cpp (11 KB)

LabVIEWInterface.h (7.45 KB)