Understanding How Ultrasonic Sensors Work

9 minute read 

how ultrasonic sensors work

Ultrasonic sensing is one of the best ways to sense proximity and detect levels with high reliability.

Our technical support gets emails all of the time about how our sensors work and what environments our sensors work (or don’t work) in.

This guide was created as an introduction to ultrasonic sensing, it’s principles, and how ultrasonic sensors work in your applications.

At a top level, you need to know what an ultrasonic sensor is…


What is an ultrasonic sensor?

An ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic sound waves.

An ultrasonic sensor uses a transducer to send and receive ultrasonic pulses that relay back information about an object’s proximity.  

High-frequency sound waves reflect from boundaries to produce distinct echo patterns.


How Ultrasonic Sensors Work.

Ultrasonic sensors work by sending out a sound wave at a frequency above the range of human hearing.  The transducer of the sensor acts as a microphone to receive and send the ultrasonic sound. Our ultrasonic sensors, like many others, use a single transducer to send a pulse and to receive the echo.  The sensor determines the distance to a target by measuring time lapses between the sending and receiving of the ultrasonic pulse.




The working principle of this module is simple.  It sends an ultrasonic pulse out at 40kHz which travels through the air and if there is an obstacle or object, it will bounce back to the sensor.  By calculating the travel time and the speed of sound, the distance can be calculated.

Ultrasonic sensors are a great solution for the detection of clear objects.  For liquid level measurement, applications that use infrared sensors, for instance, struggle with this particular use case because of target translucence.

For presence detection, ultrasonic sensors detect objects regardless of the color, surface, or material (unless the material is very soft like wool, as it would absorb sound.) 

To detect transparent and other items where optical technologies may fail, ultrasonic sensors are a reliable choice. 



Using Multiple Sensors & Avoiding Disruption

When using multiple sensors in an application, it’s important to connect them in a way that will allow you to avoid issues like crosstalk or any other interference.

To prevent the disruption of the ultrasonic signals coming from your sensor, it’s important to keep the face of the ultrasonic transducer clear of any obstructions.

Common obstructions include:

  • Dirt
  • Snow
  • Ice
  • Other Condensation

For this particular use case, we offer our Self Cleaning sensors.

They are intended specifically for applications requiring the resistance of condensation in high moisture environments, our self-cleaning function is designed to run continuously in order for the self-cleaning feature to be active. 

Note:  The Self Cleaning function is not intended to clean dirt off of the transducer’s surface.  It’s intent is to clear the transducer’s face of moisture to operate normally.


How are Ultrasonic Sensors used?

Our ultrasonic distance, level, and proximity sensors are commonly used with microcontroller platforms like Raspberry Pi, ARM, PIC, Arduino, Beagle Board, and more.

Ultrasonic sensors transmit sound waves toward a target and will determine its distance by measuring the time it took for the reflected waves to return to the receiver. 

This sensor is an electronic device that will measure the distance of a target by transmitting ultrasonic sound waves, and then will convert the reflected sound into an electrical signal.

Our sensors are often used as proximity sensors.

Ultrasonic sensors are also used in obstacle avoidance systems, as well as in manufacturing.

Our ShortRange sensors offer the opportunity for closer range detection where you may need a sensor that ranges objects as close to 2cm.  These are also built with very low power requirements in mind, as well as environments where noise rejection is necessary. 


Note: It is possible that small grains or particles will deflect the ultrasonic pulses away from the sensor due to surface variation or angle. 

In these environments, the target may absorb sound or deflect sound energy away from the sensor due to the angle of repose, surface variation, or both. 

We do offer an application note on grain detention here: 

When Not To Use an Ultrasonic Sensor

In some cases, the target object is so small that the reflected ultrasonic signal is insufficient for detection, and the distance cannot be measured correctly.


Using Your Ultrasonic Sensor in Your Project


We used an Arduino in this example, but you can use another controller and program of your choice.Direct HRLV AV Arduino Wiring


Install Arduino Sketch coding software onto your PC. This is where you type the code you want to compile and send to the Arduino board.



Plug your Arduino into the USB cable and into your computer. Once you upload Arduino, you can then compile and activate the code.



The code below will allow you to read distance in centimeters. Compile and run this code to obtain real-time distance measurements to the closest object. (Please note: this code is not only for Arduino and will run on most controllers)


Why use an Ultrasonic Sensor?

