using stepper motor, product id 324, 200 steps/rev
I'am having a problem with the speed
setting speed to 50 only produces 22 rpm
setting speed to 100 only produces 28 rpm, not even close to twice the rpm
setting speed to 150 only produces 31 rpm
does not run smooth at all
The old shield works fine, speed of 50 produces 41 rpm, 100 produces 91 rpm
The old shield set at 22 rpm runs smoother than the new shield
I used same code for both shields only difference is libraries
Below is output of serial monitor for the new shield and the old shield, plus code used
Any suggestions with this problem
Serial monitor, old shield
speed=50 rpm=47
speed=100 rpm=91
Serial monitor, new shield
Estimated pre-scale: 2.81
Final pre-scale: 3
speed=50 rpm=22
speed=100 rpm=28
Code: Select all
// Test code for new shield v2.0
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);
unsigned long int startTime, endTime,elapseTime;
int mtrSpeed,stepCnt,rpm;
void setup(){
Serial.begin(9600);
AFMS.begin();
}
void loop() {
stepCnt=800; // 2 revolutions for INTERLEAVE
mtrSpeed=50;
myMotor->setSpeed(mtrSpeed);
startTime=millis();
myMotor->step(stepCnt, FORWARD, INTERLEAVE);
endTime=millis();
elapseTime=endTime-startTime;
rpm = (stepCnt/400)*60000/elapseTime;
Serial.print("speed="),Serial.print(mtrSpeed),Serial.print(" rpm="),Serial.println(rpm);
delay(500);
mtrSpeed=100;
myMotor->setSpeed(mtrSpeed);
startTime=millis();
myMotor->step(stepCnt, FORWARD, INTERLEAVE);
endTime=millis();
elapseTime=endTime-startTime;
rpm = (stepCnt/400)*60000/elapseTime;
Serial.print("speed="),Serial.print(mtrSpeed),Serial.print(" rpm="),Serial.println(rpm);
myMotor->release();
while(true){}
}