Distance Sensor

The distance sensor specifications says it measures from 1 inch to 10 feet. I have two distance sensors and both only read up to 609 MM (24 inches).
Also, the distance sensor is not very sensitive. I purchased the mini Bucky balls, and the sensor can’t detect the balls.
I’m using the RobotC program.
Is there any way to improve the sensitivity of the distance sensor (either longer distance or ability to recognize more objects)?

Because the distance sensor uses Ultrasound to detect objects it will have a very hard time “seeing” a ball if it isn’t quite close. This is basically because the (sound) signal it emits is not bounced back but bounced away by the curved surface. A flat surface will give you a better result.

When I have the Vex IQ back away from a wall, the distance sensor starts counting up. The distance jumps from 609 mm (24 inches) to 26,214 mm. The sensor can’t seem to register anything between 609 and 26,214 mm; even when measuring against a wall. In reverse, when I have the VEX IQ approach a wall, the distance jumps from 26,214 mm to 609 mm. Since the specifications say it can measure from 1 inch to 10 feet, I’m wondering if I’m doing something wrong. Thanks

jpearman is correct, the Distance Sensor maximum range must be specified before use, and defaults to 610mm in RobotC and 500mm in Modkit for VEX.

The reason for specifying this maximum distance is to improve accuracy of the results. The distance sensor uses high frequency sound waves to detect objects (like bats), so specifying the maximum distance helps the Distance Sensor filter out results that you are not looking for.

My sensor might be defective. :frowning:
It returns an integer number 26214 no matter what I measure, no matter which port I use.

Daniele, I assume you updated the firmware, and replaced the wire, right?

Sounds like a problem.


I used the firmware update program to install latest firmware 1.07.
Then I flashed the ROBOTC firmwareVEX_IQ_1006.
Tested in different ports, using different wires. It reads 26214.


26214 is the value that is returned when no objects are seen within the range the sensor is set to detect within. The Distance Sensor uses a maximum distance command to limit where it sees values. The maximum distance command is used because the Distance Sensor has the capability of seeing and identifying different objects, and identifying which object is the largest.

If setting the maximum distance command to a known good value like 1000mm in your program prior to using the sensor does not solve the issue (and the Distance Sensor itself is verified to be running the latest firmware), it is possible that there is a problem with the Distance Sensor. We perform complete factory testing and calibration of all VEX IQ sensors, and we have not seen any problems yet with Distance Sensors that pass this procedure.

If there is a problem, we would like to get this Distance Sensor back so we can analyze the problem; we’ll send you a new Distance Sensor with a return shipping label for the suspect one. We’re sorry for any inconvenience this may have caused.


  • Art


Did you upgrade the firmware on all of the sensors and motors as well?

= Xander

I reupdated the firmware on the sonar, and changed the max range. Now it works.

You guys have a sample program for this Using <Modkit> ? thanks!


The Modkit program shown in the image below will print the current distance measured by the Distance Sensor to the Robot Brain LCD.


  • Art

OK. I’ve forced the firmware for the distance sensor to update, even though it indicated it already was up to date. I’ve tried setting different maximum distances, and I have the robot programmed to turn 180 degrees when it gets 100mm from an object. However, it still seems to turn at random times when it’s not anywhere near anything. And if I go into Device Settings and look at the port that has the distance sensor connected to it, I see the values jumping all over the place. Right now I have the robot stationary, 9 inches (about 220 mm) from the wall, and the values it is giving me are jumping everywhere between 0 inches and 9 inches. I get similar behavior from a sensor from another kit, but it jumps around between 3 inches and 9 inches.

Edit: I just noticed it works better if the sensor is mounted vertically rather than horizontally. The values still jump all over the place, but not quite as much.