From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Interface for Arduino Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Adafruit Motor Shield Stepper Driver

Installation and Operation instructions for the

AdaFruitMotorShieldStepperDriver.VI

Introduction

This VI does not use the LIFA firmware.  Instead it

uses Labview's serial interface capability to communicate

with a sketch running on an Arduino Uno.  This VI is not

compatible with the Arduino Leonardo because a version of

the AfMotor library is not available for the Arduino Leonardo.  

Although the Adafruit Motor shield maybe used with up to 4 DC

motors this VI does not support the motor shield's DC motor

capability.

Note the following procedure assumes you have installed the

Adafruit Motor Shield on your Arduino Uno, connected one step

motor to Motor Ports M1 and M2 and connected the other step

motor to Motor Ports M3 and M4.  If not see the Adafruit Motor

Shield Documentation for additional information.

Installation Instructions

1.  Use 7zip to unpack "AdafruitMotorShieldStrepperDriver.7z".

If you don't have a copy of 7zip you can get a copy here.

<http://www.7-zip.org/>

2.  Move the AfMotor and TextFinder libraries to your Arduuino

IDE "libraries" folder.

3. Move the AdafruitStepperDriver sketch folder to your Arduino

sketch folder.

4. Move the AdafruitMotorShieldStepperDriver, X Running Sum and

Y Running sum VIs to your your collection of Labview examples folder.

5. Compile and download the AdafruitStepperDriver sketch to your

Adruino Uno.

Operating Instructions

6. Open the AdafruitMotorShieldAStepperDriver.VI.

7. On the front panel and set the serial Port to your Arduino

Uno's COM port

8. Run the VI.

9  Set the "X Steps Setpoint" and "Y Steps Setpoint" to the

number of steps you want the X and Y step motors to move.  

The step motor connected to M! and M2 is the X step motor.

and the step motor connected to M3 and M4 is the Y step motor.

10.  Click on the "Send" button to send the setpoint data to

the Arduino Uno and to start the motors stepping.

11. As required repeat steps 9 and 10.

12.  A negative "Steps Setpoint" will cause a step motor to

rotate in the opposite direction of a positive "Steps

Setpoint"

13.  The "X Step Position" and "Y Step Position" indicators

show how many steps the step motors have moved from their

starting position.

14.  To get back to the starting position multiply the "X Step

Position" and "Y Step Position" values by minus 1 and enter

these values into the their respective "X Steps Setpoint" and

"Y Steps Setpoint" controls and then click on "Send".

15.  To quit click on the "Stop" button.

Additional Comments.

The step motor speed was set to 10 RPM during the testing

phase.  If required you can set it to a higher value. 

Adafruit says they ave run the small step motors they sell

at 250 RPM.  Change the step motor speed by replacing "10"

in these two lines of code

   motor1.setSpeed(10);  // 10 rpm 

   motor2.setSpeed(10);  // 10 rpm 

in the AdafruitStepperDriver sketch to an appropriate value.

Four different stepping modes are available with the Adafruit

Motor shield.  They are SINGLE, DOUBLE. INTERLEAVE or MICROSTEP. 

Adafruit documentation says " "Single" means single-coil

activation, "double" means 2 coils are activated at once (for

higher torque) and "interleave" means that it alternates between

single and double to get twice the resolution (but of course its

half the speed). "Microstepping" is a method where the coils are

PWM'd to create smooth motion between steps."

To change the stepping mode replace "SINGLE in these two lines of

    motor1.step(steps1, dir1, SINGLE);

    motor2.step(steps2, dir2, SINGLE);

in the AdafruitStepperDriver sketch to one of the other 3 modes.

Capitalization is required.

Note if you want to reload the LIFA firmware on the Arduino Uno

you used with the Adafruit Motor Shield you will need to

temporarily nove the AfMotor library out of the Arduino

"libraries" folder. The LIFA firmware will not compile when the

Afmotor library is in the Arduino "libraries" folder.

The following components were used while testing this software.

Arduino Uno.

Assembled Motor Shield Expansion Board.  Source:

<http://www.ebay.com/itm/Motor-Drive-Shield-Expansion-Board-L293D

-For-Arduino-Duemilanove-Mega-UNO-/290700252856?pt=LH_DefaultDomain

_0&hash=item43af15d6b8>

12 volt DC power supply, Jameco # 2082134 ADAPTER,WALL,REG SW,

12VDC 2AMP

Stepper Motors See:

<http://adafruit.com/products/324>

Comments
DocMaly
Member
Member
on

Does your program work with v1.2 or v2.0 of the motor shield, or with both of them?

Thanks.

wiicuate
Member
Member
on

Did you ever made it work with V2.0 of the motor shield DocMaly?

Haadi
Member
Member
on

I have used this with Arduino Uno R3 +Adafruit v2.3 and it works fine

Ziakhan1990
Member
Member
on

I am also trying to use this with Arduino Uno R3 and Adafruit v2.3. However it doesn't work. I am using only one step motor (ports M3 and M4). Can I use the same arduino sketch and Labview code when I am using only one stepper motor.

 

 

Haadi
Member
Member
on

Yes you can use one stepper as well. I did try one and two steppers and it works fine in both cases. 

Chuckl71
Member
Member
on

Will the drivers work with the Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.3?

Contributors