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

New feature: calibrating between two points (home and max position) #6

Open
xander-m2k opened this issue Jan 5, 2021 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@xander-m2k
Copy link

I am trying to calibrate between two points, so limit switches on both sides. This means I will first be calibrating on the home position (which you do have a function for), and then move to the other side, until the limit switch hits, and setting that as MAX_STEPS, so it cannot move any further than that point.
That means if you try to do an absolute or relative-move, and that comes above MAX_STEPS, it will just stop at MAX_STEPS.

You can now use the limit switch feature to get around this nonexistent feature, but the following functions could be implemented:
void startHomeAndLimitCalibration(int beginLimitSwitch, int EndLimitSwitch)
(maybe an extra callback function for when this is finished)
int getMaxSteps()
void setMaxSteps(int maxSteps)
void moveToMaxSteps()
bool isHomeAndLimitCalibrated()

There could be something I am forgetting, but I think this gets you a good idea of what I mean

@pkerspe pkerspe added the enhancement New feature or request label Jan 14, 2021
@FrankNz
Copy link

FrankNz commented Apr 7, 2024

Hi Firstly thank you for the work you are doin got this software. We are using it at an Aviation museum to drive a model of a Link Trainer.
Added to the above..
It would be useful to know when the limit switch (Min || Max) is activated. If I do not know which switch is activated (eg at power on) I could try drive the stepper in the wrong direction which would result in some very bent metal!
Is some work on this problem being contemplated? possible timing?

@pkerspe
Copy link
Owner

pkerspe commented Apr 7, 2024

Hi Frank,

You could call Arduinos digitalRead(...) function to check which limit switch is triggered after booting. Then you need to set the direction of the initial move accordingly to move in the opposite direction.

You might also have a look at the example https://github.com/examples/Example4_Limit_and_latching_EmergencySwitch/Example4_Limit_and_latching_EmergencySwitch.ino
But instead of using two limit switches wired in series for start and end, you use two switches connected to individual pins of your esp. than you update the code to read both input pin values at startup (and also attach an interrupt for the second input pin to update the rest of the logic) and by that you know on which side of the linear movement path you are and can set direction to the opposite end on the first move.

@FrankNz
Copy link

FrankNz commented Apr 7, 2024 via email

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

No branches or pull requests

3 participants