waspinator / AccelStepper

Fork of AccelStepper
http://www.airspayce.com/mikem/arduino/AccelStepper/
Other
146 stars 86 forks source link

MotorInterfaceType using easydriver and 4 wire stepper using expeceted enumerator does not work as expected. #8

Closed bkapadia01 closed 3 years ago

bkapadia01 commented 3 years ago

I'm using a 4 wire bipolar stepper with easy driver using step/dir/MS1/MS2 as pins 2,3,4,5 respectively. Using the easy driver code I can successfully perform half step rotations.

When using the AccelStepper library and code that causes the motor to go in forward and then in reverse for a few seconds using FULL4WIRE and HALF4WIRE causes the motor to not reverse when expected and continues to spin in one direction AccelStepper stepper(AccelStepper::FULL4WIRE, 2, 3,4,5) AccelStepper stepper(AccelStepper::HALF4WIRE, 2, 3,4,5)

Using DRIVER or FULL2WIRE works as expected in terms of forward/reverse of the stepper although FULL2WIRE behaves like a half-step. AccelStepper stepper(AccelStepper::DRIVER, 2, 3) AccelStepper stepper(AccelStepper::FULL2WIRE, 2, 3)

stepper: https://www.sparkfun.com/datasheets/Robotics/SM-42BYG011-25.pdf driver: https://learn.sparkfun.com/tutorials/easy-driver-hook-up-guide/all

The current documentation is unclear. Does using DRIVER/FULL2DRIVER mean we can only using step/dir pins and not MS1/MS2 for half steps? is this a limitation of using the easydriver with AccelStepper library? What is the difference between DRIVER and FULL2DRIVER? If I want to use the MS1/MS2 for half steps how I can I use that using AccelStepper library if 4 wire stepper does not work with the FULL4/HALF4? Does the Caution for blocking delay apply to all enumerators types or just DRIVER?

Number of pins to interface to. Integer values are supported, but it is preferred to use the MotorInterfaceType symbolic names. AccelStepper::DRIVER (1) means a stepper driver (with Step and Direction pins). If an enable line is also needed, call setEnablePin() after construction. You may also invert the pins using setPinsInverted(). Caution: DRIVER implements a blocking delay of minPulseWidth microseconds (default 1us) for each step. You can change this with setMinPulseWidth(). AccelStepper::FULL2WIRE (2) means a 2 wire stepper (2 pins required). AccelStepper::FULL3WIRE (3) means a 3 wire stepper, such as HDD spindle (3 pins required). AccelStepper::FULL4WIRE (4) means a 4 wire stepper (4 pins required). AccelStepper::HALF3WIRE (6) means a 3 wire half stepper, such as HDD spindle (3 pins required) AccelStepper::HALF4WIRE (8) means a 4 wire half stepper (4 pins required) Defaults to AccelStepper::FULL4WIRE (4) pins.