Adafruit motor shield v2.3
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit motor shield v2.3

by ericson95 on Mon Aug 02, 2021 12:13 am

Hi guys,

I'm working with a bipolar stepper motor, Arduino Uno R3 and the Adafruit motor shield v2.3 and using the sketch "StepperTest" from the library "Adafruit Motor Shield v2 Library". There is the possibility to change the motor speed with:

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

So right now it's by 10 rpm, but if I want to decrease the rpm number the stepper motor is not getting slower (it gets faster), also above 18rpm it's getting slower again.
I work with 200 steps and 1.8 degree, 12V and 0.4 A.

Please help, I need a rotation less than 10 rpm.

Thank you in advance.


Posts: 12
Joined: Tue Jun 01, 2021 3:59 pm

Re: Adafruit motor shield v2.3

by adafruit_support_bill on Mon Aug 02, 2021 7:42 am

The problem is that the library uses the Arduino delaymicroseconds() function to time the delay between steps. And delaymicroseconds appears to use a signed 16 bit integer for the delay count. So below 10 RPM, the delay value overflows and the timing gets shorter.
https://www.arduino.cc/reference/en/lan ... roseconds/

To achieve slower RPMs, you can use the AccelStepper library (see the examples in the guide). Or you can time the steps yourself using the delay() function which will give you millisecond resolution. https://www.arduino.cc/reference/en/lan ... ime/delay/

Posts: 81920
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.