Go Down

Topic: Stepper library with half-steps (Read 3715 times) previous topic - next topic


I changed the stepper library to accept half steps too.

The old constructors stay, so older sketches keep running with my update. I added a constructor to accept a boolean use_half_step:
Code: [Select]
int number_of_steps,
int motor_pin_1,
int motor_pin_2,
int motor_pin_3,
int motor_pin_4,
int use_half_step

This new constructor sets a private so the function step() can determine if it should use 4- or 8-steps.

This allow a double-precision of stepper motors.

My question:
Anyone interested in taking this in the standard library? Otherwise, I change the name to be my private stepper lib and publish it like that on my site...



Sounds useful.  Can you post a description and a patch to the Google Code issues list: http://code.google.com/p/arduino/issues/list?


Nice addition John_NL, Works well, for anyone else trying this you need to remember when declaring the stepper object to double the original step number otherwise it will 'jump' on certain steps.  so if you usually declare:
Stepper myStepper = Stepper(20,2,3,4,5);

for half stepping it should now be:
stepper MyStepper = Stepper(40,2,3,4,5,1);


Hi Guys,
This is really cool. How do I get hold of a stepper.h with this feature in it?

I'm working on a controller for focus on a microscope and I was hoping I could add the feature to allow to change the stepping type between the three options (single coil, two coil, and half step). The single coil is smoother than two coil but with less torque and obviously the half step has a higher resolution. I notice that the stepper.h currently only uses two coil driving. I'd like some advice on how to go about writing in this type of functionality and enabling single coil mode just as you have enabled half step mode with the hack you have written about here.



Thanks a lot John!

Seems to be working for me.

For Adrian in your Arduino folder there is sub folders hardware libraries and stepper, back up the two stepper.h and .cpp files and replace them with Johns.


thx a lot John,

@Reggie:I think you are wrong,sry. You have to declare the orignal (physical) step numbers which your stepper is able to move.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131