# Time based stepper motor control

I am looking to control a stepper motor, with acceleration and deceleration of movement over a time period. Basically tell the motor I want to move 20,000 steps over 60 minutes and have it accelerate for some amount of time, like 5 minutes, then move at a constant speed until it decelerates for the last 5 minutes or so.

I have been looking for libraries that do this but have not found anything yet. With most of them you set a speed, acceleration and how many steps you want. What I would like is to be able to give it a acceleration, time and number of steps to take and for the library to control the speed.

So does anyone know if this exists. Otherwise I get to spend some time writing a new library...

Time lapse slider?

I don't know of any specific library for this, but its a common problem and surprisingly
subtle to get right (step exact). There are two approaches, either use a fixed clock and
generate steps using DDS techniques (just adds), or use variable delays and calculate
each delay on the fly (needs square-roots)

There are two basic cases - either there is enough 'time' to accelerate to full speed, then
constant speed, then decelerate, or else you accelerate to a speed below full speed and
immediate decelerate again in order to stop in time. There's also a choice of units,
such as steps-per-second-per-second or fractions thereof.

pravda:
Time lapse slider?

close :)... just built a panning head and I have something that works at a constant speed... that part was easy using the standard stepper... getting it to do ramping is a little more complicated and I was hoping someone else already did the work for another project I am building a timelapse slider I am using miniE v 1.3 (http://www.minie.airiclenz.com)... he just came out with a new version which I am planning to build sometime next year...

MarkT:
I don't know of any specific library for this, but its a common problem and surprisingly
subtle to get right (step exact). There are two approaches, either use a fixed clock and
generate steps using DDS techniques (just adds), or use variable delays and calculate
each delay on the fly (needs square-roots)

There are two basic cases - either there is enough 'time' to accelerate to full speed, then
constant speed, then decelerate, or else you accelerate to a speed below full speed and
immediate decelerate again in order to stop in time. There's also a choice of units,
such as steps-per-second-per-second or fractions thereof.

thanks... looks like I am off to the drawing board...

Can't you do a little maths to convert the time periods into numbers of steps and then use the step based library?

I would be very interested to learn of an application where the precise time spent in acceleration matters whereas I can see the acceleration rate needing to be controlled carefully to avoid missing steps.

...R

Robin2:
Can't you do a little maths to convert the time periods into numbers of steps and then use the step based library?

I would be very interested to learn of an application where the precise time spent in acceleration matters whereas I can see the acceleration rate needing to be controlled carefully to avoid missing steps.

...R

I can but if there was a library already out there that did this I would use it... I'll probably using the accelstepper library and come up with an algorithm that can compute the speed needed for the time and do it that way...