The MOC7811 is a infrared based optical sensor. It contains an IR emiter and receiver pair mounted facing each other. It can be used with encoders to detect wheel speed, angle, etc.
Comes in a small plastic package making it easy to mount it even in tight places. Also, has two holes on its body which can be used to mount it easily.