HI, I have two stepper motors of Nema 17 (Bipolar, 1.8 degree, 0.4 Amp/phase, 30 ohms/phase, 12-24 V, 26 Ncm). Is it possible to run these two stepper motors using one Adafruit Motor Shield V2 for Arduino? FYI, I need to run my motors in different speed profile. I am a bit confused about the word "Shield". Is it just a "driver" or combined form of "driver & controller". If it is just a driver then, I also have to buy an Arduino UNO board. Right? Would you please help me to clarify the confusion? I'm new in this area.
Early reply would be highly appreciated. Thank you!
http://www.omc-stepperonline.com/nema-1 ... p-166.html
Adafruit Motor Shield V2 for Arduino
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Adafruit Motor Shield V2 for Arduino
.4 per phase with 2 phases driven is .8A and the shield is rated at 1.2A so you should be OK there. The shield requires a microcontroller and the easiest way to do that is add an Arduino UNO to your order.You will also need a 12v power supply for the motors.
- khondoke
- Posts: 15
- Joined: Thu Aug 28, 2014 5:39 pm
Re: Adafruit Motor Shield V2 for Arduino
Hi Franklin, Thank you very much!
Did you consider that the motors have to be run with different speed? If so, you are telling that I can run both stepper motors in different speed profile with one Arduino UNO, one Adafruit Motor Shield V2 for Arduino and power supply. Right? Is the motor connection parallel? Or, series?
If parallel then total required current = (0.4/phase x 2 phase) x 2 motors =1.6A. Is it? Please confirm me once again that two motors will be okay with this shield.
Is AC Adapter (Rated output: 11-13.5V, 3.82-3.11Amp, Max. 42 W) enough as power supply?
Finally, could you please send me the instructions/photo/diagram on the complete wiring of Arduino UNo, Adafruit Motor Shield V2 and two motors with power connections? That would be awesome!!!
Have a wonderful day...
Did you consider that the motors have to be run with different speed? If so, you are telling that I can run both stepper motors in different speed profile with one Arduino UNO, one Adafruit Motor Shield V2 for Arduino and power supply. Right? Is the motor connection parallel? Or, series?
If parallel then total required current = (0.4/phase x 2 phase) x 2 motors =1.6A. Is it? Please confirm me once again that two motors will be okay with this shield.
Is AC Adapter (Rated output: 11-13.5V, 3.82-3.11Amp, Max. 42 W) enough as power supply?
Finally, could you please send me the instructions/photo/diagram on the complete wiring of Arduino UNo, Adafruit Motor Shield V2 and two motors with power connections? That would be awesome!!!
Have a wonderful day...
- Franklin97355
- Posts: 23940
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Adafruit Motor Shield V2 for Arduino
Take a look at This Page for some help. You would hook one motor to M1/M2 and the other to M3/M4
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit Motor Shield V2 for Arduino
Each motor is individually controllable. There are a total of 4 H-bridges on the shield - 2 for each stepper. Your 42W power supply should be plenty to power those motors.Did you consider that the motors have to be run with different speed? If so, you are telling that I can run both stepper motors in different speed profile with one Arduino UNO, one Adafruit Motor Shield V2 for Arduino and power supply. Right? Is the motor connection parallel? Or, series?
- tadkomas
- Posts: 5
- Joined: Fri Aug 29, 2014 6:28 am
Re: Adafruit Motor Shield V2 for Arduino
Hello,
I am also using freat Adafruit Motor Schield V2 for Arduino. I cann't figure out how to energize stepper motor on starting up Arduino. I have a camera slider and I need that when it power jack plugged stepper motor would hold on. Can you give me some brief code of arduino for this case?
Tadas
I am also using freat Adafruit Motor Schield V2 for Arduino. I cann't figure out how to energize stepper motor on starting up Arduino. I have a camera slider and I need that when it power jack plugged stepper motor would hold on. Can you give me some brief code of arduino for this case?
Tadas
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit Motor Shield V2 for Arduino
@tadkomas - Have you run the "StepperTest" example fom the library?
If that does not work, please start a new thread and post photos showing your soldering and connections to the shield.
If that does not work, please start a new thread and post photos showing your soldering and connections to the shield.
- tadkomas
- Posts: 5
- Joined: Fri Aug 29, 2014 6:28 am
Re: Adafruit Motor Shield V2 for Arduino
For sure I have tested. I have also programs running with your motor shield V2. Just a question how to power up arduino and to keep stepper motors on hold(some simple function). As I understand by default its released.
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit Motor Shield V2 for Arduino
@tadkomas - please start a new thread with your question.
- khondoke
- Posts: 15
- Joined: Thu Aug 28, 2014 5:39 pm
Re: Adafruit Motor Shield V2 for Arduino
Hi, I am now trying to run two stepper motors with different speed for only specific number of step with the help of Adafruit Motor Shield v2 adn Aruino UNO . So, I modified the program from Adafruit example like this:
But unfortunately, it doesn't work. The motors are not running at all. :(
Would you please check the code and help me correct that one? One last thing, I don't want to run them backward. I need only forward running. I tried to do that by commenting out void backward step (), but it dosn't work. Please suggest me.
Thank you very much.
Code: Select all
#include <AccelStepper.h>
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myStepper1 = AFMS.getStepper(200, 1);
Adafruit_StepperMotor *myStepper2 = AFMS.getStepper(200, 2);
void forwardstep1()
{
myStepper1->onestep(FORWARD, MICROSTEP);
}
void backwardstep1()
{
myStepper1->onestep(BACKWARD, MICROSTEP);
}
void forwardstep2()
{
myStepper2->onestep(FORWARD, MICROSTEP);
}
void backwardstep2()
{
myStepper2->onestep(BACKWARD, MICROSTEP);
}
AccelStepper stepper1(forwardstep1, backwardstep1);
AccelStepper stepper2(forwardstep2, backwardstep2);
void setup()
{
AFMS.begin();
stepper1.setSpeed(25);
stepper1.moveTo(5000);
stepper2.setSpeed(50);
stepper2.moveTo(3000);
}
void loop()
{
if (stepper1.distanceToGo() == 0)
stepper1.moveTo(0);
if (stepper2.distanceToGo() == 0)
stepper2.moveTo(0);
stepper1.run();
stepper2.run();
}
Would you please check the code and help me correct that one? One last thing, I don't want to run them backward. I need only forward running. I tried to do that by commenting out void backward step (), but it dosn't work. Please suggest me.
Thank you very much.
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit Motor Shield V2 for Arduino
Do the motors work with the un-modified Accel_MultiStepper example code?
- khondoke
- Posts: 15
- Joined: Thu Aug 28, 2014 5:39 pm
Re: Adafruit Motor Shield V2 for Arduino
Thanks. Yes, those examples are working well with my motors. After so many trial, my motors now are running simultaneously with different speed. I changed the running program from "stepper1.run()" to "Astepper1.runSpeed()". Anyway, now it's working.
But still I have another problem. I need to run them for a specific length/steps. I used "Astepper1.moveTo()" this program, but it doesn't work. Please have a look on the following program. The motors run and do not stop running. Can you please help me to run them for only specified number of steps? One last thing is, when I change step type from "SINGLE" to "MICROSTEP", they run in microstep mode but do not change their speed even thought I change rpm. Please have a look on this:
Thank you.
But still I have another problem. I need to run them for a specific length/steps. I used "Astepper1.moveTo()" this program, but it doesn't work. Please have a look on the following program. The motors run and do not stop running. Can you please help me to run them for only specified number of steps? One last thing is, when I change step type from "SINGLE" to "MICROSTEP", they run in microstep mode but do not change their speed even thought I change rpm. Please have a look on this:
Code: Select all
#include <AccelStepper.h>
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
#define RPM1 50
#define RPM2 100
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port # 1 & 2
Adafruit_StepperMotor *myStepper1 = AFMS.getStepper(200, 1);
Adafruit_StepperMotor *myStepper2 = AFMS.getStepper(200, 2);
// you can change these to DOUBLE or INTERLEAVE or MICROSTEP!
void forwardstep1() {
myStepper1->onestep(FORWARD, SINGLE);
}
void backwardstep1() {
myStepper1->onestep(BACKWARD, SINGLE);
}
void forwardstep2() {
myStepper2->onestep(FORWARD, SINGLE);
}
void backwardstep2() {
myStepper2->onestep(BACKWARD, SINGLE);
}
AccelStepper Astepper1(forwardstep1, backwardstep1); // use functions to step
AccelStepper Astepper2(forwardstep2, backwardstep2);
void setup()
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Two steppers test!");
AFMS.begin(); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz
Astepper1.moveTo(1000);
Astepper1.setSpeed(RPM1);
Astepper2.moveTo(1500);
Astepper2.setSpeed(RPM2);
}
void loop()
{
Astepper1.runSpeed();
Astepper2.runSpeed();
}
- adafruit_support_bill
- Posts: 88153
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit Motor Shield V2 for Arduino
I don't use AccelStepper, so I' not sure why MoveTo is not working for you. But the speed issue is a limitation of the i2c bus speed. This limits the maximum aggregate step rate for all motors. You can increase the bus speed from 100KHz to 400KHs, but with 200-step motors, you will still not be able to achieve 50RPM wth two motors in microstep mode.
This thread discusses the issue in depth and shows a few ways to optimize for speed.
This thread discusses the issue in depth and shows a few ways to optimize for speed.
Please be positive and constructive with your questions and comments.