09-17-2014 07:19 AM
Hi!
Sorry if i m reposting this again, but I figured this would give a better overview of the issue. I have to control the velocity of stepper motor using a sine wave so that it simulates a simple harmonic motion. The problem is that my stepper motor driver accepts STEP and DIR pulses, so I have no clue how to convert the sine wave to stepper motor pulses.
I did figure out a way to reverse the direction of the stepper motor, by differentiating the sine wave, everytime the derivative changes, a pulse is sent to the DIR to change direction. It would be great if someone could suggest a way to control the velocity using the sine wave.
Thanks!
09-18-2014 09:28 AM
What hardware are you using to communicate with your drive? Is it LabVIEW? From those two inputs, it doesn't sound like you have control over velocity but there may be another command to send to your drive that changes the velocity.
09-18-2014 12:17 PM
Most steppers I've worked with are inherently pretty resonant down in the low speed range,
where "low speed" would generally mean revs/sec measured in small single digits. This is
something to watch out for with bi-directional simple harmonic motion, especially if you have
low friction / damping in your system.
That caveat aside, the basic way to approach this is to feed a variable frequency pulsetrain to
the STEP input. Pulsetrain frequency will be proportional to commanded rotational speed.
You'll need to synchronize your direction input to change at the zero crossings.
What DAQ hardware do you have? To do this well, you'll need the pulsetrain frequency
changes to be hardware timed. I'd want to use an STC-3 based counter/timer (found in
X-series MIO boards, maybe other places?) that supports buffered pulse generation, but I've
done analagous things using correlated DIO with an STC-2 based counter timer on an
M-series MIO board.
Another small subtlety to look out for: depending on your particular sinewave freq and amplitude,
quantization *might* cause the + direction to get 1 step more or less than the - direction, causing
a slow mechanical drift in one direction to the tune of 1 step per sine wave cycle. Now that you
know to watch out for it, you can go ahead and prevent it.
-Kevin P