The IR sensors are used to measure proximity, which is important because the robot's behavior is controlled by proximity information. All of its movements and actions depend on where it is and what surrounds it. The IR sensors are also used to distinguish between another cockroach and an obstacle. A sensor is placed on the top of the robot and is activated when it is near an obstacle. Two more sensors are placed at the bottom of the robot and are activated when it is near other cockroaches.