Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 23 in printed book and digital formats -- plus a one-year subscription (beginning with 24.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are short, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 24.2 ('Xojo Sonar')
Instant purchase and download via GumRoad!

FEATURE

Ultrasonic Range Sensor

Determining distance with sonar

Issue: 24.2 (March/April 2026)
Author: Eugene Dakin
Author Bio: Eugene works as a Senior Oilfield Technical Specialist. He has university degrees in the disciplines of Engineering, Chemistry, Biology, Business, and a Ph.D. in Chemical Engineering. He is the author of dozens of books on Xojo available on the xdevlibrary.com website.
Article Description: No description available.
Article Length (in bytes): 14,579
Starting Page Number: 12
Article Number: 24202
Resource File(s):

Download Icon project24202.zip Updated: 2026-03-01 13:10:39

Related Link(s): None

Excerpt of article text...

This section uses the Ultrasonic Range Finder to determine the distance from the electronic device to a solid object. Humans can typically hear frequencies from about 20 Hertz to about 20,000 Hertz, and the HC-SR04 Range Finder device operates at a frequency of approximately double the highest frequency, which is about 40,000 Hertz, or 40 kHz.

The way the Ultrasonic Range Finder works is by sending an ultrasonic wave in a direction, and a timer is started when the wave leaves the device. The wave bounces off an object and returns to the sensor on the finder, stopping the timer. The distance from the sensor to the object is determined by cleverly calculating the speed of the wave and the time it takes for the wave to reach the object and return to the sensor.

Some of the applications that the range finder can be used for are:

  • Detecting barriers for robotics, such as walls or obstacles

  • Measuring the distance of an object

  • Calculating how level an object is

...End of Excerpt. Please purchase the magazine to read the full article.