Hello,
I don’t know if I should start a separate topic when I have an additional question for the same project that isn’t along the same lines. If I am not doing this write, please let me know.
I have a 6 to 8 foot slider rail with a carriage that makes about six stops along the way to the other end and then goes home. How much on going calibration do I need? Once I have rev.(s) per distance measured and entered, I would guess that I just need one home switch that I would use.
I would think that I would want the carriage to get sent some extra distance past home and add some code that would shut it down when it hits the limit switch. Also, on power up, I would think that I should send the carriage out a few inches and then go home before proceeding on to the rest of the commands. Does a stepper motor need this at all?
Could you give me an example of an …if pin high stop? If at high speed, would I want it to stop on a dime of what?
When the motor powers down it will lose registration - it is worth calibrating on power up with a single home switch. While its running there should be no need to recheck - it is mis-stepping its an indication of inadequate torque, trying to drive it too fast (or accelerate it too rapidly). If all is well it shouldn't lose any steps while the power is on.
Limit switchs can do an emergency stop (its easier to program) - but then you may lose steps and have to re-calibrate. This should be an exceptional thing - in normal use the initial calibration together with the code knowing the safe range of movement should be all that's needed.
With big heavy loads you might want to program a deceleration on tripping a limit switch to reduce mechanical stresses.
Do you have an example of a couple of line of code that does this and a typical pin call out/definition? I guess that the count integer is set to zero as the carriage move away from home when you start?
Without knowing what controller or library I can't really give useful code example. Have a look for stepper libraries (there must be some more fully featured ones than the basic Arduino one)?