Stepper motor speeds with Adafruit shield

Hi
I’m new to this forum so this may have already been covered, if so I apologise.

I recently purchased these items, and they work, so no issues there. However, I need to run the stepper in excess of 250 rpm and do not seem to be able to get anywhere close – more like 60rpm, regardless of the values of frequency and rpm in the Adafruit examples StepperTest.
Any ideas if this is possible with these components, and if not what should I use, perhaps a simple dc motor (actual required rpm is 600)

I also purchased the TB660 driver but have not had time to look at that yet – could that do the trick?

Hi Lionel,

Could you provide a link to the stepper motor you are using?
And do you have a copy of the code you are using?

Hi Clinton

The stepper motor is found at https://core-electronics.com.au/stepper-motor-200-steps-rev-12v-350ma.html

And the code is the test example with the adafruit library, i.e.

/*

This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2

It won’t work with v1.x motor shields! Only for the v2’s with built in PWM

control

For use with the Adafruit Motor Shield v2

----> http://www.adafruit.com/products/1438

*/

#include <Wire.h>

#include <Adafruit_MotorShield.h>

// Create the motor shield object with the default I2C address

Adafruit_MotorShield AFMS = Adafruit_MotorShield();

// Or, create it with a different I2C address (say for stacking)

// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Connect a stepper motor with 200 steps per revolution (1.8 degree)

// to motor port #2 (M3 and M4)

Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

void setup() {

//TWBR = ((F_CPU / 400000L) - 16) / 2; // Set I2C frequency to 400kHz

Serial.begin(9600); // set up Serial library at 9600 bps

Serial.println(“Stepper test!”);

//AFMS.begin(); // create with the default frequency 1.6KHz

AFMS.begin(2400); // OR with a different frequency, say 1KHz

myMotor->setSpeed(545); // 10 rpm

}

void loop() {

Serial.println(“Single coil steps”);

myMotor->step(4000, FORWARD, SINGLE);

myMotor->step(4000, BACKWARD, SINGLE);

Serial.println(“Double coil steps”);

myMotor->step(4000, FORWARD, DOUBLE);

myMotor->step(4000, BACKWARD, DOUBLE);

Serial.println(“Interleave coil steps”);

myMotor->step(400, FORWARD, INTERLEAVE);

myMotor->step(400, BACKWARD, INTERLEAVE);

Serial.println(“Microstep steps”);

myMotor->step(50, FORWARD, MICROSTEP);

myMotor->step(50, BACKWARD, MICROSTEP);

}

Regards

Lionel

If you have the TB660 driver I would give it a go and see if it changes anything. I am not sure why the motor speed would be limited though it could be that the driver cannot step fast enough as it need to send the command to step 200 times per rotation. Do you have a faster system that you can drive the motor from? this is a complete stab in the dark guess.

Hi Clinton

I’ve just started using the TB660 and its currently running around 280rpm, the absolute minimum I need is 330, so we are getting there. Looking on the web there is talk about needing to increase the iC2 frequency for the Adafruit shield to go faster, but not sure how to do this, and yes you’re right the pulse rate needs to be around 2k to run at 600rpm

Thanks

Hey Lionel,

I found this thread that explains how to increase the speed of the I2C bus

https://forum.arduino.cc/index.php?topic=16793.0

Thanks, I’ll chase that up

1 Like

The Adafruit motor driver has an onboard PWM chip to drive the motors. You need to tell the driver board the frequency of PWM.

Hi Robin. Sorry for the delay in responding, I was away. Yes I tried several different frequencies with the begin() but it didn’t seem to make a difference. I will try again

Regards

Lionel

Hi Clinton

Finally managed to get back onto this. I looked at speeding up the i2c port using the info in the link, but had an issue in that I could not find the original library to delete so that the updated one could be rebuilt. However you can get at the frequency directly like this

TWBR = ((F_CPU / 400000L) - 16) / 2; // Set I2C frequency to 400kHz

But I still could not get the stepper to run much faster than around 60rpm, using the Adafruit shield.

Bought another 12v NEMA 17 stepper from Jaycar, higher current rating, and then using the TB6600 set to no micro-stepping and with a duty cycle of 670 microseconds, 320 high, 350 low, managed to spin the motor at 441 rpm, which is fast enough for me. Any shorter cycle caused the motor to stutter. Not sure if this is the best way of doing things and would accept any advice that could improve things (I’m not an electronic or electrical engineer).

Anyway in the mean time hope that helps somebody

Regards

Lionel