Run and RunSpeed speed limit cap

162 views
Skip to first unread message

Grezzianastro

unread,
Oct 12, 2024, 2:20:57 AM10/12/24
to accelstepper
Hello, is it possible that Run and Runspeed have a speed limit cap and RunToPosition has none? If yes is there a way to obtain what RunToPosition do without blocking?
Asking this because I'm microstepping to reduce noise and the only way to go fast is with RunToPosition.

gjgsm...@gmail.com

unread,
Oct 12, 2024, 3:38:01 AM10/12/24
to accelstepper
I think the short answer is no, but Mike would be able to give a definitive answer on that.
The most obvious cause for a speed limitation would be your MCU processor speed;

Here are the processor speeds for common microcontroller units (MCUs):

  1. Arduino UNO (ATmega328P): 16 MHz
  2. Arduino MEGA (ATmega2560): 16 MHz
  3. Arduino DUE (SAM3X8E ARM Cortex-M3): 84 MHz
  4. ESP32 (Tensilica Xtensa LX6 dual-core): 240 MHz (per core)
  5. Teensy 4.0 / 4.1 (ARM Cortex-M7): 600 MHz
The following are the max stepping speeds clocked by me:
                                 RUN                       RUNSPEED
UNO                         4191                      14865
MEGA                      3851                      12130
DUE                         14159                    31167
ESP32                    44280                    75953
TEENSY4               95000                  100000+
I would imagine RUNSPEED is faster because it is constant speed, no acceleration, so no heavy float calcs to slow things down.

So if you are trying to step a motor at over 4000 steps/sec using an UNO or MEGA it might struggle. If you are stepping more than one motor at high stepping rates, that will further reduce the max stepping rate for each motor.
Yes reducing noise by increasing the microstepping is one way but having inadequate power supply may also contribute. Most motors above NEMA11 size will in general, operate on voltages 24vdc to 60vdc and if using switchmode PSUs the current rating of the PSU should be 25% above the motor current rating. Stepper motors can become noisy/rough if the 'driver' current setting is too high, worth checking that out.

Grezzianastro

unread,
Oct 12, 2024, 4:40:36 AM10/12/24
to accelstepper
Thank you for your reply, I'm using an ESP32 and indeed I had reached nice speeds, assuming I have 2 drives I was thinking of using one core per RunToPosition function but I think I have solved reaching the same speed with the following code isolating the run I know it's blocking but at least both motors runs at the same time. I tough that other simple tasks in the loop couldn't effect speed but I was wrong... 
 
myStepper1.moveTo(quantoApro);
      myStepper2.moveTo(quantoApro);
      myStepper1.run();
      myStepper2.run();
      while (myStepper1.isRunning()){
              myStepper1.run();
              myStepper2.run();
      }

gjgsm...@gmail.com

unread,
Oct 12, 2024, 5:24:53 AM10/12/24
to accelstepper
While loops are a good idea for concentrating processor resources when moving the steppers. Checking for changes to variables and interrupts at the same time is also generally ok. Serial data events and delays in particular within a run() loop, will slow stepping down. The best way I find to manage resouces is to use freeRTOS to manage tasks, priorities, core allocation and memory (malloc). This is a little more complex to implement but there is a lot of help and information about this online.

Mike McCauley

unread,
Oct 12, 2024, 4:24:01 PM10/12/24
to accels...@googlegroups.com
On Saturday, 12 October 2024 16:20:57 AEST Grezzianastro wrote:
> Hello, is it possible that Run and Runspeed have a speed limit cap and
> RunToPosition has none?

There is no cap in the code for any such calls. Speed limits will generally be
due to processor resources.

Cheers.


> If yes is there a way to obtain what RunToPosition
> do without blocking?
> Asking this because I'm microstepping to reduce noise and the only way to
> go fast is with RunToPosition.


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



Reply all
Reply to author
Forward
0 new messages