A Command-Line Stepper Library with All the Frills

When you already know exactly where and how you’d like your motor to behave, a code-compile-flash-run-debug cycle can work just fine. But if you want to play around with a stepper motor, there’s nothing like a live interface. [BrendaEM]’s RDL is a generic stepper motor driver environment that you can flash into an Arduino. RDL talks to your computer or cell phone over serial, and can command a stepper-driver IC to move the motor in three modes: rotary, divisions of a circle, and linear. (Hence the acronumical name.) Best of all, the entire system is interactive. Have a peek at the video below.

The software has quite a range of capabilities. Typing “?” gets you a list of commands, typing “@” tells you where the motor thinks it is, and “h” moves the motor back to its home position. Rotating by turns, degrees, or to a particular position are simple. It can also read from an analog joystick, which will control the rotation speed forward and backward in real time.

Division mode carves the pie up into a number of slices, and the motor spins to these particular locations. Twelve, or sixty, divisions gives you a clock, for instance. Acceleration and deceleration profiles are built in, but tweakable. You can change microstepping on the fly, and tweak many parameters of the drive, and then save all of the results to EEPROM. If you’re playing around with a new motor, and don’t know how quickly it can accelerate, or what speeds it’s capable of, nothing beats playing around with it interactively.

Right now, there’s not much documentation aside from the code itself and the attached video, but actually that looks like all you’d need to get started. So if you’re looking to replicate Hackaday’s [Moritz Walter]’s excellent stepper-driver shootout, a tool like this is just the ticket.

23 thoughts on “A Command-Line Stepper Library with All the Frills

        1. If you squint (with your imaginary eye, think Mad Eye Moody), sinusoidal *is* exponential.

          On a more practical note, you want curves which lead from one still-stand (i.e. zero derivative) to another, and there exponential lose (they have no zero derivatives, not in the real realm) and sinusoidals win.

          If you want continuous derivatives up to arbitrary orders (from/to stillstand), as has been mentioned downthread, check the bump function[1]. For interesting alternatives (e.g. linearly changing acceleration) there are clothoids [2], [3].

          But sinusoidal is fine here.

          [1] https://en.wikipedia.org/wiki/Bump_function
          [2] https://en.wikipedia.org/wiki/Euler_spiral
          [3] https://en.wikipedia.org/wiki/Vertical_loop

    1. Hi,

      Properly tuned, sinusoidal acceleration should be smoother than linear acceleration in most cases.

      I was talking to a mathematician this week, who mentioned another which would be better yet, but the code would be slower to execute.

  1. I worked in a very simple class to drive steppers with Raspberry Pi via commandline (backend made in python), the class only move the motor in steps (you specify the target steps), any one have interest in this? to upload some info

  2. I have a box full of commercial stepper servos like this. They have an ascii protocol and modbus. Also support sinusoidal acceleration. There’s a scripting support, so they can run small programs independently. But they are not perfect, there are some limitattion. I’m waiting for spare parts and i’m planning on either enhancing them (or atleast few of them) somehow (would probably have to recreate the program) or replacing the controller completely.

  3. Thanks! I’ve got a bunch of Arduinos and stepper driver boards to go with them. This should be very handy for testing. In general I prefer forth for this sort of task, but I’ve not messed with a forth for the Arduino boards yet.

      1. Thanks you : ) Though, seeing that my main computer is off for repair, I am focusing on tracking down bugs and use cases from feedback. I should find some local Arduino community around here and ask for testing help. Well, I did the best I could.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s