Sorry to take awhile to respond. I took time off for the holiday and to make the other (rotating) part of the sensor shown above. I have gathered from my reading that the advice given above has been right on. Let me add a couple of clarifications and some purely operational questions.
I do not think the current taken by a stepper motor changes much when it is stalled so I don't think the Imax sensor idea will work. I think detecting contact with a mechanical stop would work better. (Or just allow enough time to be sure it has reached the stop.)
Les.
That is certainly true for the gauges being discussed. However, Microchip's application note (AN906) does use Imax in the non-modulated winding to sense stall in a stepper that is being driven with higher than rated voltage to attain greater torque (e.g., a motor rated for 0.5A @ 5V being driven by 12V). My Switec gauge arrived Saturday. It is rated for 5V and will be driven at that voltage.
What does change when these motors are stalled is the back-emf profile in the driven coil and the generated emf in the non-driven coil. It is those voltages/currents that are used to detect stall in several of the smart drivers, such as the ST L9942, Cypress CY8C24xxA (see: Cypress AN2197), and the afore mentioned Freescale series of devices (e.g., MC33991). That is what I was thinking of measuring/detecting to detect stall, if necessary. The ultimate question is whether it is necessary. I am leaning strongly toward thinking it is not necessary to do.
If you look at a car dash that uses these you'll notice that on power up the guages rotate to full scale then back to zero, this is to reference them, there are 2 ways of doing this, the guage movements have hard stops at zero and fsd, if you give the movement enough pulses to go from one end of the scale to the other you can be sure its on the end stop, if you go to fsd then back to zero then you are not stalling the motor, and it looks good.
There is a max speed that if you exceed then you'll loose sync, it is quite quick though.
It is easy to see how driving past the stop at FS and then counting back to the zero stop would allow one to accurately calibrate the gauge, but I can't see how driving past both stops would allow that to be done. From a practical standpoint, I suspect one can assume that any given gauge will have a constant number of full steps between FS and zero, so when one is known to be at FS, it just needs to stepped back that distance. In my case, I will be stepping back half that number.
The datasheet I have for my gauge indicates a maximum speed of 600°/s and a start-stop speed of 200°/s. Rotation is 315° and number of steps between stops is about 600. I will probably have "up" and "down" buttons for the user to fine tune the indicator "zero" position depending on operating conditions. Also plan to use only half-step mode and nothing finer.
What is the other way of indexing them? Are you referring to the methods to detect stall?
QUESTIONS:
1) How reproducible with a single meter are the number of steps between stops (full-step mode)? Switec gives a specification for mechanical play of ±0.5° (max. 1°).
2)
dr pepper : I am curious which PIC's you have used? Did you use the enhanced PWM capabilities like in the 16F684? I don't have that chip, but I do have the 16F1829.
Regards, John