This extra-long-range SHARP Distance Measuring Sensor unit 100 to 550 cm – GP2Y0A710K0F with cable bounces IR off objects to determine how far away they are. It returns an analog voltage that can be used to determine how close the nearest object is. These sensors are good for detection between 100cm-500cm (1-5 meters / 3-15 feet).
The long range makes them a good alternative to sonar sensors.
Please note: the wire colorings are not intuitive! Watch out before wiring! The datasheet has wiring details. Connect the two outer ground wires both to the ground, the two ‘VCC’ wires both to 5VDC power, and read the analog signal from the Vo wire. The analog voltage out will range from 3V when an object is about 100cm away and 1.4V when the object is 500cm away.
For a full graph, showing the distance to the analog range, find the datasheet in ATTACHMENT tab.
These sensors tend to be a little noisy, we suggest soldering/connecting the 220uF capacitor to the same place you connect the wires, to provide some filtering on the power supply. Connect the + pin of the capacitor to the Vcc wire connection, and the – pin of the capacitor to the GND wire connection.