Calculating setSpeed() for desired RPM

112 views
Skip to first unread message

Ross Waddell

unread,
Sep 29, 2024, 7:35:52 PM9/29/24
to accelstepper
I want to spin a 2-phase, 4-wire, stepper with a gear reduction ratio of 1:30 at 60 rpm. The step angle is 18deg which yields an output stepper angle 0f 0.62deg with that gear reduction ratio. I'm using a TMC2208 SilentStepStick in 1/2 step mode. What value should I use in setSpeed()? Also, if I change to 1/4 or 1/16 step mode do I multiply the 1/2 value of setSpeed by 2/8?

// Set up accelStepper intance
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);

Jim Larson

unread,
Sep 30, 2024, 12:47:47 AM9/30/24
to accelstepper
Keep in mind that AccelStepper knows nothing about step modes. It only cares about steps. Your math seems slightly off, 18/30 = 0.6. degrees per step, or 360/0.6 = 600 steps per revolution.  60 rpm is 1 rps, so your speed is 600 steps per second with full steps. If your driver is set for 1/2 step mode,, then it takes twice as many steps per revolution: 1200 steps per second for 60 rpm. 1/4 step mode doubles again; 2400 steps per revolution for 60 rpm. That's about as fast as an Arduino Uno or Nano or Mega can go. If you want finer step sizes, you'll need a faster Arduino to support it.

HTH!

           -jim

Ross Waddell

unread,
Sep 30, 2024, 9:50:51 AM9/30/24
to accelstepper
Definitely helps - thanks Jim!

I quoted 0.62 stepper angle for the 30deg gear reduction ratio based on the "Precision Ratio" mentioned on the specs; I think they round up/down for general use.

So, AccelStepper doesn't care about step modes, but to be clear the value in setSpeed() is steps per second? If so, then I understand your calculations.

I created a spreadsheet to calculate setSpeed() for a given RPM and it looks like if I use the 20:1 gear reduction one I can achieve that RPM with a value of 820 (1/2 step) or 1640 (1/4 step). They even have 10:1 and 5:1 ones which may allow me to use the SilentStepStick modes of 1/8 or even 1/16.
IMG_1999.jpg
AccelStepper Calculator.xlsx
Reply all
Reply to author
Forward
0 new messages