If you don't care which way the wheel is spinning (this can be useful information BTW), then simply putting a white stripe on the wheel or the output shaft, and leaving the rest black or unpainted (provided it isn't reflective) will give you your RPM information. All you have to do then is point an LED at it (red or IR will work fine), as well as a phototransistor (you might need a baffle or something between the LED and phototransistor, so that only the reflection of the LED off the shaft/wheel from the white stripe triggers the phototransistor, and not anything else). The phototransistor can then trigger a digital input (ideally, one being monitored by a pin-change interrupt ISR).
BUilding forth on Crosh's idea: If you care which way the wheel is spinning you can make a number of stripes on the wheel of increasing thickness. This will give you some sort of Pulse Width Modulation. The PWM signal will look different either "increasing or decreasing " and one big jump. Other patterns can be created; to detect direction a minimum/multiples of three different linethicknesses is needed. Name them 1,2,3. In your code remember the last linethickness (e.g. line 1) then the next line will be either 2 or 3 (CW or CCW) now the new last thickness is known and the wheel goes on and on and on.
(code not tested)
#define NONE 0
#define CW 1
#define CCW 2
int direction (int new) // new should be in { 1,2,3 }
{
static int prev = 0;
if (0 == prev) // only first time
{
prev = new;
return NONE;
}
int dir = (new - prev +3) % 3;
prev = new;
return dir;
}
my 2 cents,
Rob