High speed stepper and AccelStepper

Hello All,

My problem:
How to generate high frequency pulses for high speed stepper motor drive application

My application:
Long story short, I have two stepper motors, bipolar two-wire nema 34 @72V, which I want to turn 180 degrees as quickly as possible, pause, then turn 180 degrees in the reverse direction. For now, its fine to only control a single motor at a time (i.e. rotate one motor, pause, rotate other motor). I am using the following motor driver. To maximize the speed i have the microstepping set to the smallest possible value of 2 (i.e. 400 p/rev).


Theres a 9:1 gearbox to boost the torque, thus I need to generate a very high frequency pulse train to get the motor to spin around 2 Hz at the shaft.

What I have tried:

We have labview and some national instruments hardware at work. I started out using the started out using the NI usb-6001 and a labview VI. The motor speed was waay to slow - I later learned there is no hardware timing on the device’s digital output, and I was limited to about 1 ms.

I then swapped to the arduino and was able to fire pulses much faster and was pleased with the result. I need a trapezoidal velocity profile to get the speeds I want, and quickly stumbled upon the accelStepper() library and was thrilled at the capabilities.

This seems to turn the arduino into a simple, incredibly low cost motion controller however all the calculations really bog down the performance and, as others have mentioned, limit to about 4000 pulses/s.

People seem to overcome this by using the discontinued Arduino due instead of the uno due to its higher frequency brain. This seemed to be my solution until i noticed that the Due is 3.3V, not 5V. My stepper motor driver requires a 5V signal. The other 32 bit processor options (i.e. chipKIT) are also 3.3V.

in summary:

  1. Is there something that can step up the voltage to 5V at a very high frequency?

  2. Would a parallel port-based breakout board / mach 3 type CNC configuration be limited to the computer speed of ~1ms as labVIEW was?

  3. Is there alternative hardware that can generate high speed 5V pulses for a stepper driver (that costs <<< $1000) ?

Thanks so much in advance, and any advice on getting a high speed stepper setup is appreciated. Worst case scenario, the basic arduino stepper library with a rudimentary ramp will suffice but I would love to take advantage of the accelStepper library.

I'm sure there are many simple logic ICs that can be powered at 5v and triggered at 3v. Investigate AND gates or Schmidt triggers. There speed will be probably an order of magnitude (or two) higher than you need.

You have not said anywhere how many pulses per second you actually require.


AccelStepper does step-period calculations (floating point square roots I think) for every step,
and is hence very limited in top speed.

Using DDS step generation is a faster approach as only integer additions and comparisons are needed,
but has to have the function run at a high fixed frequency (think an ISR running at 30kHz or more).

DDS is trickier in the precalculation.

In summary direct digital synthesis (normally used for generating audio and RF waveforms) is a simple
repetition of:

new_phase = old_phase + frequency ;
if (sign_changed (new_phase, old_phase))
  step () ;
phase = new_phase ;

Think of phase and frequency as fractions of a step and of a step-per-interrupt.
[ for audio generation you’d use the top bits of phase to index a wavetable, not just
check for sign flipping ]

Using 32 bit longs then 0x40000000L represents +0.5 steps per interrupt, so that
with 30kHz ISR rate that’s 15,000 steps per second. Smaller step rates require
smaller frequency values pro-rata. The sign of the frequency variable sets the
direction pin, note.

The idea can be extended to include acceleration - rate of change of frequency
variable, ie

frequency += acceleration ;
set_direction (frequency < 0);
if (sign_changed (new_phase, old_phase))
  step () ;
phase = new_phase ;

Then you can ramp acceleration by setting the acceleration variable (the units are
steps/interrupt/interrupt which is a bit tricky to figure out - you will want to do some