AccelStepper library do not update setMaxSpeed( ) and setAcceleration()

Hello,

I am using AccelStepper library to control a bipolar motor, using acceleration (1/16 micro stepping).

The code I am using works like this:

in setup:
myStepper.setMaxSpeed(70000.0);
myStepper.setAcceleration(70000.0);

in loop:
myStepper.moveTo(-4000);
myStepper.runToPosition();

However, my stepper does not accelerates beyond a mid level value of acceleration and speed.

From the AccelStepper docs.

Performance
The fastest motor speed that can be reliably supported is about 4000 steps per second at a clock frequency of 16 MHz on Arduino such as Uno etc. Faster processors can support faster stepping speeds.

Your post leaves out a lot of pertinent information like which Arduino, full properly formatted code (in a code bock) and a schematic.

I prefer the MobaTools stepper library. I believe that that library is easier to learn and use.

I am using an Arduino nano 33 IoT, 1/16 micro stepping.

`#define dirPin 11
#define stepPin 12
AccelStepper myStepper(AccelStepper::DRIVER, stepPin, dirPin);
...

void setup() {
....
myStepper.setAcceleration(70000.0);
myStepper.setMaxSpeed(70000.0);
...
void loop() {
...
myStepper.moveTo(-8000);
myStepper.runToPosition();
...
}
`
Thanks!

#define dirPin 11
#define stepPin 12
AccelStepper myStepper(AccelStepper::DRIVER, stepPin, dirPin;

void setup() 
{
   myStepper.setAcceleration(70000.0);
   myStepper.setMaxSpeed(70000.0);
}
void loop()
{
   myStepper.moveTo(-8000);
   myStepper.runToPosition();
}

The thing is that some times, when declaring very high values of acceleration and speed the motor stalls, while some times it seems that internally limits the values and does not reach speeds and accelerations beyond a threshold (whatever values I set, motor is accelerated and speeds till a certain threshold).

In both cases, when I call the routines to get the used values (speed() and acceleration() ) I get the (high) values that I had set.

I don't have that board. But the main processer on this board is a SAMD21 with an Cortex M0 core running at 48MHz. I don't think AccelStepper can create step pulses that fast on this MCU.

I checked on an UNO R4 (Cortex M4 running at 48MHz). The max steprate Accelstepper is able to create on this board is 60µs/step or 16666 steps/sec. I tested with only the .run() method in loop() without doing anything else.

I cannot imagine that the nano 33 IoT can do faster.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.