I bought a 5V digital ir sensor and connected it to my arduino uno without resistors or any other pieces. This worked perfectly, i got a clear on/off signal to my computer.
But when i power the sensor with 4 1,2V AA batteries (the arduino is still powered by usb), and put the signal wire into the digital port, the output on my screen is messed up. As if i put a loose wire into the digital port.
Seems to be an IR emitter/ detector pair in a housing, both facing the same way. Distances to suitably reflective object of 3-80 cm can be detected. The description speaks of that as being "adjustable", so I infer that the device generates a digital output saying "closer than/ farther than what I'm set to."
I'm not sure why in an Arduino application, unless you have used up all your analog inputs, or want really rapid processing of "anthing closer than...." this is better than the sort of sensor it is based on, e.g...
... and similar (search for "proximity") which return an analog reading of distance in various ranges.. one is 15cm-150cm, for instance.
Oh. device cited by OP: $7.50. "Fancier" one: $15. But it gives you so much more!!!
Have a read of some of the comments on the product pages... useful.