Questions about the "find natural direction" procedure

At init time, in order to find the natural direction of the motor, the library starts at 3PI/2 electrical angle and progressively turns the motor one electrical revolution in one direction, then one electrical revolution in the other.

  • Why a full electrical revolution? Couldn’t this be smaller? (like PI, PI/2, etc.)
  • Why moving progressively? Couldn’t we jump directly to 2*PI, then back?
  • Why starting at 3PI/2 electrical angle? Couldn’t we start at any angle? (like 0)


Yeah, it’s all arbitrary. You can modify it however you like. And it always annoyed me that direction and zero angle are done as separate steps, due to the averaging thing mentioned in my post in your other thread. Zero angle is what really needs bidirectional movement, but instead it’s only used in the direction detection, which only needs a single step in one direction to get a good reading.

EDIT: I’m not sure about the last point (starting at 0 versus 3pi/2). It should be an angle that corresponds to one of the motor’s cogging step positions, but I don’t know for sure which angles that would be. If 3pi/2 is one of them, then 0 would be half way between steps. And now that I think about it, that could explain why I always have to finetune the zero angle by hand on my motors that can’t hold position between steps…