# Distance Sensor - Sensors for VEX IQ

#### Description

This sensor reports the distance between it and the nearest solid object (50mm - 1m range). It calculates distance by using the time it takes for ultrasonic waves to bounce off of an object and return to the sensor.

The following article will cover:

• How the Distance Sensor Works
• Common Uses of the Distance Sensor
• Uses of the Distance Sensor on a Competition Robot

The VEX IQ Distance Sensor is included in the VEX IQ Super Kit but it can also be purchased here.

#### How the Distance Sensor Works: Listening for Distance

The Distance Sensor uses the same principles as sonar devices to measure sound. It sends out a tiny pulse of ultrasound with its emitter at one side of the sensor, and then times how long it takes to hear the sound reflect back the receiver at the other side of the sensor. The sensor calculates the distance based on how long the sound pulse took to make the round trip. The Distance Sensor then makes a calculation based on the speed of sound to tell the robot brain how far the nearest object is.

If the surface is not flat like a curved wall or a ball, the ultrasonic wave does not bounce off of all parts equally or at the same time. The closest surface large enough to reflect back a detectable amount of the wave determines the detected distance of the object.

#### Common Uses of the Distance Sensor:

• This sensor can detect if there is an object in front of it.

• This sensor can measure the distance between it and an object.

• A robot can use this sensor to drive a certain distance away from an object.

• A robot can use this sensor to drive up to an object without touching it.

• The values provided by this sensor can be used to adjust the robot’s velocity depending on whether it is near or far away from an object or surface.

#### Uses of the Distance Sensor on a Competition Robot:

• The robot can use the Distance Sensor to initiate a sequence of behaviors when it is in the correct place to do so. For example, the robot can drive forward until it detects that it is 150mm away from a wall, then turn 90 degrees, and release an object into a scoring zone.
• The Distance Sensor can be used to trigger robot actions, such as picking up a game piece, when an object is detected within range.
• The robot can use the Distance Sensor to drive toward an object or surface until it is within a specific distance, without touching it. This can be used to make sure that the robot does not knock over game pieces.
• A robot can use the Distance Sensor to drive away from an object or surface until it has reached a specific distance. This can be used to avoid collisions with other robots on the field.