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.
Erik
Adafruit motor shield v2.3
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88087
- Joined: Sat Feb 07, 2009 10:11 am
Re: Adafruit motor shield v2.3
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/
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/
Please be positive and constructive with your questions and comments.