Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Stepper library: Fixed counter clockwise turn for four wire #4153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yoones wants to merge 1 commit into arduino:master from yoones:master

Conversation

Copy link

@yoones yoones commented Nov 15, 2015

Bug noticed when using a STEP MOTOR 28BYJ-48 5VDC.

When calling step(), the step motor always turned in the same direction regardless of the sign of the parameter given (a negative value wouldn't make it turn counter clockwise). This patch fixes the issue.

@yoones yoones changed the title (削除) Stepper library: Fixed counter clockwise turn for four wire ( (削除ここまで) (追記) Stepper library: Fixed counter clockwise turn for four wire (追記ここまで) Nov 15, 2015
Copy link
Collaborator

Your pullrequest seems to only add 2 files, not modify anything. Was that the intention? I suspect you added the updated files outside of the src directory. This makes it impossible to see what changed and review your PR. If you modify this (git commit --amend should help), you can force push to your github branch to automatically update this PR.

Regarding the bug you describe, I've seen the same thing and fixed it by swapping wire 2 and 3, assuming that my stepper had a unintuitive wiring. Your PR suggests that either you have the same, or the problem wasn't in the pinout of my stepper after all (though IIRC the AccelStepper required the same swapping of wires).

Copy link
Author

yoones commented Nov 18, 2015

PR fixed.

This fix comes from my understanding of https://en.wikipedia.org/wiki/Stepper_motor. If you look at the gif animation (right side), you see that each electromagnet is turned on alone, one after the other. Applying this let me turn the stepper motor counter clockwise as well.

Copy link
Collaborator

@yoones, the PR still contains a lot of incorrect and certainly unrelated whitespace changes, making review this diff harder than needed. Please be sure to look at your own diff before submitting a PR, and remove any changes that you did not intend.

As for the actual fix, it seems that you are switching from full step drive to wave drive, which only has a single coil active, but delivers less torque and thus isn't commonly used and, I think, shouldn't be the default here. Both are explained further down in the article you linked.

I'm out of time for now to figure out why the original code doesn't work. Perhaps the number of pins is inconsistent between the stepper motors and the library? (e.g. one starts with both pins of 1 coil, while the other starts with the first pins of both coils?)

Copy link

skniazev commented Dec 4, 2015

Take a look at #4250. The new version of the library and the example stepper_oneRevolution_ULN2003.ino must fix the issue.

@sandeepmistry sandeepmistry added the Library: Stepper The Stepper Arduino library label Jul 18, 2016
@yoones yoones closed this Mar 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Labels
Library: Stepper The Stepper Arduino library
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /