AccelStepper setSpeed as rpm or decimal in steps per second?

3,803 views
Skip to first unread message

MS

unread,
Dec 10, 2013, 4:14:57 PM12/10/13
to accels...@googlegroups.com
I know the exact RPM I need my stepper to spin. is there any way to set in terms of rpm using AccelStepper? if only in steps per second, can the setspeed value include a decimal? if I have a 200 step/rev motor and need (for example) 1 rpm, that's 3.333333 steps per second. Thanks.

Sandy Noble

unread,
Dec 10, 2013, 4:55:59 PM12/10/13
to accels...@googlegroups.com
Accelstepper specifies speed as steps per second, as a decimal, yes.


On 10 December 2013 21:14, MS <mschaf...@gmail.com> wrote:
I know the exact RPM I need my stepper to spin. is there any way to set in terms of rpm using AccelStepper? if only in steps per second, can the setspeed value include a decimal? if I have a 200 step/rev motor and need (for example) 1 rpm, that's 3.333333 steps per second. Thanks.

--
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/groups/opt_out.



--
Sandy Noble

MS

unread,
Dec 10, 2013, 6:02:09 PM12/10/13
to accels...@googlegroups.com
Thanks. out of curiosity, how is it actually executing that? it can't really do a fraction of a step (the decimal) so is it really just converting that to a delay or seconds per step (ie .3 in my example)?

Sandy Noble

unread,
Dec 10, 2013, 6:21:40 PM12/10/13
to accels...@googlegroups.com
Oh well yes you're right, there's no such thing as half or third steps, so 0.3 steps per second would mean that it would wait for 3.3 seconds, then take one step.  I think the internal workings of accelstepper uses microseconds, which is a millionth of a second (though the accuracy of the arduino is a bit suspect at that resolution), so 0.3 steps per second is translated into being one step every 3,333,333 microseconds, which of course, isn't a decimal or a fraction at all.

That's why it's important to call .run() often - the more regularly run() is being called, the more accurate the speed is.  That is, if you were only calling run() once a second, your 3.3 second wait would always end up being rounded up to a 4 second wait.  I'm not sure if accelstepper would recognise that, and round the next one _down_, or if it would end up effectively stepping at 0.25 steps per second instead.


sn


--
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/groups/opt_out.



--
Sandy Noble

tracy brown

unread,
Jan 10, 2014, 2:12:59 AM1/10/14
to accels...@googlegroups.com
don't worry so much about fraction at first. 
make sure you can make move to a direction you want. second test motor ability to move if you can. also, make sure to use accelStepper.h library and mostly important on void setup declare your both max speed and acceleration.
there are few example here to look at

tracy brown

unread,
Jan 10, 2014, 2:15:04 AM1/10/14
to accels...@googlegroups.com
you can also check some of my stepper motor post here and both in arduino homepage. I did do much here but I have extensive forum with others programmer interesting in coding stepper motor. I have the same issues but other educate me. always go baby step


On Tuesday, December 10, 2013 4:14:57 PM UTC-5, MS wrote:

Harrzack

unread,
Jan 10, 2014, 9:51:41 AM1/10/14
to accels...@googlegroups.com
I have been working out an RPM function for my general purpose Micro-Indexer project. My current thinking is in "steps per revolution". With a 200-step motor, that would be 200 steps to do one rev. If you divide 60 seconds by 200,you get a step-time of 300 milliseconds for 1 rev per min. With micro-stepping you can then work fractions of an rpm... I also plan to use a .55556 gear ration (40/72) which will make a 1.8 deg per step motor move the spindle at 1 deg per step. Plus you get a 1.8 torque increase!

=Alan R.

Ernesto Moctezuma

unread,
Apr 22, 2015, 4:17:50 PM4/22/15
to accels...@googlegroups.com
Hello 
Did you solve the Problem yet ? I'm having the same Issue when trying to run 2 stepper motors, Let's say one Step Motor is running always the same speed and the other has to run 1/5 of the first but for more time so both stop at the same time , What I do in my program is to divide the Maxspeed (1/5) but what happens is that always one Stepmotor stops before the other , this is because if you divide  1/5 = .2 and I think thas a speed that can not be read in Arduino SetMaxspeed  function Does any one here run over the same issue??


Sandy Noble

unread,
Apr 22, 2015, 5:18:56 PM4/22/15
to accels...@googlegroups.com
As per the docs (http://www.airspayce.com/mikem/arduino/AccelStepper/) "Very slow speeds are supported." Just use decimals, as you suggest - it works.

On 22 April 2015 at 21:17, Ernesto Moctezuma <ernie...@gmail.com> wrote:
Hello 
Did you solve the Problem yet ? I'm having the same Issue when trying to run 2 stepper motors, Let's say one Step Motor is running always the same speed and the other has to run 1/5 of the first but for more time so both stop at the same time , What I do in my program is to divide the Maxspeed (1/5) but what happens is that always one Stepmotor stops before the other , this is because if you divide  1/5 = .2 and I think thas a speed that can not be read in Arduino SetMaxspeed  function Does any one here run over the same issue??


--
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.



--
Sandy Noble
Reply all
Reply to author
Forward
0 new messages