I am working on a project that requires mildly accurate positioning of the x and y axis. It involves an airsoft gun and it is basically a motion tracking turret. Because of the requirements for movement that could be tracked I determined that a stepper motor would probably be the best option. I have ran into a problem though while picking the motor and a driver or even if I am going to stay with the stepper motor idea. My question is how do I know when my stepper motor is done moving like is there a pin that goes low on most drivers saying that the motor is done moving? Or should I just move onto using a servo. I choose stepper motors because they were powerful and relatively cheap but I don't really understand how to control them. I understand the whole signal sending idea and I will be using the accel-libary with an arduino to control it but how do I know when to give the motor a new position. Also as a side note will a motor with a torque rating of .1416 in-pd's I will be using a .5pd airsoft gun and will mount it in the middle of it's center.
Stepper motors are actually not very powerful compared to a geared DC motor, but they have the advantage of providing accurate positioning without needing a feedback mechanism. The whole idea of a stepper motor is that it only moves when you step it, otherwise it stays put. So the answer is, it's done stepping when you stop stepping it!
However this only works reliably if you:-
- Don't step too fast, or accelerate and then try to slow down too quickly.
- Supply enough holding current to stop it from slipping under heavy load.
- Have some way to detect or set the 'home' position.
Some early disk drives set the home position by simply stepping in one direction enough times that the mechanism must have hit its end-stop, which would make a horrible clattering sound if the heads weren't on the innermost track!
I don't think you can know that. From the datasheets that I've read on stepper drivers, they always (micro)step on every pulse from your software. There's also a direction pin: high = one direction and low = the other direction. That's about all that your software gets to worry about, as far as the driver chip is concerned. After that logic is done, then the driver chip does whatever voltage/current limiting needs to be done and may or may not tell you anything.
So basically, you get to know your application well enough that you can give it enough juice but not too much (adjustability is good here) and that you never pulse it faster than it can keep up with, and then you assume that it's always in the correct position. If you've satisfied the first part of that statement and it's not jammed, then the second part is generally true too.
You can also add encoders, switches, or other sensors to help you know where it is instead of assuming. If you care about absolute positioning, you might want at least one "home" switch that you can find on startup and then navigate from there. If you want limited travel, then you might want a limit switch at either end that can also function as home switches. Write your software to never overrun the limit switches. :)