I have a stepper that will be turning an approximately 2" disk. I am trying to figure out a good way to detect a zero, or home, position for the disk. I grabbed one of these optical interrupters, or slotted optical switches http://optekinc.com/datasheets/OPB963N51.pdf. It consists of an aligned ir led and photodetector, and some conditioning logic for the photodetector circuit to give nice clean logic changes when the led light reaches the detector, or is blocked. (The particular one I got puts out a high output when the light is blocked, and a low output when it reaches the detector.)
If the disk were thin enough, I could pass it though the slot in the optical switch and drill a small hole at the zero position. (More on the accuracy of drilling this hole in a minute...). Unfortunately, they do not make a switch with a slot wide enough to accommodate the thickness of my disk. So I figured I could maybe attach a fin of some kind to the disk, and have that pass through the switch. I could detect the rising output when the fin starts to pass through the slot from either direction. Then I could drill a hole in the center of the fin (or cut a thin slit) and wait for the output to fall when the hole (or slit) was reached.
What I am having trouble figuring out is how to do this accurately enough. Like many, my stepper has 200 steps per rev, or 1.8 degrees. Further, my stepper driver chip does up to 32 microsteps (or 2, 4, 8 or 16 microsteps) per step. I don't know that I would use microsteps that small, but if I did, that is less than 0.06 degrees, and at a 2" radius translates to less than 0.002". I don't know how I would make a small enough hole, situated exactly at the 0 position.
I would appreciate any suggestions. The optical switch I got was a $3.00 part, so I'm not concerned about not using it if there is an entirely different way to go about it.
Most industrial equipment that uses stepper motors use a thin metal strip called a "flag" that is srewed onto the moving part to serve as the interrupter piece that passes through the opto. Also, if you read the specs for the Home sequence, it goes something like this. The stepper drives toward home until the home flag is detected. It continues without stopping for about 10 steps and reverses direction and backs out of the flag slowly until the flag is no longer interrupted. Then at a very slow speed it reverses one more time and creeps toward the sensor until the opto changes state . Then it stops. Homing complete. I should mention that when if first detects the flag it starts counting steps and reverses at about 10 steps. When reversing toward the flag it is decrementing the counter variable that it was incrementing going past the sensor. So it knows when it should detect the sensor in the reverse direction . There is a variable set by the programmer that determines how many steps past "0" it will go before generating an error.
When you watch the equipment homing , you see it going at a slow speed but not a crawl. As soon as the flag interupts the sensor
you can hear the motor speed drop to a crawl until it stops and reverses at an even slower speed . The whole sequence takes barely
more that a second once the flag gets to the sensor.
A hole or slot is commonly used for the zero position of a disk. If you can't find an optical interrupter switch wide enough for your disk, you can make your own using just an LED, a photodiode and the appropriate resistors. You probably won't need signal conditioning circuitry.
I don't know that I would use microsteps that small, but if I did, that is less than 0.06 degrees,
Microsteps are not accurate and are not intended for accurate positioning. Instead, microstepping is intended for smooth running and for avoiding the resonances that crop up with full step motion. If you need more accurate positioning than 1.8 degrees, you should gear down the motor.
@Pincorrect, following on from that, you don't need a hole in your "flag". The edge of the flag will be a suitable indicator point.
You may want to mount the detector so it can be moved a little to ensure that the home position aligns exactly with a full step position on the motor. Much easier to move the detector than to position the flag with pinpoint precision.
I wouldn't worry about the size of the hole, the transition happens on the edge
of the hole, which is repeatable whatever the hole size. Just be sure to
callibrate to the same edge in the same direction every time (and maybe exclude external light).
Thanks, everyone, for all the great advice, and especially raschemmel for that excellent explanation of how the flag is used. Looks like I was kind of headed in the right direction, but this all helps greatly. I'll attach the flag to my disk and write a homing routine to carefully detect the edge. No need to drill a precisely positioned hole. I got the version of the opto switch with a tab on either side for mounting bolts. I'll have these go through slotted holes so I can adjust the position of the switch to tweak the exact location of the home step. And I'll use whole steps for calibration.