> For the complete documentation index, see [llms.txt](https://wiki.purduesigbots.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.purduesigbots.com/vex-electronics/vex-sensors/3-pin-adi-sensors/ultrasonic.md).

# Ultrasonic

The VEX Ultrasonic Range Finder helps determine how far away an object is.

![](https://3510336827-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7yGVyBrcpSR8SDSikj%2Fuploads%2F6TB6OYAqj8nY1vWHGEMG%2Fultrasonicrangefinder_render.png?alt=media\&token=e39baee9-4044-4fff-b4b4-ba34ada34fc4)

The **VEX Ultrasonic Range Finder**, or simply the **VEX Sonar**, is a rangefinding device which uses pulses of high-frequency sound to estimate the distance to an object. It connects to the [VEX Cortex](/vex-electronics/legacy/vex-cortex.md) or [V5 Brain](/vex-electronics/vex-electronics/vex-v5-brain.md) using two digital ports; one port to send a sound wave, and the other to receive it. The sensor runs continuously as long as it is being powered, meaning that even if no software is requesting the sensor's distance reading, it is still active. When the sensor is active, a faint and rapid ticking noise can be heard from the sensor.

In [VEXcode](/software/vex-programming-software/vex-coding-studio-vcs.md), the Ultrasonic Range Finder returns the distance in the unit of measure that the programmer chooses, since unit of measure is a parameter necessary to get the distance. However, in [PROS](/software/vex-programming-software/pros.md), the Ultrasonic Range Finder returns the distance specifically in centimeters. The sensor's distance range is between 3cm and 300cm. According to the [VEX Robotics website](https://www.vexrobotics.com/276-2155.html), the sensor is sensitive enough to detect a pole with a diameter of 3cm at a distance greater than 2m.

Sound travels very slowly compared to the speed of a microprocessor clock. As such, distance is estimated by sending a 40kHz wave of sound lasting 250 microseconds via the ''OUTPUT'' signal. A change in the "INPUT" signal from high to low indicates that the wave has returned to the sensor. The equation for the Ultrasonic Range Finder's distance reading is $$d = t \* 171.5$$ where "d" represents the distance between the sensor and the object found, "t" represents the time it took for the sound wave to return to the sensor, and 171.5 is half the speed of sound in meters per second.

Soft or rounded objects do not reflect sound as well and can confuse or elude the VEX Ultrasonic Range Finder. Using more than one VEX Ultrasonic Range Finder at a time can also cause interference.

## Teams Contributed to this Article:

* [BLRS](https://purduesigbots.com/) (Purdue SIGBots)
* [904U](https://www.youtube.com/channel/UCKvtsL9hJ_x7bqrpl3nJ3Gg/) (B.E.S.T.I.E. Robotics)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://wiki.purduesigbots.com/vex-electronics/vex-sensors/3-pin-adi-sensors/ultrasonic.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
