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

mm or degrees? #3

Closed
forna91 opened this issue Oct 14, 2020 · 4 comments
Closed

mm or degrees? #3

forna91 opened this issue Oct 14, 2020 · 4 comments

Comments

@forna91
Copy link

forna91 commented Oct 14, 2020

Any solution for change the unit from mm to degrees? or reset the position when position is 360.000mm?

@pkerspe
Copy link
Owner

pkerspe commented Oct 14, 2020

You can just use steps if you want to set the shaft to a specific degree.
Usually most steppers have a step angle of 1.8 degree for a full step.
If you use microstepping you can break it down accordingly.
So it depends in general on your setup how many degrees of rotation is one step.
Does your stepper driver support microstepping?

In general you will have a Hard Time to move by full degrees if your stepper motor has 1.8 degree steps, since you would need to use a microstepping multiplier that allows you to get a small enough fraction of 1.8 to perform exactely 1 degree of rotation.
E.g. if you use 64 microsteps, the smallest rotation with one microstep is 1.8/64 = 0,028125 degrees.
Now the closest you get to 1 degree of rotation is by performing 35 or 36 microsteps, which will give you either 0,984375 degrees or 1,0125 degrees of motion, but never exactely one degree.

So you have two options:
1.) Increase the microstepping to the highest value your driver supports and get as close as possible to the required resolution you need
2.) use gears with a 9:5 ratio so that one full step is exactly 1 degree of motion (and with microstepping you can also get 0.5 degree with a half step or lower resolution)

Now that you know how many steps are a degree of rotation you can just configure the stepper motor in the setup menu with this number in the field where you enter the steps for one Millimeter of movement.
Now when you send the command to move "1 mm" it will actually turn 1 degree. So for your setup 1 mm would just be equivalent to 1 degree

@pkerspe
Copy link
Owner

pkerspe commented Oct 14, 2020

Please specify what you mean with "reset the position when..." do you want to move the stepper back to, for example zero when you reached a specific position or do you just want to reset the counter in the UI? Or do you want to reset the position counter in the server?

@forna91
Copy link
Author

forna91 commented Oct 14, 2020

I have a reduct stepper motor so the precision is not a problem, in my case the stepper turn a "wheel" and a complete turn is 0- deg, if I do one turn and half I wold like to be at 180° and not 540° or mm in the case of this library, can I reset the position after passed the 359.999mm?

@forna91 forna91 closed this as completed Oct 15, 2020
@pkerspe
Copy link
Owner

pkerspe commented Oct 15, 2020

what you need is probably kind of an event listener / callback function registration that allows you to reset the internal step counter.
Something like registerTargetPositionReachedCallback() but for position updates.
It is not implemented at the moment, but it should not be to difficult to implement something likes this with only a little decrease in performance.

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

2 participants