Stepper motor knock return

Hi everyone

I'm controlling a stepper motor with the AccelStepper library on arduino (all working) but I want to have the the stepper return to its previous position if moved with force. So if the stepper was in one position and someone forcibly moved the stepper to a position after about a second or so the stepper would return to that previous position.

The only way I have figured is using a optical sensor but I am having trouble finding what its called and where to find one, I found a picture of what I want and what type of optical set-up that is preferred.

What are the steppers called that can have the encoder disc attached to one end.

Is there any other ways of doing this?

Thanks

Ian

With a bit of extra circuitry, you could have a sensor that would detect the movement from the output on the motor coils. As soon as it gets forced to move one step, your code could then move it voluntarily.

It would, however be better practice to simply add a button for this very function.

KenF:
It would, however be better practice to simply add a button for this very function.

moving the stepper forcibly is only if it gets knocked accidentally, it would move back to the position it was in.

Hi, a photo interceptor interrupter.
Two of them.
Tom.... :slight_smile:

I think the thing you are looking for is a rotary encoder.

But, really, what you are proposing is not how stepper should be used. You should choose a motor that can hold its position against all reasonable forces.

Adding an encoder will significantly complicate the code. For example what happens if the code to move the motor does not agree with the feedback from the encoder even if there is no external force.

You probably need to get an encoder that has the same number of steps as your motor, or an exact multiple.

...R