Ultrasound is reliable in any lighting environment and can be used inside or outside.  Ultrasonic sensors can handle collision avoidance for a robot, and being moved often, as long as it isn’t too fast.  

Ultrasonics are so widely used, they can be reliably implemented in grain bin sensing applications, water level sensing, drone applications and sensing cars at your local drive-thru restaurant or bank.

Ultrasonic rangefinders are commonly used as devices to detect a collision.  

Ultrasonic Sensors are best used in the non-contact detection of:

  • Presence
  • Level
  • Position
  • Distance

Non-contact sensors are also referred to as proximity sensors.

Ultrasonics are Independent of:

  • Light
  • Smoke
  • Dust
  • Color
  • Material (except for soft surfaces, i.e. wool, because the surface absorbs the ultrasonic sound wave and doesn’t reflect sound.)


Long range detection of targets with varied surface properties.


Ultrasonic sensors are superior to infrared sensors because they aren’t affected by smoke or black materials, however, soft materials which don’t reflect the sonar (ultrasonic) waves very well may cause issues. It’s not a perfect system, but it’s good and reliable.


Applications Involving Ultrasonic Detection:

Ultrasonic Distance Measuring

Distance measurement is based on the measurement of time-of-flight.  The time between sending and receiving the reflected sound signal is calculated by the sensor.  Ultrasonic distance sensors, like the MB7360 HRXL-MaxSonar-WR, are used as height monitors, in bin level measurement and proximity zone detection applications.   

      • Ex. Distance measurement would be applied in a garage parking application, sensing when a vehicle is pulled completely into a garage.
      • The MB7360 has been used as a bin level sensor to detect the presence or absence of grain and other materials in bins.


People Detection with Ultrasonic Sensors

Popular applications that we have worked on have been using our sensors in kiosks to detect the presence of a person approaching and detecting the presence of people in an environment, like an art installation.

One detailed use case is this interactive art installation covered in detail on Makezine.com.

We’ve written an article which covers key questions and concerns about the use of our sensors in these types of solutions.

Read our article, Kiosk Sensors & People Detection, to learn:

  • Why people are traditionally a challenging target for an ultrasonic sensor
  • The target types that are ideal 
  • The benefits of an ultrasonic proximity sensor

Our goal is to help you find a sensor that is just sensitive enough for your project but avoids potential issues like picking up interference from an outside noise source.

Take a look at the following video.  nuMedia Innovations developed a solution for a Microsoft Store in Seattle WA to detect human presence on a store display.


Popular Sensors for Measuring Distance


Ultrasonic Level Sensors

      • Tank level measurement, Fuel gauging, irrigation control.
      • This project for a Low Power Water Level Sensor, from Hackster.io developer Amedee,  uses a weather resistant sensor from our WR line.  In combination with a LoraWan node and The Things IoT open source network, this project was developed to measure the water level in a rainwater tank.  Although, it can be used in many applications. 



Choosing a Level Sensor 

You can read this article How to Choose an Ultrasonic Tank Level Sensor which details steps you can take to choose the right sensor for your level sensing application. 

We cover:

  • The important factors to consider when mounting your sensor
  • How to handle using the sensor in an environment with harsh chemicals
  • Which sensor lines work best for environments where frost on the sensor might be an issue



Using the sensor in harsh environments

If you’re using the sensor in a harsh environment, we suggest the added protection in order for you to successfully use the sensor in your project. 

As a brief guide to inform you of the compatibility of our sensors in a few environments, we’ve created the Chemical Compatibility Chart. 

A few of the most popular chemical and environment queries are covered here.


Ordering a Fully Sealed Sensor

When you use a sensor from our WR line, the sensor pinout is left exposed, allowing you to attach wires and equipment to the sensor.

The reason we leave it open is that it provides you more flexibility in how you choose to connect to the sensors.  

In some applications, it can leave the sensor exposed to the weather. 

If your mounting requires you to protect the back of the sensor from damage, you must seal the sensor pinout.

For this, we offer our wire attach option as a solution…

The wire attach option will fully cover the sensor pinout by adding a small cap filled with an epoxy mixture and attached cable.  

By adding the additional potting on the back of the sensor, it will seal it against the effects of weather, dust, and water…

This isn’t just for people that just want to protect their sensor, it’s for people with limited soldering experience.  

If you don’t want to risk your new sensor with the first attempt soldering it, we highly suggest working with our professional, in house soldered sensors with wire attachments. 

