acceleration on stepper motor without using accelstepper.h

title says it all. id like to know a method to add acceleration and deacceleration to my stepper motors.

Hi,

bustercluster: title says it all. id like to know a method to add acceleration and deacceleration to my stepper motors.

What method to control accel, buttons, pot? What do you want the control to do, set speed or acceleration. What happens when stepper can go no faster and stalls. What is the application that need acceleration control.

Tom..... :)

The most important question is: Why on earth do you NOT want to use AccelStepper? Doing proper acceleration and deceleration is non-trivial on a computationally limited CPU. AccelStepper is very well done, and works very well. You would spend a HUGE amount of time duplicating its performance and reliability, and for what gain?

The algorithm use by AccelStepper is very well documented, and the source code contains a link to the paper it is based on.

Regards, Ray L.

I've done this in the past - by nominating a distance (# steps or, % of current-to-target position) to apply speed ramping, then introduce skipped steps, from a single pulse... up to 'all' pulses skipped when you reached the target position.

You can vary the acceleration/deceleration speed by changing the skip number by +/1 (slow rate of change), through to +/-many (a function of the remaining distance).

lastchancename: I've done this in the past - by nominating a distance (# steps or, % of current-to-target position) to apply speed ramping, then introduce skipped steps, from a single pulse... up to 'all' pulses skipped when you reached the target position.

You can vary the acceleration/deceleration speed by changing the skip number by +/1 (slow rate of change), through to +/-many (a function of the remaining distance).

Which will work fine only for relatively low step rates. At higher rates, the skipped steps will setup oscillations in the motor rotation which can, by themselves, cause lost steps, and stalling. For optimal performance, it is critical that the pulse train be smooth, with low jitter, and that the step-to-step timing varies smoothly throughout the entire motion. Simply skipping steps will greatly reduce the maximum achievable speed, especially under load.

One of my stepper-driven CNC machines used bit-banging to drive the steppers. It was limited to less than 100 inches/min., due entirely to the jitter in the step pulse timing. And this was on a 2.8GHz PC. I added a hardware motion controller, which generated the step pulses in hard-wired logic, and instantly increased the speed to over 350 inches/min.

Regards, Ray L.

I agree with your sentiment, but the step rate in my method doesn't vary arbitrarily - it simply increases or decreases the 'frequency' of the steps by n depending on the distance from the target. (It sounds really cool on big motors!)

I've used this method on three concurrent steppers driven by an Arduino- stepping at 10KHz without any issues. Perhaps I didn't explain it very well. (It wouldn't be the first time!) :confused:

P.S. I agree with using accell_stepper for simplicity, but if he wants to roll his own - this is one way to shoot at it.

I suspect (but have not yet tested this) that smooth acceleration may not be essential to ensure that the motor does not miss steps and a series of 2 or 3 discrete intermediate speeds may be sufficient.

Of course this would be inappropriate if the load requires smooth acceleration.

...R

1) Use microstepping - then you automatically reduce the impact of jitter and reduce the risk of resonant pull-out. Of course you have to step faster.

2) Jitter itself tends to be averaged out, but the components of the jitter that fall in the resonance peaks of the mechanical system (rotor+load) will not be damped, so unless you can noise-shape the jitter spectrum try to keep it to a minimum.

3) mechanical (viscous) damping is very useful to improve motor performance, it reduces resonance

Here is how i do it

digitalWrite(directionPin, HIGH);
for(int n = 0; n < numberOfSteps; n++) {
digitalWrite(stepPin, HIGH);
digitalWrite(stepPin, LOW);

//delayMicroseconds((abs(600-2*n)+micsbetweenSteps)); or

delayMicroseconds(abs(150-n/2)+micsbetweenSteps);

//600 being double the total steps you are going to make or

// 150 being half the total steps you are going to make

The definitive paper on linear acceleration was written by David Austin and detailed in an Atmel Application Note AVR446. I spent the better part of two years getting a commercial version of this working on the 328P. Good luck!