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, its principles, and how ultrasonic sensors work in your applications.

What is an Ultrasonic Sensor?

An ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic sound waves. What is an ultrasonic sensor? It is a device that uses a transducer to send and receive ultrasonic pulses that relay back information about an object’s proximity. High-frequency sound waves reflect across 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 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. This process is a key aspect of ultrasonic sensor working.

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 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. This process is a key aspect of ultrasonic sensor working.

What is an Ultrasonic Sensor?

An ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic sound waves. What is an ultrasonic sensor? It is a device that uses a transducer to send and receive ultrasonic pulses that relay back information about an object’s proximity. High-frequency sound waves reflect across boundaries to produce distinct echo patterns.

Get help finding the right sensor for your application

Our team are always on hand to help out! Whether you’re still not sure which sensor(s) would be best for your project or you’ve just got some questions before you purchase, don’t hesitate to get in touch with our friendly team.

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
In these use cases, we would suggest 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. Its intent is to clear the transducer’s face of moisture to operate normally.

How to Use Your Ultrasonic Sensor in Your Project

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.

Using a different controller to our example and still need hand? Get in touch and our team can help.

Call our team for help setting up your sensor

How to Use Your Ultrasonic Sensor in Your Project

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.

Using a different controller to our example and still need hand? Get in touch and our team can help.

Call our team for help

1. Hook-Up your Controller

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

2. Install relevant coding software to your PC

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

3. Set-up your sensor with Arduino

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

4. Compile and run your code

The code below will allow you to read distances 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.)

View raw code via GitHub

View code to read Ultrasonic AN distance in CM via GitHub

const int anPin = 0;


long anVolt, cm;


void setup() {
  Serial.begin(9600);


}
 

void read_sensor(){
 

anVolt = analogRead(anPin);
  cm = anVolt/2;


}


void print_range(){
  Serial.print(“Range = ”);
  Serial.print(cm);
 

Serial.print(” cm “);
  Serial.print('\n');


}

void loop() {
 

read_sensor();
 

print_range();
 

delay(100);


}

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 that 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 collisions.

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

  • Pressure
  • Level
  • Position
  • Distance

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

Ultrasonic Sensors work independently 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. An ultrasonic distance sensor, like the MB7360 HRXL-MaxSonar-WR, is used as height monitors, in bin-level measurement and proximity zone detection applications.

  • Ex. Distance measurement would be applied in a 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 that 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.

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 to Choose an Ultrasonic Tank Level Sensor which details steps you can take to choose the right ultrasonic 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 ultrasonic 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.

Let’s connect on your project!