Using the V5 3-Wire UltraSonic Range Finder

Description

The Ultrasonic Range Finder is a sensor which uses ultrasonic sound for echolocation to measure the distance between the sensor and the object the sound is being reflected back from. The Range Finder is one of the 3-Wire series sensors. It has two 3-Wire Cables. There is a black, red, and orange “Output” cable which pulses power to a 40KHz speaker; and a black, red, and yellow “Input” cable which sends a signal back from its high frequency microphone receiver. (Note: normal hearing range is typically between 0.02 KHz and 20 KHz, so the sound produced by this sensor should be well above what most people can hear.)

The 3-Wire Sensors are compatible with the V5 Robot Brain or the Cortex. Their sensor cables can be extended using 3-Wire Extension Cables.

In order for the Ultrasonic Range Finder to be functional with the V5 Brain, both the sensor cables need to be fully inserted into a V5 Brain 3-Wire Ports. The Output cable needs to be plugged into a 3-Wire port and the Input cable needs to be plugged into the next consecutive 3-Wire port.

For example, the (black, red, and orange) cable labeled “OUTPUT” on the sensor could be plugged into 3-Wire port A, and then the (black, red, and yellow) cable labeled “INPUT” will need to be plugged into the 3-wire port B.Note: only specific pairs of ports will work (AB, CD, EF, and GH).

The Ultrasonic Range Finder is included in the Advanced Sensor Kit and can also be purchased here.

Range Finder Two 3-Wire Ports
Ultrasonic_Range_Finder.jpg Ultrasonic_Range_Finder_Plug.png

How the Ultrasonic Range Finder Works

The Ultrasonic Range Finder sensor enables a robot to detect obstacles in its path by using high-frequency sound waves. The sensor emits a 40KHz sound wave which bounces off a reflective surface and returns to the sensor. Then, using the amount of time it takes for the wave to return to the sensor, the distance to the object can be computed.

The usable range of the Range Finder is between 1.5” (3.0cm) and 115” (300cm). When the sensor attempts to measure an object at less than 1.5”, the sound echos back too quickly for the sensor to detect and much beyond 115” the intensity of the sound is too weak to detect.

The properties of sound waves effect this range. For instance, if the object which is being detected does not have a hard surface (such as the fabric large cubes used in the 2016-2017 VRC game, Star struck) the sound waves may be absorbed and the sensor may not return an accurate reading.

In addition, if the object being detected is spherical like a ball or has an irregular shape, the sound waves may be scattered and cause a wide range of values to be returned from the sensor. However, the Ultrasonic Range Finder provides a useful accurate measurement when used to measure the distance to a flat hard surface.

The Ultrasonic Range Finder needs to be paired with a programming language such as the VEXcode V5or VEXcode Pro V5 to create a user program for the Brain to use the distance value from the sensor to control the robot. The Range Finder can measure distance in inches or millimeters.

Common Uses of an Ultrasonic Range Finder:

An Ultrasonic Range Finder is a type of proximity sensor which means it can detect an object without touching it. This means the sensor can detect an obstacle in the robot’s path prior to hitting it. Some examples of how an Ultrasonic Range Finder can be used include:

Obstacle avoidance: By early detection of an object, a robot can be programmed to stop or turn to avoid the obstruction, whether this obstacle is a field element, game piece, or another robot.

Ultrasonic Range Finders are used by many cars to detect objects in their paths and alert the driver or take evasive action.

Gesture control: An interesting classroom activity is to orientate the Ultrasonic Range Finder so a hand can be moved within a certain distance range of the sensor. When the robot detects this motion it can change its behavior. For instance, this could be used as an event where the robot will not move until a hand is waved over the sensor. Most robotics games have specific rules prohibiting this type of human interaction with the robot during the autonomous period of the match.

Navigation: An Ultrasonic Range Finder can be used for a feedback control loop to control the robot’s behavior. This could be behaviors like moving a certain distance away from a wall and stopping, moving a certain distance towards a wall and then turn to travel in a different direction, or stopping the correct distance from an object so an arm and claw will be at just the right position to pick up the object.

When a robot is using an Ultrasonic Range Finder to navigate, it can be helpful to use a proportional feedback control. This means the error (the difference between the robot’s target distance and its actual distance) is used to adjust the percent power to the drivetrain.

This causes the robot to slow down as it gets closer to its desired distance (because the error is smaller) until it reaches the specified target distance and stops. This technique will help the robot from overshooting the target distance which can happen if its travel speed is too fast.

Uses of Ultrasonics Range Finders on a Competition Robot:

Ultrasonic Range Finders can be extremely useful when used on a competition robot. In addition to obstacle avoidance and navigation which have already been mentioned, a pair of Range Finders can be mounted on the robot for some advanced behaviors. These two sensors will need to be mounted on the same side of the robot and separated by a distance, such as placing them on opposite corners of the side of a chassis.

Orientation and targeting: When two Ultrasonic Range Finders are mounted with a distance between them, they can each measure the two distances to the field's perimeter wall or other flat field elements. Using the set distance between the sensors and any difference between the two measured distances the V5 Brain can calculate the angle the robot is orientated in reference to the wall.

These measurements can be used to adjust the robot’s angle before it begins its next step of the autonomous path, or they can be used to target and adjust a throwing manipulator like a flywheel before it shoots its game piece.

Secondary verification: Using the same technique as described for orientation and targeting, two Ultrasonic Range Finders can be used to measure the robot’s angle. In this case, the angle can be used to verify the reading of a primary sensor (such as a gyro/inertial sensor) measurement at a specified point during a complex autonomous path.

If the Range Finders indicate the robot has drifted from its expected orientation, the robot can be adjusted and re-calibrated using the two Range Finders’ readings before it continues its path utilizing the primary sensor.

Whether an Ultrasonic Range Finder is used for a simple behavior such as stopping 10” from the perimeter wall or a very complex function like accurately shooting a ball to hit a flag from across the playing field, the properties of sound waves which are the foundation of the sensor’s measurement need to be considered. In other words, when measuring distances to round, irregularly shaped, or soft absorbing surfaces do not expect the values from the Ultrasonic Range Finder to be consistent or accurate.

As with most sensors, Ultrasonic Range Finders are used primarily during the autonomous portion of a match, however with some creative thinking, top teams can use sensors to enhance their driver control of the robot.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: