How to define the maximum acceleration and Speed in Accelstepper stepper library

Hello,

I am using the Accelstepper library to move my 28BYJ-48 Stepper motor with Arduino IDE.
I am trying to understand exactly the maximum speed and the maximum acceleration that my stepper could reach.
I tried to calculate it by using (2), but in my code, I can reach 600 in setMaxSpeed().
Here are the specifications:
Inputs:
Max rated Current: 0.04A
Inductance: 3mH
Input supply: 5V
Steps/Revolution: 2048 Steps

Outputs:
Maximum Speed: 10.2 revolutions/sec
Minimum Time/Step: 0.0480 ms
Maximum Power: 0.200 Watts

q.1) Is the Steps/Revolution ok? It is what I use into my code, but searching along some files, I found some use 32, others 64, others 2038, and some others 2048. What should I use?

q.2) how do I can determine the max speed and the max acceleration? Is there a formula? What test should I do to find it?

While searching into the Accelstepper library, I found this: " Speed accuracy depends on the Arduino crystal. Jitter depends on how frequently you call the runSpeed() function ", but I did not find the correlation itself about Jitter and Arduino crystal.

q.3) How do Jitter and Arduino crystal interfere with the max speed and acceleration? How to find each one?

references and info:
(1) 28BYJ-48 Datasheet --> http://robocraft.ru/files/datasheet/28BYJ-48.pdf
(2) Stepper Motor Calculator --> https://www.allaboutcircuits.com/tools/stepper-motor-calculator/
(3) more infos about 28BYJ-48 --> Continuous distraction osteogenesis device with MAAC controller for mandibular reconstruction applications | BioMedical Engineering OnLine | Full Text

caiquems:
I am trying to understand exactly the maximum speed and the maximum acceleration that my stepper could reach.

That's somewhat different from what your Title says.

You seem to know how to use the setMaxSpeed() and setAcceleration() functions.

The only way to know the actual max that your motor can attain is by experiment. A lot will depend on the load that it is being asked to move.

2048 is the number of steps for one rotation of the output shaft. If you know the gearbox ratio (I can't remember) you can calculate the number of steps for the motor itself. However for the purpose of the AccelStepper library I would use 2048.

If you want to measure the max speed I suggest you write a short program to rotate the output shaft 10 times and measure the time it takes for different values of setMaxSpeed()

...R

caiquems:
q.1) Is the Steps/Revolution ok? It is what I use into my code, but searching along some files, I found some use 32, others 64, others 2038, and some others 2048. What should I use?

They vary, some are exactly 2048, others are slightly different, depending on the exact gearing used

q.2) how do I can determine the max speed and the max acceleration? Is there a formula? What test should I do to find it?

That's always a matter for experimentation, there is no formula as it depends on many factors including mechanical damping

While searching into the Accelstepper library, I found this: " Speed accuracy depends on the Arduino crystal. Jitter depends on how frequently you call the runSpeed() function ", but I did not find the correlation itself about Jitter and Arduino crystal.

q.3) How do Jitter and Arduino crystal interfere with the max speed and acceleration? How to find each one?

Don't worry about this, its a tiny effect. Jitter has absolutely no effect, but accuracy might matter (some
Arduinos use a quartz crystal, typically very accurate, others use a ceramic-resonator, accuracy +/-0.5%)

Hi everyone!!!
I using 28BYJ-48 - 5V Stepper Motor// Arduino Uno // AccelStepper
I am trying to reach the max acceleration of my motor, as u can see on the pdf it could reach even more than 15000(On that speed I could see that the motor started to run and after some rounds, it started shaking a lot), is it normal? While I tried 30000, the motor started to shake a lot. What can I consider the maximum point? When should I consider the limit? When does the motor start shaking?

#include <AccelStepper.h>   
AccelStepper stepper (AccelStepper::FULL4WIRE, 8, 10, 9, 11);
unsigned long x = 2048;
double tiime;
// rampa normal sem usar simple acc ()
void setup() {
  Serial.begin(9600);
  stepper.setMaxSpeed(600);  
  stepper.setAcceleration(50);  
  stepper.setSpeed(300);
  stepper.moveTo(x);  
}
void loop() {
    tiime = millis();
    stepper.run();
    if(stepper.currentPosition() == 2048)
          Serial.println(tiime); 
    if (stepper.distanceToGo() == 0) 
      stepper.moveTo(-stepper.currentPosition()); 
}

1.pdf (27.9 KB)

If you set the speed or acceleration too high, the stepper starts missing steps. That's probably the "shaking" behavior you describe. It will actually slow down when that happens, so the fastest speed and acceleration come at the point just before you start missing steps. I would suggest just experimentally determining the maximums for your specific setup.

Hi everyone!!!
I using 28BYJ-48 - 5V Stepper Motor// Arduino Uno // AccelStepper
I am trying to reach the max speed of my motor, as u can see on the pdf it does not make sense, at least I could not see it.
While I change setSpeed(1,10,20,50,100.....) until reaching the setMaxSpeed, it does not matter what is exactly the setSpeed, the execution time remains the same. I thought that while setSpeed increase, it will take less time to reach the setMaxSpeed, but it looks like it is not this way? So, what does exactly work? Am I wrong? While reading the AccelStepper.h that was my hypothesis.

question 2) On the pdf you can notice something strange

steps maxS setS acc time
2048 299,8 100 50 12,831

while I tried to set maxSpeed on 299,8 I got time12,831; And when setMaxSpeed was 299,7 I got time 12,833; while setMaxSpeed was 299,9 I got time 12,833
It does not make sense at all. What is it?

#include <AccelStepper.h>   
AccelStepper stepper (AccelStepper::FULL4WIRE, 8, 10, 9, 11);
unsigned long x = 2048;
double tiime;
// rampa normal sem usar simple acc ()
void setup() {
  Serial.begin(9600);
  stepper.setMaxSpeed(600);  
  stepper.setAcceleration(50);  
  stepper.setSpeed(300);
  stepper.moveTo(x);  
}
void loop() {
    tiime = millis();
    stepper.run();
    if(stepper.currentPosition() == 2048)
          Serial.println(tiime); 
    if (stepper.distanceToGo() == 0) 
      stepper.moveTo(-stepper.currentPosition()); 
}

2.pdf (26 KB)

@caiquems, please do not cross-post. Threads merged.

@caiquems, it seems that you never bothered to read the Replies that were posted on 5th and 6th of June.

If you won't take the trouble to read the Replies it is hard to find the enthusiasm to help you.

...R

1 Like