Dear all,
I've setup a robot with 6 stepper motors using the AccelStepper library on an Arduino Mega (16Mhz clock speed). (Each stepper is driven by either an A4988 stepper driver or a DM542T stepper driver).
The library works fine, and most of the motors are set to "half step" on the driver (400 steps per revolution), and in the AccelStepper library I set each one to "4000" as the Max Speed. That equates to about 600 rpm at 400 steps per revolution.
And the speed of the motor seems to be pretty accurate when I run a single motor.
However, the moment I have multiple motors moving at the same time, all of the motors turn slower than what I had set as their max speed. The more motors that are being told to run, the more the speed of each individual motor slows down.
This seems to be because my Arduino Mega's processor needs time to compute more code, since now instead of just having a "MotorX.run()" command, I also have "MotorY.run()" and "MotorZ.run()" in my code. And therefore, the Arduino Mega sends each pulse at a slower interval than its theoretical maximum capability of 4000 pulses per second (according to the AccelStepper library).
This becomes an issue when I'm trying to make the robot perform movements at a fast speed, because unless I only command one motor at a time, it will never appear to perform at the actual "SetMaxSpeed()" value that I apply.
Any suggestions as to how to possibly overcome this? Is it as simple as picking an Arduino with a faster processor? The Arduino Due looks to have an 84Mhz clock speed, but I'm worried that there will be multiple hurdles to overcome when porting my hardware connections and trying to make the code work...so I thought I'd ask if there perhaps is some other workaround or solution others are using in this kind of situation..
Thank you!