MultiStepper Control

680 views
Skip to first unread message

Dar Bahatt

unread,
Feb 1, 2017, 3:21:23 PM2/1/17
to accelstepper
Hi-

I want to use your MultiStepper class to control 2 (4 wire) stepper motors.

I am using an Arduino Uno and the Adafruit Motor Shield V2.

Your MultiStepper.pde (link following) requires the PWM pin numbers the stepper motors are connected to.

According to Adafruit tech support there is no direct mapping of the Arduino PWM I/O pins
to the motor controller chips as the communication is done through an I2C chip.

Questions:
  1. Is it possible to run your sample code on the Arduino Uno and the Adaft motor shield?
  2. If yes, can you help with the pin mapping?
  3. If not can it be done with an Arduino Uno and two Adafruit TB6612 1.2A DC/Stepper Motor Driver Breakout Boards (https://www.adafruit.com/product/2448).
Best regards,
Dar Bahatt

Mike McCauley

unread,
Feb 4, 2017, 8:06:32 PM2/4/17
to accels...@googlegroups.com
See the example code in AFMotor_MultiStepper.pde


On Wednesday, February 01, 2017 12:21:23 PM Dar Bahatt wrote:
> Hi-
>
> I want to use your MultiStepper class to control 2 (4 wire) stepper motors.
>
> I am using an Arduino Uno and the Adafruit Motor Shield V2.
>
> Your MultiStepper.pde (link following) requires the PWM pin numbers the
> stepper motors are connected to.
> http://www.airspayce.com/mikem/arduino/AccelStepper/MultiStepper_8pde-exampl
> e.html
>
> According to Adafruit tech support there is no direct mapping of the
> Arduino PWM I/O pins
> to the motor controller chips as the communication is done through an I2C
> chip.
>
> Questions:
>
> 1. Is it possible to run your sample code on the Arduino Uno and the
> Adaft motor shield?
> 2. If yes, can you help with the pin mapping?
> 3. If not can it be done with an Arduino Uno and two Adafruit TB6612
> 1.2A DC/Stepper Motor Driver Breakout Boards (
> https://www.adafruit.com/product/2448).
>
> Best regards,
> Dar Bahatt

--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com
Phone +61 7 5598-7474

Dar Bahatt

unread,
Feb 5, 2017, 11:23:02 AM2/5/17
to accelstepper
I tried this sample code. It doesn't guarantee that the stepper motors will arrive at their final position
at the same time especially if each is commanded to move a different number of steps.

See following link for discussion on this issue: https://forum.arduino.cc/index.php?topic=418381.0

Mike McCauley

unread,
Feb 5, 2017, 3:16:15 PM2/5/17
to accels...@googlegroups.com
You sill need to combine the example code with the use of the AccelStepper
MultiStepper class in order to get the two steppers to arrive at the same
time.

Cheers.

Dar Bahatt

unread,
Feb 5, 2017, 5:14:29 PM2/5/17
to accelstepper
With the Arduino MotorShield it is not possible to define the PWM pins the motors are connected to.

Question 1:

So what you suggest is to replace the following motor setup commands (in MultiStepper example):
AccelStepper stepper1(AccelStepper::FULL4WIRE, 2, 3, 4, 5);
AccelStepper stepper2(AccelStepper::FULL4WIRE, 8, 9, 10, 11);

With the setup commnads from AccelStepper example:
AccelStepper stepper1(forwardstep1, backwardstep1);
AccelStepper stepper2(forwardstep2, backwardstep2);


Question 2:

In the MultiStepper example you move the motors to an absolute location using:
steppers.moveTo(positions);

Is it possible to move the motors relative and not absolute?

Thanks,
Dar

Dar Bahatt

unread,
Feb 5, 2017, 6:27:35 PM2/5/17
to accelstepper
Also in the AFMotor_MultiStepper.pde it is explicitly mentioned that it won't work with
the Adafruit Motor Shield V2 that I'm using... 

// AFMotor_MultiStepper.pde
// -*- mode: C++ -*-
//
// Control both Stepper motors at the same time with different speeds
// and accelerations.
// Caution, does not work with Adafruit Motor Shield V2
// for examples that work with Adafruit Motor Shield V2.

Mike McCauley

unread,
Feb 6, 2017, 10:48:23 PM2/6/17
to accels...@googlegroups.com, Dar Bahatt
Than I think you should look at the Adafruit examples for AccelStepper at:

https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/install-software

Where there is a specific example for multiple V2 steppers.

Chers.
Reply all
Reply to author
Forward
0 new messages