Sharp GP2D02 Infrared Ranger By Mohd. Rana Basheer

The Sharp GP2D02 sensor provides a distance measurement output and is ideal for interfacing with the microcontroller due to the 8bit serial format in which the data is outputted. The sensor is capable of providing a distance measurement within the range of 10 cm to 80 cm with a sensing width of ±20mm at 10cm to ±20mm at 80 cm. The fairly narrow sensing width makes it easier to get the range of a specific target.

Four wires comes out of this module through a tiny female JST connector (which I do not think is available anywhere other than Japan).

bulletGND
bulletVIN - Control signal input which should not increase more than 3 volts.
bulletVcc - 4.4 to 7 volts is the operating supply range but normally run at 5.0 volts.
bulletVout - an 8 bit serial output (a digital value representing the distance)

Principle of Operation

GP2D02 sensor works by the principle of triangulation. The sensor transmits a modulated IR beam; the beam hits an object and portion of the light is reflected back through the receiver optics and strikes at a point on the Photo Sensing Device (PSD). The optical spot position on the PSD change depending on the distance of the reflective object from the sensor as shown in figure 2. PSD is capable of generating a voltage characteristic to the point on which the reflected beam struck. The voltage is digitized and send serially to the external microcontroller.

GP2D02 makes multiple measurements before it returns the distance of the reflected object. The time it takes to measure this distance varies from unit to unit and can be as long as 70 ms.

The measurement is done in a three step process

To begin the measurement cycle pull the Vin line low. Keep it low till Vout goes high. Once Vout is high the data can be clocked back in through a series of 8 pulses of less than 200µs of length on the Vin line while the serial data is read through the Vout line between each pulse. The timing chart for this three step process is given on figure 3.

The digital output from the sensor(D) is inversely proportional to the distance between the sensor and the reflective object (d). 

D = C+ 1560/(d+0.5)

The factor C is due to the positional tolerance between the detecting device and the front lens in assembly. Usually C varies from unit to unit but normally it ranges from 40-60. For the correct calculation you will have to calibrate with a known distance. This equation is only valid in the operating range of 10cm to 80cm. 

Where To Buy

There are lots of distributors for this module but for my robot I bought all of them from HVW Technologies. A pack of 4 modules costs 72 USD and they are very prompt in delivery.

 


Fig 1. GP2D02 Sensor front view with color wires

 

 
Pin Symbol Color
1 Gnd Black
2 Vin Green
3 Vcc Red
4 Vout Blue

Table 1. GP2D02 Wire color scheme

 

Fig 2. Triangulation

Fig 3. Timing Chart for measuring distance

Fig 4. Distance Measuring Output Vs Distance to Reflective Object