Popular Sensors for Liquid Level Sensing


Ultrasonic Obstacle Detection

      • Our UAV Sensors for Drones as well as our proximity sensors that are used for robots are for obstacle detection.
      • Ultrasonic sensors are suitable for close range detection up to ten meters and provide multiple range measurements per second.
      • Main advantages:
        • Low power consumption – can be powered by battery, inexpensively.
        • It can operate in many environmental conditions – ultrasonic sensors work in smoke-filled environments, where other sensors would fail.

Autonomous Navigation and Obstacle Avoidance with Ultrasonic Sensors

We’ve had a lot of success working with companies, makers, and product developers in autonomous navigation projects. 


Ultrasonic Sensors in UAV Operation

You can read this article, Ultrasonic Sensor Operation on a UAV, which covers issues you might encounter while working with UAVs and how you can mitigate some issues.


We give you notes to troubleshoot:

  • Dealing with Air Turbulence
  • Propeller Acoustic Noise
  • Grounding and Power
  • Conducted Electrical Noise
  • Radiated Electric Noise
  • Frame Vibration


If there are any issues not covered, please feel free to contact our team and we’ll assist you through the issue the best we can.


Comparing our Best 3 Sensors for Indoor Mobile Robotics

If you’re developing an autonomous navigation robot, you’ll want to review our article on the Best Ultrasonic Sensor for Indoor Mobile Robotics.

In this resource, we compare our MB1033, MB1030, and MB1240.

We guide you through the following:

  • People detection and the rejection of side objects
  • Recommended beam patterns and power recommendations
  • The sensor operation over temperature  
  • The handling of the power supply voltage 
  • The handling of the rejection of noise sources
  • Dealing with sensor cross-talk (Which sensor is best when cross talk may be a concern)

Read the review for these sensors in this application here.


Using a Wide Beam Sensor for Obstacle Detection

We’ve developed wide beam variations of our widely used HRXL-MaxSonar-WR line of sensors. 

These sensors include – 

The MB7375, which reads RS232, and the MB7395, which reads TTL.

This sensor was developed so that you will have a sensor with a wide beam for your applications that require such.  

You can review the image below to see how wide the beam pattern is:

wide beam ultrasonic sensor beam patterns

These sensors are easy to set up.  No special settings are needed, and it offers a beam angle wider than 90 degrees to many targets. 


Popular Sensors for UAV Applications

Have you checked out these Case Studies from our Collaborators?

We currently have a Collaborator program that highlights the use cases of our sensors in various applications.  You can view a few of them below.

Interested in joining the Collaborator program?  Contact us here.


radiobridge sensor

Radio Bridge developed a Wireless Ultrasonic Level Sensor with LoRaWAN

Ultrasonic Distance Sensor for Tank Level Measurement

LX Group developed an Ultrasonic Distance Sensor for Tank Level Measurement

IoT distance sensor

Sweden based company ELSYS uses a sensor from our WR line in their IoT Distance Sensor


IoT Level Sensor

TECLAB and FAST provide an IoT Level Sensor named Level-X



In Conclusion…

Ultrasonic sensors are a reliable, cost-effective solution for distance sensing, level, and obstacle detection.

Once you understand how ultrasonic sensors work and what ultrasonic technology is perfect for and not so good for, you can make a more educated decision on the right sensor system for your application.  

Take a look at our patent-pending solution for sensing cargo in 53′ trailers to detect the fullness or absence.  Read about the Trailer Cargo Sensor.


Review our product catalog and contact our Technical Support Team by clicking the button below to get help selecting a sensor.


Understanding How Ultrasonic Sensors Work
Article Name
Understanding How Ultrasonic Sensors Work
If you're considering using ultrasonic technology to sense in your project there are things you need to understand. This article provides information on how ultrasonic sensors work.
Publisher Name
MaxBotix Inc.
Publisher Logo

MaxBotix Inc.

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

These cookies are necessary for the website to function and cannot be switched off in our systems.

In order to use this website we use the following technically required cookies
  • wordpress_test_cookie
  • wordpress_logged_in_
  • wordpress_sec

For perfomance reasons we use Cloudflare as a CDN network. This saves a cookie "__cfduid" to apply security settings on a per-client basis. This cookie is strictly necessary for Cloudflare's security features and cannot be turned off.
  • __cfduid

Decline all Services
Accept all Services