28BYJ48 stepper motor issue


I’m trying for a project to use a 28BYJ48 stepper motor, with the driver included with it. I would like to use it as a directional motor. Thus i would like to know if there’s any way to set it in a “0 degree position”, with the motor shaft right compared to the motor. I would decide thereafter how many degrees (then steps) the motor need to do.

Thanks for your help

Stepper motors have no means to identify their own position.

The usual way to do that is to arrange for the motor (or whatever it is moving) to trigger a limit switch when it reaches the HOME or ZERO position. Then code that is called from setup() can move the motor until it triggers the switch ad that tells the Arduino that it should count that position as zero.

After that the Arduino can know the position by keeping track of every step - assuming the motor does not miss steps because it is overloaded.

Microswitches or optical detectors are commonly used as limit switches.