IR Sensors

From Imperial College Robotics Society
Jump to: navigation, search

How they work


IR sensors use infra red light to sense objects in front of them and gauge their distance. The commonly used Sharp IR sensors have two black circles which used for this process, an emitter and a detector (see image right).

A pulse of infra red light is emitted from the emitter and spreads out in a large arc. If no object is detected then the IR light continues forever and no reading is recorded. However, if an object is nearby then the IR light will be reflected and some of it will hit the detector. This forms a simple triangle between the object, emitter and detector. The detector is able to detect the angle that the IR light arrived back at and thus can determine the distance to the object. This is remarkably accurate and although interference from sunlight is still a problem, these sensors are capable of detecting dark objects in sunlight now.

How to wire them up

These sensors have three pins, generally with a red, black and yellow wire coming out of them. Red is connected used to power the sensor, black is ground and yellow is the analogue output of the sensor. This can be attached to one of the analogue in pins on the mbed(p15-p20) or suitable micro-controller and the distance can be read as a voltage with low voltages corresponding to close objects and high voltages corresponding to distant objects. For mbed use please see the Mbed Using Sensors documentation.


These sensors are far from perfect and have quite a small range. They are usually most effective ( though this depends on particular makes) at between 10cm to a maximum of about 1m. However, complex scenery (many different objects) will cause a problem as the sensor will see all objects within the arc created by the IR emitter. It is recommended that you search for the relevant data sheet or conduct simple tests to find ideal values beyond which your robot acknowledged the obstacle. Sunlight or flames also present a problem as they emit a lot of IR light and thus interfere with the IR sensor providing false readings. However, these sensors are suitable for indoor use. Interference from other sensors can also be a problem if there are multiple robots or parallel sensors. As with all analogue signals, noise will exist in the readings taken from the sensor.

360 view

For simple obstacle avoidance it is sufficient to simply see the obstacles in front of you. However, for more advanced avoidance or for searching it is advantageous to see all around your robot, or to at least have a larger view angle. This could be achieved using two sensors, facing away from one another, pointing left forwards and right forwards. This would allow a robot to identify which direction the obstacle was in and thus turn away from it in the correct direction.

However, this approach is inefficient and can be limiting. Installing further IR sensors also throws up problems of interference. Another solution is to use a servo to turn your IR sensor as you would swivel your head or eyes. The servo can be set to many different angles and IR readings can be taken from each of them. This can be extremely effective at building up a 3D map of the area around the robot.