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.
Using Your Ultrasonic Sensor in Your Project
1. HOOK UP CONTROLLER
2. INSTALL SOFTWARE
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.
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 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:
Non-contact sensors are also referred to as proximity sensors.
Ultrasonics are Independent of:
- 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.
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
MB8450 Car Detection Sensor
Features of the weather resistant MB8450, Car Detection Sensor, include centimeter resolution, short to long distance detection, range information from 500mm to 5000mm for the nearest detectable target, a ~4Hz read rate, and an easy to use USB interface.
Features of the weather resistant MB7560, SCXL-MaxSonar-WR, include reduced impact of condensation and frost when ran continuously in closed or high-moisture environments, millimeter resolution, short to long distance detection, range information from 300mm to 5000mm for the nearest detectable target, a 0.6Hz read rate, and various output options: pulse-width, analog voltage, and RS232 serial.
- 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.
- 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
Features of the weather resistant MB7052, XL-MaxSonar-WRM1, include small target rejection providing range information to the target with the largest acoustic return, a stability filter, centimeter resolution, short to long distance detection, range information from 20cm to 765cm, a 6.7Hz read rate, and various output options: pulse-width, analog voltage, and RS232 serial.
Features of the weather resistant MB7369, HRXL-MaxSonar-WRM, include millimeter resolution, short to long distance detection, range information from 300mm to 5000mm to the target with the largest acoustic return, a 6.7Hz read rate, and various output options: pulse-width, analog voltage, and RS232 serial.
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.
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 –
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:
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
Features of the MB1240, XL-MaxSonar-EZ4, include centimeter resolution, has the highest noise tolerance and narrowest beam width of any sensor in the XL‑MaxSonar‑EZ sensor line, short to long distance detection, range information from 20cm to 765cm, a 10Hz read rate, and various output options: pulse-width, analog voltage, and RS232 serial.
Features of the MB1242, I2CXL-MaxSonar-EZ4, include centimeter resolution, has the highest noise tolerance and narrowest beam width of any sensor in the I2CXL‑MaxSonar‑EZ sensor line, short to long distance detection, range information from 20cm to 765cm, up to a 40Hz read rate, and an I2C interface.
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.
Radio Bridge developed a Wireless Ultrasonic Level Sensor with LoRaWAN
LX Group developed an Ultrasonic Distance Sensor for Tank Level Measurement
Sweden based company ELSYS uses a sensor from our WR line in their IoT Distance Sensor
TECLAB and FAST provide an IoT Level Sensor named Level-X
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.