## step size problem with motor shield v2.3 and 28BYJ-48 (5V) s Moderators: adafruit_support_bill, adafruit

step size problem with motor shield v2.3 and 28BYJ-48 (5V) s

Hi, I am new to arduino, and I have questions about scaling down the steps per revolution for the stepper motor, because I read the data file of this motor, 28BYJ-48 (5V) stepper motor, and it mentioned that it has 64 steps per revolution, and a gear reduction ratio of 1/64, so does it mean that I can have 64*64 = 4096 steps per revolution? But when I type 4096 in the code for determine the steps per revolutions, it does not have any difference to putting 64 or 200(in the stepper test), so I am not sure what is the problem here, or is there anything that I misunderstood?

The code is Adafruit_StepperMotor *myMotor = AFMS.getStepper(4096, 2);

suppose it is 200 instead of 4096 in the stepper test example.

Thank you very much for the help. :)

samho123

Posts: 5
Joined: Sat Aug 12, 2017 3:17 pm

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

Not sure, someone may correct me but the steps per revolution is for the motor not the end shaft so 64 is the correct value and the shaft rotation you would manage in your code. The variable in the library is a uint8_t which can only hold a number of 255 or less.

franklin97355

Posts: 18217
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

franklin97355 wrote:Not sure, someone may correct me but the steps per revolution is for the motor not the end shaft so 64 is the correct value and the shaft rotation you would manage in your code. The variable in the library is a uint8_t which can only hold a number of 255 or less.

Do u mean the first number I put inside the bracket? but isn't that the number of step?

myMotor->step( 1, BACKWARD , MICROSTEP);

Because when I put 64, and I put 1 in the number of step, the resultant step is quite big, so I need a smaller movement on the motor in order to fit in my sensor range.

samho123

Posts: 5
Joined: Sat Aug 12, 2017 3:17 pm

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

These motors are a commodity item and the exact specifications vary somewhat depending upon the supplier. The steps per revolution are generally about 512. But the internal gearing differs somewhat from motor to motor. The last tear-down I did on one of these can be seen here:

viewtopic.php?f=31&t=41608#p210339

Posts: 67253
Joined: Sat Feb 07, 2009 10:11 am

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

adafruit_support_bill wrote:These motors are a commodity item and the exact specifications vary somewhat depending upon the supplier. The steps per revolution are generally about 512. But the internal gearing differs somewhat from motor to motor. The last tear-down I did on one of these can be seen here:

viewtopic.php?f=31&t=41608#p210339

I have read the post you attached, and tried the way to test how many steps per revolution of the motor, and it is about 513 steps per revolution when Im using microstep and tried with 513 steps, it turned about a whole revolution.

so does it mean that if I use microstep, is 513 steps per revolution the smallest step I can get? Or it is possible to have a smaller step by coding the microstep?

thank you for the help :)

samho123

Posts: 5
Joined: Sat Aug 12, 2017 3:17 pm

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

Microstepping is intended for smoother operation - not for higher resolution. In the library, the requested step count is multplied by the microstep count. So while the total number of steps taken is increased, you can only start and stop on a full-step.

Posts: 67253
Joined: Sat Feb 07, 2009 10:11 am

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

adafruit_support_bill wrote:Microstepping is intended for smoother operation - not for higher resolution. In the library, the requested step count is multplied by the microstep count. So while the total number of steps taken is increased, you can only start and stop on a full-step.

Because the thing I work on is attaching mirrors on the motor and reflecting laser beam to track a sensor, and when the laser is moving by a full step, it is out of my sensor range, which I can't have a more precise alignment to the center of the sensor.

Although the motor has to move by full step to track the sensor, is it possible to move more precise when doing the alignment? Because in the code I am planning to have interrupt when I got readings from the sensor, so the motor no longer to increase the number to steps, and will it able to do like half step or even smaller?

thank you for the help. :)

samho123

Posts: 5
Joined: Sat Aug 12, 2017 3:17 pm

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

You can use the onestep() function to make individual microsteps. But as the function name implies, it will take only one step at a time. You would need to do your own step counting and step timing, but it would let you position to 1/16 of a full step.

Posts: 67253
Joined: Sat Feb 07, 2009 10:11 am

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

adafruit_support_bill wrote:You can use the onestep() function to make individual microsteps. But as the function name implies, it will take only one step at a time. You would need to do your own step counting and step timing, but it would let you position to 1/16 of a full step.

I tried it, and it worked!!

Thank you so much for the help :)

samho123

Posts: 5
Joined: Sat Aug 12, 2017 3:17 pm

Re: step size problem with motor shield v2.3 and 28BYJ-48 (5

Good to hear! Thanks for the follow-up.