I did a project a few weeks ago where we used some SFH 9240 sensors to build a wheel encoder for an RC plane. The project was not very successful. The problem was that the sensors needed to be so close to work properly, and they seemed overly sensitive to light. We had a black encoder wheel with a white background. The black had to be SO BLACK that it was very difficult to keep ti that way. Also, the sensor had to be within about 1 mm, which was very close and hard to manage. The specs seem to indicate that the sensor would work much better than this, but in practice this did not seem to be the case.
It does not appear that there are any options for "setting" this sensor, other than perhaps changing the LED illumination.
I had expected this to be a pretty easy project, but it turned out to be a pain. What might I have been missing? I am not working on this particular project actively, but I do plan to revisit this in the future and would like some tips to avoid some of these problems in future designs.
I was able to ask a few knowledgeable people and here are few thoughts that came up.
Most of the hand controllers that use a light wheel to track joystick position or "power wheel" functions will use a slot sensor instead of a reflective sensor due to the speed and simplicity. You don't need to worry about distance from sensor (convergent point). Also, reaction to the light being cut off is much, much quicker than the reflective sensor.
The Osram sensor in question does not include modulation and so incident light will false trigger this sensor when exposed. A modulated light output might help with interfering light, but they tend to be more expensive and are hard (read: nearly impossible) to sort out which ones have the feature. Another related note, since the LED is also run continuously it is limiting the distance that you can use it.
This sensor has a cover to reduce incident light but doesn't help the power or distance issue that you are talking about.
You might also take a look at the AS5035 or other magnetic position sensors like those from austriamicrosystems. Their abilities and fine resolution might make for a suitable substitute in your application. Just use a neodymium magnet and have some fun.
Unless I'm misunderstanding your application, your best bet is probably to find a simple slot sensor.
I have used the Sharp GP2L24 (Digikey 425-2049-5-ND) for light/dark optical mark reading in a project I am working on, there are a couple things I have forund help improve success, limiting all external light to prevent the phototransistor from being false triggered, and a voltage adjustment for the LED to allow control of contrast. The application I am working on does not require much speed, so I don't know how you will fare with that aspect. The phototransistor is a darlington and is quite robust, though soldering easily damages the unit. Good luck.