Skip to content
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

Add stepper motor abstraction #26

Open
benschw opened this issue Apr 3, 2015 · 0 comments
Open

Add stepper motor abstraction #26

benschw opened this issue Apr 3, 2015 · 0 comments

Comments

@benschw
Copy link
Contributor

benschw commented Apr 3, 2015

I'd like to add a structure to manage stepper motors as seen in the 28bjy-48 sample.

There are a couple of trade-offs to be made between ease of use and flexibility though, so I'd like to get some feedback before moving forward. Different stepper motors have different stator configurations; different number of electromagnets, different alignments etc. This leads to a different number of pins needed and different sequence profiles.

Even for a single motor, different sequences can be used. For example, with the motor used in the sample, you can choose between powering one em (electromagnet) at a time (1, 2, 3, 4), or stair stepping across them (1, 1/2, 2, 2/3, 3, 3/4, 4, 4/1) for a slightly slower but more precise step. Or you can power two adjacent ems at a time for more torque (1/2, 2/3, 3/4, 4/1).

My inclination is to recommend building a Stepper that is configured with a factory (NewStepper) which accepts a slice of gpio pins and the step sequence to use (a slice of slices). This struct would implement all step-motor functionality.

Specific factories could then be developed for the most likely usage of a given stepper motor model. e.g. New28bjy48Stepper could accept 4 ints representing gpio pins and return a Stepper configured to use the more precise 8 step sequence.

I will take a crack at building this out as described, but I wanted to make sure first that the trade-offs involved were understood.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant