I'm trying to find a sensor that is similar to the ones used in floppy drives to determine the track 0.
It's an optical sensor with about 3-4mm of space between the emitter and the receiver so that it can detect if the beam is interrupted.
All parts I can find are pretty large elements but I am looking for something small and I don't know what name they may have
An example of such sensor is on the photo here, the black part:
Additional question: I have a box moving on rails and it has 5 positions; the range is about 1m, precision about 0.5cm. Are these sensors the best way to go?
Best Answer
To add to what Olin said, the sensors are also known as "photointerrupters" when searching some of the distributors.
There are at least two major types of these sensors: Logic output and transistor output. Logic being the type that drives it's own output signal, and the transistor type acting more like a switch.
As for:
I don't see how you're going to use these sensors to detect a box's position if you want a "small" sensor. The beams are between two appendages about 1cm apart. So unless your box will fit in a 1cm space, you may want a different approach.
Note that you can use the same concept over a larger area, you just need separated emitters and "receivers". The kind used in the floppy disk drives combine the two into a small package. Instead, you'll probably want an emitter on one side of the box, and the receiver on the other.