Arduino and Adafruit stepper motor

Hi, having trouble getting FIT0349 stepper to work Arduino UNO Adafruit motor shield running 12v. Can anyone point me in the right direction please

I suspect the Adafruit does not have enough current to operate the stepper. Can I use Mosfets using the Adafruit as the trigger to running the stepper?

1 Like

1 Like

1 Like

1 Like

Adafruit motor shield runs 4 x 12v relays to operate the actuator in and out
need to run stepper on same board for timing purposes.

other boards run ultrasonic sensor to turn 5th relay on or off to turn all power off when out of velcro

1 Like

stepper motor connections

Hi Paul,

Welcome to the forums :slight_smile:

I assume you’re using this motor shield?

This should be able to power that stepper just fine - it only draws 1.0A per phase, while the motor shield is capable of 1.2A RMS, 3A peak. Just note that due to the gearbox, you’ll need to drive the stepper much further than you used to due to the gearbox ratio of 5.18:1.

I’m grabbing stock from shelf at the moment to get it set up and working.

Could you post up the code you’re using to drive the stepper?

#include <AccelStepper.h>
#include <AFMotor.h>
#include <Stepper.h>

AF_Stepper motor(200,1);


AF_DCMotor actin(3);
AF_DCMotor actout(4);



void setup() {
 
motor.setSpeed(10);  // 10 rpm   

  motor.step(100,FORWARD,INTERLEAVE); 
  motor.release();



  

 actin.setSpeed(255);
 actin.run(RELEASE);

 actout.setSpeed(255);
 actout.run(RELEASE);

 

  
delay(1000);
}


void loop() {

  uint8_t i;


  
  motor.step(200,FORWARD,INTERLEAVE); 
  delay(2000);

  
  actin.run(FORWARD);
  delay(1700);
  actin.run(RELEASE);

  delay(1000);
  

  actout.run(FORWARD);
  delay(1700);
  actout.run(RELEASE);

  delay(1000);

}
1 Like

TA0066

This is the shield I am using

Any luck Oliver?

Still working on it. A bit of fiddling around to get it hooked up without soldering. Sorry, just doing this in between other jobs and helping other customers too.

1 Like

just ordered 2 x Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.3
will give them a go

Hi Paul,

I’ve got it hooked up and working, but it turns out the Adafruit motorshield is not a chopper driver, it’s basically only a simple H bridge. If you try and drive the FIT0349 stepper from the Adafruit motor shield at 12v they won’t last very long!

FYI, I’ve put your order on hold 'til we can get this sorted :slight_smile:

Oh ok, I will wait to hear back from you :grinning:

Hi Paul,

Here’s a constant current stepper driver that’s going to much simpler to setup and use.

I’ve modified the DF Robot example for this board just to make the stepper spin back and forth.

/*
This sample code is for testing the 2 stepper motors
The rotation velocity can be adjusted by the code switch
Microcontroller: Arduino UNO
*/
int M1dirpin = 7;  //Motor X direction pin
int M1steppin = 6; //Motor X step pin
int M1en=8;  //Motor X enable pin
int M2dirpin = 4;  //Motor Y direction pin
int M2steppin = 5; //Motor Y step pin
int M2en=12;  //Motor Y enable pin

void setup()
{
  pinMode(M1dirpin,OUTPUT);
  pinMode(M1steppin,OUTPUT);
  pinMode(M1en,OUTPUT);
  pinMode(M2dirpin,OUTPUT);
  pinMode(M2steppin,OUTPUT);
  pinMode(M2en,OUTPUT);

  digitalWrite(M1en,LOW);// Low Level Enable
  digitalWrite(M2en,LOW);// Low Level Enable

}

void loop()
{
    int j;
  delayMicroseconds(2);
  digitalWrite(M1dirpin,LOW);
  digitalWrite(M2dirpin,LOW);
  for(j=0;j<=1200;j++){
    digitalWrite(M1steppin,LOW);
    digitalWrite(M2steppin,LOW);
    delayMicroseconds(2);
    digitalWrite(M1steppin,HIGH); //Rising step
    digitalWrite(M2steppin,HIGH);
    delay(1);
  }
    delayMicroseconds(2);
  digitalWrite(M1dirpin,HIGH);
  digitalWrite(M2dirpin,HIGH);
  for(j=0;j<=1200;j++){
    digitalWrite(M1steppin,LOW);
    digitalWrite(M2steppin,LOW);
    delayMicroseconds(2);
    digitalWrite(M1steppin,HIGH); //Rising step
    digitalWrite(M2steppin,HIGH);
    delay(1);
  }
}

And here it is running:

You may also like to try this higher power TB6600 Constant Current Stepper Driver. It’s much more powerful, but will only run one stepper motor:

Here’s a link to a video of it driving that Stepper as well:

And here’s the code I used to get it running (Note that I had it set to do full steps - no microstepping:

int PUL=7; //define Pulse pin
int DIR=6; //define Direction pin
//int ENA=5; //define Enable Pin (Not actually necessary)
int delayt=500;
void setup() {
  pinMode (PUL, OUTPUT);
  pinMode (DIR, OUTPUT);
  //pinMode (ENA, OUTPUT);
}

void loop() {
  for (int i=0; i<1200; i++)    //Forward 1200 steps
  {
    digitalWrite(DIR,LOW);
    //digitalWrite(ENA,HIGH); //Not actually necessary
    digitalWrite(PUL,HIGH);
    delayMicroseconds(delayt);
    digitalWrite(PUL,LOW);
    delayMicroseconds(delayt);
  }
  
  for (int i=0; i<1200; i++)   //Backward 1200 steps
  {
    digitalWrite(DIR,HIGH);
    //digitalWrite(ENA,HIGH); //Not actually necessary
    digitalWrite(PUL,HIGH);
    delayMicroseconds(delayt);
    digitalWrite(PUL,LOW);
    delayMicroseconds(delayt);
  }
}

Note that if you set the delay time too short (ie. try to spin the stepper too fast) it won’t keep up. I found about 400 microseconds was as fast as it could do with the stepper unloaded.

If you’d like to make any changes to your order, please reply to your order confirmation email and we’ll get that sorted for you :slight_smile:

Hi, I got the TB6600 Stepper Driver. What would be the DIP switch settings? Does micro-stepping give you more torque?

Hey Paul,

Checkout this User Guide for the TB6600 for the Dip Switch configuration you’ll need for your specific setup.

Microstepping will usually give a little less torque, but the motors run smoother!

1 Like

so with my stepper motor specs are 1.0A at 3.4V so if I am running 12V would I set stepper driver to 4.0A ?

Hi Paul,

No, if your motors are designed for 1 amp, set it for 1 amp limit to prevent burning things out. If you’re using a chopper driver you can pretty much ignore the voltage rating of the motor.

2 Likes