Site hosted by Angelfire.com: Build your free website today!

Serial-Port control for Stepper-Motor


Wiring:



This is a simple interface to control a stepper-motor via a serial-connection. The idea is, to send a movement- or setting-command from a remote control-box (not shown) to the Arduino/Stepper to move it.

I use a cheap 5€ 5V/200mAh/60Ω stepper with 96 steps/rev (3.75° steps), 6 cables (2 common ground);
I have no idea if it's unipolar or bipolar or whatever, so please don't ask. It has very little torque but works very well for this test

I intend to use it to control the x/y-axis on a DIY-3D-Plotter.

Command: Result:
s### change number of steps to ###
f.x. s100 sets the motor to do 100 steps on execute
d# sets the direction of rotation to #
valid options are 1 for FORWARD and
2 for BACKWARD
everything below 1 is set to 1,
everything above 2 is set to 2
m# sets the stepper-mode:
1 for single-stepping,
2 for double-stepping
3 for interleave and
4 for microstepping
everything below 1 is set to 1,
everything above 4 is set to 4
r### sets the stepper-speed to ### rpm
r96 for 96 rpm (default)
r0 sets the rpm to 1, anything below 1 would crash the script
you might have to experiment for best settings for your stepper
v prints out the current settings
no additional parameters needed
(enter) runs the motor with the current settings
(no feedback)
e prints out the current settings and starts the motor
(combination of "v" and "")
x return the stepper to the original position
(not yet fully working)
? shows a short help the available commands
(this table)
anything else is currently being ignored


Download



Still to come:
* stepper-selection via serial * serial-control for pen-servo