A useful gear tooth sensor that wires directly into a digital input is the Allegro Microsystems ATS667LSG. We like to use them when we need speed information but not direction information and we don't need the highest resolution. We also like that they're $6.
In the photo below an ATS667LSG is mounted to a carrier board and installed in the side of a Cim-u-lator gearbox, with its face about 0.03" from the output gear. It gives us a nice, clean 27 pulses per output shaft revolution. The sensor on top of the right motor is just posing for the photo.
