Sharp infrared detectors and rangers boast a small package, very low power consumption and a variety of output options. In order to maximize each sensor's potential, it is important to understand how these types of IR sensors work, their effective ranges, and how to interface to them.
THEORY OF OPERATION
There are two major types of Sharp's infrared (IR) sensors based on their output: analog rangers and digital detectors. Analog ranges provide information about the distance to an object in the ranger's view. Digital detectors provide a digital (high or low) indication of an object at or closer than a predefined distance.
These rangers all use triangulation and a small linear CCD array to compute the distance and/or presence of objects in the field of view. In order to triangulare, a pulse of IR light is emitted by the emitter. The light travels out into the field of view and either hits an object or just keeps on going. In the case of no object, the light is never reflected, and the reading shows no object. If the light reflects off an object, it returns to the detector and creates a triangle between the point of reflection, the emitter and the detector.
Sharp IR detector angle of reflection arrival for near and far object
The incident angle of the reflected light varies based on the distance to the object. The receiver portion of the IR rangers is a precision lens that transmits reflected light onto various portions of the enclosed linear CCD array based on the incident angle of the reflected light. The CCD array can then determine the incident angle, and thus calculate the distance to the object. This method of ranging is very immune to interference from ambient light and offers indifference to the color of the object being detected.
WHICH DETECTOR TO USE?
The table below characterizes each sensor by minimum and maximum ranges, as well as whether the sensor returns a varying distance value or a digital detection signal:
Comparison Chart for Sharp IR Rangers
SHARP IR RANGE COMPARISON
|MODEL||OUTPUT||MIN. RANGE||MAX RANGE|
The GP2Y0A710 ('0A710'), GP2D120, GP2Y0A41, GP2Y0A21 ('0A21'), and GP2Y0A02 ('0A02') sensors offer true ranging information in the form of an analog output. TheGP2D15, by contrast, provide a single digital value based on whether an object is present in it's range or not. None of the detectors require an external clock or signal. Instead, they fire continuously, requiring around 25mA of continuous current.
All of the Sharp IR rangers are approximately the same size except the 0A710. This sensor is larger in order to accommodate larger lenses and circuitry required for its superior range of 5.5 meters. The table below summaries the overall mechanical dimensions of each sensor. Be sure to review the data sheets for detailed dimensional drawings.
SHARP IR DIMENSIONS
|MODEL||WIDTH (MM)||HEIGHT (MM)||DEPTH (MM)|
Due to the trigonometry involved in computing the distance to an object based on the reflected light incident angle, the output of these detectors is non-linear with respect to the distance being measured. The graph below shows an example of the analog output voltage vs distance to an object.
Example graph of Sharp IR Output Voltage vs Distance
Some interesting things to notice in this graph: first, the output of the detectors within the stated range (10cm - 80cm) is not linear but rather somewhat logarithmic. This curve will vary slightly from detector to detector so it is a good idea to "normalize" the output with a lookup table or parameterized function. This way, each detector can be calibrated to be consistent and result in data which varies nearly linearly relative to the distance to the object.
Second, notice that the output drops rapidly once the object is closer than the minimum distance (less than 10cm). As such, the output could be confused with a longer range reading. Such readings can be disastrous if your robot is slowing down as it approaches a solid object, gets below the minimum range and then misinterprets the apparently long range reading. If this errant reading is not handled correctly, the robot may drive full-speed into the object. The easiest way to avoid this is to cross-fire the detectors across the width or length of the robot as shown below.
Example of cross-firing detectors to avoid range errors
The beam pattern for these rangers is rather consistent between types. The beam is roughly football shaped with the widest portion in the middle being about 16cm wide. This is a reasonably narrow beam pattern which makes for great ranging data when coupled with a servo to "sweep" the detector while taking readings.
When using Sharp sensors as a virtual bumper, it is advantageous to have the widest beam pattern possible in order to provide coverage for a large area such as the entire front of the robot. This can easily be accomplished using two sensors whose beams cross over one another in front of the robot (see below). The most common detector to use in this arrangement is the GP2D15.
Configuration of two sensors for effectively wider beam width
INTERFACING THE SENSORS
Except for the GP2Y0A710, the Sharp IR sensors all use a connector called the Japan Solderless Terminal (JST) connector. These connectors have three wires: ground, Vcc, and the output. Since the sensors fire continuously and don't need any clocking to initiate a reading, interfacing to them is simple, but they continuously use power and can potentially interfere with one another when multiple detectors are used on a single robot. Interference can be avoided by keeping in mind the theory of operation of the sensors, when placing them on the robot.
The larger GP2Y0A710 is uses a 5-pin JST connector with two ground and two power lines. However, these lines can be soldered together provided the attached power supply is capable of delivering roughly 350mA of peak current (roughly 33-50mA continuous current). Like the other sensors, the GP2Y0A710 fires continuously. Be sure the review the data sheet for each sensor to ensure it is appropriate and compatible for the intended use case.
The Sharp IR rangers and detectors are a great addition to the suite of sensors available for robotics. They are inexpensive, are low power, fit in small spaces and have a unique range that is ideally suited to small robots in human spaces such as hallways, rooms and the mazes.
While these don't give absolute range accuracy, they offer very good information for a robot that typically deals with noisy information in the first place. Often, knowing whether a robot is close to a wall or far away is enough to make choices about what to do next.