Note RDL Version 2 is out: http://forum.arduino.cc/index.php?topic=469343.msg3213804
I want to share a handy Arduino sketch that I have been using to test various stepper motors and mechanisms.
In use, the user types movement and setting commands in serial port or serial monitor, to send commands to the Arduino.
Most movements are done with smooth stepping. Motor settings and timings are saved to the Arduino’s EEPROM, automatically.
There are hook-up instructions and pin definitions in the beginning of the code.
Video Manual RDL - Arduino Serial Command-Line Stepper Motor Utility - YouTube
Code Review: Coming soon.
- ? Shows command list.
- @ Shows position.
- . Shows settings.
- Automatically, saves many configuration settings to EEPROM.
- Most movements use sinusoidal smoothing with time-compensation code.
- Has variable/proportional analog single-axis joystick support for movement, rotation, and increments.
- Works with both Step/Dir and Step/Step type drivers by using “setdirmode” .
- Has a “setspeed” to divide the motor speed for testing.
- Floating-point position math used.
- Fits and runs on an Arduino Micro, barely.
- Supports “sleep” and “wake” to enable and disable the motor by driver.
- Has a g)oto command to move by absolute movement.
- Settable and goto-able: s)tart, h)ome, and e)nd positions.
- Has an “setlimitmode” option to use the n)one, h)ardware s)oftware, b)oth of the start and end positions.
- Has linear and rotary modes that can be set set with “setmode” .
- Has a l)inear mode that:
- Can be set with “setsteps” to move a given physical distance, such as setting it to 1200 per milimeter
- Has a m)ove command for relative movement.
- Homes using multiple revolutions if you are has moved that far.
- Has software limits that will not put the motor to sleep.
- Has preliminary hardware limit-sensor support that will put the motor to sleep.
- Has a default r)otary mode that:
- Can rotate by t)urn or d)egree.
- Can “divide” by a given number of segments, change them with “+” , “-” or the joystick, or user “/” to choose a particular one.
- Homes to closest angle of a single revolution.
- Can auto-home “ah” with optional EEPROM optional settable final offset for correcting mechanical misalignments.
- Has a “setmicrosteps” command to software set microsteps, after choosing “A4988” or “DRV8825” with “setdriver” .
- Has an option to automatically scale your current steps during a “setmicrosteps” microstep change.
- You have already been introduced to 23 of RDL’s 39 commands.
Note: Compiles fine on Arduino Micro and 1.8.1, but may give memory error with older Arduino IDE.
1.158 Changed limit and E-Stop default states for easier first-time setup for without switches.
1.157 Fixed joystick bug where if it were absent, the motor would run. To use joystick, it must now be enabled in code.
1.157 Flash Memory Use Down by 3% by adding the joystick enable. I am not sure why, but okay.
Version 2 is out! http://forum.arduino.cc/index.php?topic=469343.msg3213804
Enjoy : )
RDL_158.ino.ino (62.3 KB)