AccelStepper I need urgent help

559 views
Skip to first unread message

Rafael Zanela

unread,
Apr 5, 2016, 10:51:15 PM4/5/16
to accelstepper
Friends'm new in the area and would like to use AccelSteper library to control a stepper motor, just that I wish I could use 20k steps per second. What did would total 750 rpm. Could help how can I do this? For tested and the library appears to have a limit of 5k.

I thank your help.

Best regards
Rafael Zanela

Mike McCauley

unread,
Apr 6, 2016, 1:49:32 AM4/6/16
to accels...@googlegroups.com
Hi,

the only options you have are :

1. Use a CPU thats at least 4 times faster
2. Use a different stepper driver library.

cheers.
--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com
Phone +61 7 5598-7474

gregor

unread,
Apr 6, 2016, 7:02:20 AM4/6/16
to accelstepper
I think not even the Arduino Due (the fastest Arduino) can achieve 20k steps / second. I can test it for you once I get my Due.

Jon Magill

unread,
Apr 7, 2016, 1:04:23 PM4/7/16
to accelstepper
I use a Teensy 3.2, a 32-bit ARM-based, Arduino compatible board, which can run at 96MHz, but I have never tested for the actual maximum speed.

Most people who want higher speeds with steppers, increase the microstep size (to 1/4 or 1/2), or revert to using full steps. Unless there is some specific need for using 1/8th steps at that speed, you might be better off reverting to full-steps when you need high speed, and therefore only need ~2,500 steps/sec (for a 200 step/rev motor).

Many driver boards allow pin access to change microstep size on-the-fly, and you might consider that as part of your programming model, as speed increases.

Hardware aside, I suspect that your issue will not be with achieving top speed, but any programmatic overhead that takes time away from actual stepping.

gregor

unread,
Apr 8, 2016, 7:31:04 PM4/8/16
to accelstepper
I have tested my Due using the code posted below.
runSpeed(): the Due needs 23,168 seconds for 10^6 steps, this is 43163 steps / second.
run(): the due needs 61,678 seconds for 10^6 steps, this is 162313 steps / second.

#include <AccelStepper.h>

AccelStepper stepper(AccelStepper::DRIVER, 8, 9);

uint32_t start_time
= 0;

void setup()
{  
 
Serial.begin(9600);
 
while(!Serial);

 
Serial.println("starting test");
 
   stepper
.setMaxSpeed(999999);
   stepper
.setSpeed(999999);

   start_time
= millis();
}

void loop()
{  
   stepper
.runSpeed();

   
if (stepper.currentPosition() == 1000000)
     
Serial.println(millis() - start_time);
}

#include <AccelStepper.h>

AccelStepper stepper(AccelStepper::DRIVER, 8, 9);

uint32_t start_time
= 0;

void setup()
{  
 
Serial.begin(9600);
 
while(!Serial);

 
Serial.println("starting test");
 
   stepper
.setMaxSpeed(999999);
   stepper
.setAcceleration(999999);
   stepper
.moveTo(1000000);

   start_time
= millis();
}

void loop()
{  
   
if (!stepper.run()) {
   
Serial.println(millis() - start_time);
   
while(1);
   
}
}

Mike McCauley

unread,
Apr 8, 2016, 7:57:00 PM4/8/16
to accels...@googlegroups.com, gregor
Nice work Gregor!
> > I use a Teensy 3.2 <https://www.pjrc.com/store/teensy32.html>, a 32-bit
> > ARM-based, Arduino compatible board, which can run at 96MHz, but I have
> > never tested for the actual maximum speed.
> >
> > Most people who want higher speeds with steppers, increase the microstep
> > size (to 1/4 or 1/2), or revert to using full steps. Unless there is some
> > specific need for using 1/8th steps at that speed, you might be better off
> > reverting to full-steps when you need high speed, and therefore only need
> > ~2,500 steps/sec (for a 200 step/rev motor).
> >
> > Many driver boards allow pin access to change microstep size on-the-fly,
> > and you might consider that as part of your programming model, as speed
> > increases.
> >
> > Hardware aside, I suspect that your issue will not be with achieving top
> > speed, but any programmatic overhead that takes time away from actual
> > stepping.
> >
> > On Wednesday, April 6, 2016 at 4:02:20 AM UTC-7, gregor wrote:
> >> I think not even the Arduino Due (the fastest Arduino) can achieve 20k
> >> steps / second. I can test it for you once I get my Due.

Sandy Noble

unread,
Apr 9, 2016, 4:11:53 AM4/9/16
to accels...@googlegroups.com

What a great test Gregor! I wonder if the top speeds for various devices should be in the docs? Or maybe the sketch could be one of the examples in the software bundle?

sandy noble

--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike McCauley

unread,
Apr 9, 2016, 4:40:52 AM4/9/16
to accels...@googlegroups.com, gregor
Hi Gregor,

On Friday, April 08, 2016 04:31:03 PM gregor wrote:
> I have tested my Due using the code posted below.
> runSpeed(): the Due needs 23,168 seconds for 10^6 steps, this is 43163
> steps / second.

Thats just a bit over 23 secs isnt it (just checking on your use of , as a
decimal)?

> run(): the due needs 61,678 seconds for 10^6 steps, this is 162313 steps /
> second.

61 odd seconds?

Shouldnt that speed be 16214?

Cheers.
> > I use a Teensy 3.2 <https://www.pjrc.com/store/teensy32.html>, a 32-bit
> > ARM-based, Arduino compatible board, which can run at 96MHz, but I have
> > never tested for the actual maximum speed.
> >
> > Most people who want higher speeds with steppers, increase the microstep
> > size (to 1/4 or 1/2), or revert to using full steps. Unless there is some
> > specific need for using 1/8th steps at that speed, you might be better off
> > reverting to full-steps when you need high speed, and therefore only need
> > ~2,500 steps/sec (for a 200 step/rev motor).
> >
> > Many driver boards allow pin access to change microstep size on-the-fly,
> > and you might consider that as part of your programming model, as speed
> > increases.
> >
> > Hardware aside, I suspect that your issue will not be with achieving top
> > speed, but any programmatic overhead that takes time away from actual
> > stepping.
> >
> > On Wednesday, April 6, 2016 at 4:02:20 AM UTC-7, gregor wrote:
> >> I think not even the Arduino Due (the fastest Arduino) can achieve 20k
> >> steps / second. I can test it for you once I get my Due.

gregor christandl

unread,
Apr 9, 2016, 4:48:15 AM4/9/16
to Mike McCauley, accels...@googlegroups.com
Hi,

I used ',' as the decimal.
The speed using run() was 16213 Steps/second, a little typo caused by tiredness ;-)

Mike McCauley

unread,
Apr 9, 2016, 7:03:31 AM4/9/16
to accels...@googlegroups.com, gregor christandl
Thanks.

I have put a little note in the doc with credit to you.

Cheers.

gregor christandl

unread,
Apr 9, 2016, 7:10:49 AM4/9/16
to accels...@googlegroups.com

Thanks!


Reply all
Reply to author
Forward
0 new messages