SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By jgvicke
#108830
I have not really used stepper motors before and am about to start a project with them. I will need to find a hard stop with a stepper motor and wondering what ways are available to do this? I have don't some google searching but have not come up with a reasonable solution.

Also, the stepper motor on the website looks great but is out of stock. Does anyone know when there will be more stock available. (http://www.sparkfun.com/commerce/produc ... ts_id=9238)

I also would appreciate some input on a good PIC controller to start out with, if anyone has had good luck with a particular product.

Thanks

John Vickers
By lyndon
#108878
The way we've done this is to have a controller that allows adjustable motor current. This is just to reduce the amount of damage you can do; so make sure that the motor won't break your stop or itself if you can't control the current.

Next you need a Home location with a sensor. The sensor can be a mechanical limit switch, optical or Hall Effect. Used all of the above and the mechanical ones seem to be most repeatable.

Now all you have to do is run the motor in the direction of the stop (at low power if possible) for a number of steps that you know will exceed the distance to the stop. So let's say the stop position is 50-100 steps from Home, run the motor 150 steps in that direction. Now set motor to normal current and zero your step count and run it slowly back home, looking for the home sensor with each step. When you find the sensor, the step count gives you the distance to the sensor.

This assumes you're controlling the stepper yourself from code. If you're using a purchased stepper controller board, be sure it has a "home" feature where it will look for the Home sensor. Sorry, I don't have one I can recommend; I've only ever used custom built controllers.
By evarobotics
#108945
Another method is to use a course encoder - it doesn't need to be anything flash, but it should be at least the same resolution as the motor (i.e. 200 pulses for a 1.8 deg stepper)

Drive the motor toward a hard stop (limiting the current is a good idea if you can) and watch the encoder.
When the motor hits a hard stop it will push against it for one step, then it will loose sync and move backwards 3 steps.

Basically your code should watch the encoder counting in one direction, then stop when you see the encoder count backwards by more than a step.

I could recommend you use our stepper motor controller, with homing, torque control, never looses sync etc, but that would be distasteful.