Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Sine wave trajectory stepper motor Tic T825

Dear Forum,

I am trying to achieve a sine position movement with the Pololu Tic T825 stepper motor driver.
Which is the best way to achieve this? Now i am talking to the driver with an Arduino Mega 2560 via Serial Communication.

Should I loop over positions (with the Arduino) the stepper motor has to achieve? Therefore I think I should change to Teensy, because I does not get a smooth movement.

Or should I change the acceleration and speed within an while loop to get the desired maximal distance?

Or is the serial communication not the right choice and I should communicate via Step/Dir or else?

Thank you,
husneck

Hello.

Depending on how accurate you need the sine wave, you might be able to simply adjust the speed and acceleration values and get close enough by changing the target position between the positive and negative peak and letting the Tic handle it.

If that is not close enough, you could try breaking it up into incremental positions. With this method you probably want to set a relatively high starting speed/acceleration so the Tic reaches the position quickly enough to keep up.

Your last suggestion of switching to STEP/DIR control is also an option if you need even more control over the specifics of the movement.

Brandon

Thank you for your hints.

This three possibilities are the same that I checked.

  1. I got hereby the smoothest stepper motor movement, but as you said, I can only approximately achieve a sine movement.

  2. I tried also this method, but using waitforposition (on Arduino or Teensy) I only get a halting movement. Do you have some ideas how to eliminate this halting?

  3. I tried also STEP/DIR, but I don’t know why, but it is to slow.

Hello.

How often are you sending incremental commands to the Tic? Can you explain what you mean when you say you get “a halting movement”? Including your Arduino sketch might be helpful as well.

For the STEP/DIR setup, if you have a program that seems to work well other than being too slow, you can post it here and we could take a look and see if we can suggest any improvements.

Brandon

Hello Brandon,

I uploaded three different sketches.

  1. Test_Tic.ino with only moving the stepper motor to two different positions. Like you already said, adjusting the acceleration only looks like an sine wave, but it isn’t.

  2. Test_Sinus.ino defines a sinus wave in the memory and with the factor of maximum range, I loop over the targetPositions to get reached by the stepper motor. This is in my opinion not the best solution, because it is really difficult to estimate an Speed value. But for some speed and positions ranges, it also works well. But using this sketch with the waitForPosition() function, it is not possible to get an smooth moving (what I said is a halting movement). The driver sets the velocity in every loop at the end of the movement to 0. I also get a picture of the stepper motor movement.

  3. Test_PID.ino is so far the best program. It is similar to the Test_Sinus.ino, but here I don’t use the positions the stepper has to reach, but compare the targetPosition to the currentPosition and estimate a sine wave. With this sketch I get the best sine wave.

If you have any hints or suggentions please let me know.

Thank you so far,

Patryk

Test_sinus.ino (3.8 KB)
Test_Tic.ino (1.9 KB)
Test_PID.ino (3.1 KB)