Will update it here when I get feedback or feature requests:https://gist.github.com/4178431
Here's some help to get you started:http://arduino.cc/forum/index.php/topic,89159.0
Here is a brief summary of the code.
It can spin a full size DSLR on it's shaft without bearings at 30RPM!
Ramping up and slowing down to prevent bouncing.
It can measure torque to detect an abnormal load or error.
It works without blocking or waiting or interrupts.
Enhanced performance using 12v without warming up the motor.
And much more!
Sounds like an advert, but it's all for Free.
Hardware is $4.
bcw 1 is clockwise 0 is ccw
deg100 9000 is 90 deg
rpm100 1000 is 10 rpm, 100 is sec hand
rph100 hour 100 is like minute hand on clock
percslow 10 is 10% slow at end of move
steppos 90.0*STEPERDEG is 90 deg
xinrev 0,2,3,4,8x in 360 deg
revo # revolutions
const float STEPERDEG=float(64)*64/360;
These are ordered just like in the code:
void unramp (boolean bcw, long deg100, int rpm100, int percslow)
void unramp1 faster
void moveto (int steppos)
void movetodir (boolean bcw, int steppos)
void midspeedcool_12v (boolean bcw, long steps)
void ramp (boolean bcw, int rpm100)
void revRestart (boolean bcw, long revo, int rpm100, int xinrev)
void rev (boolean bcw, long revo)
void degrpmslowCool4 (boolean bcw, long deg100, int rph100)
void degrpm_nowait (boolean bcw, long deg100, int rpm100)
int calloften_micro (boolean bcw)
void degrpmslowCool (boolean bcw, long deg100, int rph100)
void degrpmEZ (boolean bcw, long deg100, int rpm100)
void move (boolean bcw)
1 line description for each function above:
unramp stops bounce at end of move
absolute position in degrees shortest direction
absolute choose direction
12v only 1/2 speed
speed up over 90 deg
restarts x in 360 rev
most efficient mAh
slow no wait
fast no wait
look at d in loop
cool 4 step
hot 4 step
mid 4 step
8 step 5 lines simple fast ramp, measure torque
8 step 5 lines +err 2.00deg move delay(10)
microstep speed limit 17RPM
relative move 1 step
ccwss() measures torque and halts program if spike to prevent damage
just hook motor winding to analog pin 0