• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microcontroller Tips

Microcontroller engineering resources, new microcontroller products and electronics engineering news

  • Products
    • 8-bit
    • 16-bit
    • 32-bit
    • 64-bit
  • Applications
    • 5G
    • Automotive
    • Connectivity
    • Consumer Electronics
    • EV Engineering
    • Industrial
    • IoT
    • Medical
    • Security
    • Telecommunications
    • Wearables
    • Wireless
  • Learn
    • eBooks / Tech Tips
    • EE Training Days
    • FAQs
    • Learning Center
    • Tech Toolboxes
    • Webinars/Digital Events
  • Resources
    • Design Guide Library
    • DesignFast
    • LEAP Awards
    • Podcasts
    • White Papers
  • Videos
    • EE Videos & Interviews
    • Teardown Videos
  • EE Forums
    • EDABoard.com
    • Electro-Tech-Online.com
  • Engineering Training Days
  • Advertise
  • Subscribe

The working principle, applications and limitations of ultrasonic sensors

August 6, 2019 By Lynnette Reese 5 Comments

Figure 1: HC SR04 ultrasonic sensor. (Source: Digikey

The ultrasonic sensor (or transducer) works on the same principles as a radar system. An ultrasonic sensor can convert electrical energy into acoustic waves and vice versa. The acoustic wave signal is an ultrasonic wave traveling at a frequency above 18kHz. The famous HC SR04 ultrasonic sensor generates ultrasonic waves at 40kHz frequency.

Typically, a microcontroller is used for communication with an ultrasonic sensor. To begin measuring the distance, the microcontroller sends a trigger signal to the ultrasonic sensor. The duty cycle of this trigger signal is 10µS for the HC-SR04 ultrasonic sensor. When triggered, the ultrasonic sensor generates eight acoustic (ultrasonic) wave bursts and initiates a time counter. As soon as the reflected (echo) signal is received, the timer stops. The output of the ultrasonic sensor is a high pulse with the same duration as the time difference between transmitted ultrasonic bursts and the received echo signal.

Figure 2: Representation of trigger signal, acoustic bursts, reflected signal and output of echo pin. (Source: HC-SR04 User Guide)

The microcontroller interprets the time signal into distance using the following functions:

Theoretically, the distance can be calculated using the TRD (time/rate/distance) measurement formula. Since the calculated distance is the distance traveled from the ultrasonic transducer to the object—and back to the transducer—it is a two-way trip. By dividing this distance by 2, you can determine the actual distance from the transducer to the object. Ultrasonic waves travel at the speed of sound (343 m/s at 20°C). The distance between the object and the sensor is half of the distance traveled by the sound wave.[iv] The following equation calculates the distance to an object placed in front of an ultrasonic sensor:

­­­­

Applications

Multiple areas of engineering use ultrasonic sensors. “No-contact” distance measuring is very useful in automation, robotics, and instrumentation. Below, we investigate the applications of ultrasonic sensors:

Ultrasonic Anemometers

Figure 3: A 2D Ultrasonic anemometer detects the horizontal component of wind speed and direction (Source: Biral)

Weather stations commonly used anemometers since they detect wind speed and direction efficiently. The 2D anemometers can measure only the horizontal component of wind speed and direction, whereas 3D anemometers can measure the vertical component of wind, as well.

Apart from measuring wind speed and direction, ultrasonic anemometers can also measure temperature because the speed of ultrasonic sound waves is affected by variations in temperature while maintaining independence from changes in pressure. Temperature is calculated by measuring speed variations in ultrasonic sound.

The ultrasonic anemometer is more durable as compared to the cup anemometer and vane anemometer since it has no moving parts and it operates using ultrasonic sound waves. [vi]

Figure 4: A 3D Ultrasonic anemometer measures both horizontal and vertical components of the wind speed and direction. (Source: Biral)

Tide gauge

A tide gauge is used to monitor sea level. It also detects tides, storm surges, tsunamis, swells, and other coastal processes. [vii] A tide gauge can use an ultrasonic sensor to detect real-time water level. The gauge is often linked to an online database where a record is maintained, and in case of a risky situation, the system can trigger an alarm.

Tank level

Measuring fluid level in a tank is similar to a tide gauge. However, in this case, the fluid can be clear water, a corrosive chemical, or a flammable fluid. Unlike optical sensors and float switches, ultrasonic sensors are less likely to corrode as they do not make contact with the fluid.

Functional in sunlight

The sunlight at Earth’s surface is composed of around 52-55% of infrared light.[ix] If an infrared sensor detects an object using infrared light, the process is disturbed due to the interference of infrared light present in sunlight. However, ultrasonic sensors are not affected by the infrared spectrum present in sunlight.

Web-guiding systems

Web-guiding systems position flat materials (e.g., newspaper, plastic film) and widely use ultrasonic sensors. According to Maxcess, “In 1939, Irwin Fife invented the first web guide in his Garage in Oklahoma City, Oklahoma, solving a newspaper owner’s challenge of keeping paper aligned in his high-speed newspaper press.“ [x] A web-guiding system uses a non-contact sensor for detecting and tracking objects at multiple stages. The purpose is to ensure that the material is positioned correctly. If the material is moving out of alignment, the system mechanically places it back on the machine’s processing path. Ultrasonic sensors are suitable for web-guiding systems as the process requires non-contact, high-speed, and efficient functionality.

UAV navigation

Figure 5: Ultrasonic sensor measuring height during drone’s flight. (Source: RadioLink)

Unmanned aerial vehicles (UAVs)—or drones—commonly use ultrasonic sensors for monitoring any objects in the UAV’s path and distance from the ground.

The autonomous feature of detecting safe distances enables the aircraft to avoid crashing. And as the flight of path changes instantaneously, the ultrasonic detection of distances can prenvent a drone from crashing.

Figure 6: Ultrasonic sensor measuring distance from object during drone’s flight. (Source: RadioLink)

Limitations of ultrasonic sensors

Ultrasonic sensors such as the HC-SR04 can efficiently measure distances up to 400 cm with a slight tolerance of 3 mm. [xiii] However, if a target object is positioned such that the ultrasonic signal is deflected away rather than reflected back to the ultrasonic sensor, the calculated distance can be incorrect. 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.

Furthermore, objects like fabric and carpet can absorb acoustic signals. If the signal is absorbed in the target object’s end, it cannot reflect back to the sensor, and hence, the distance cannot be measured.

Figure 7: Representation of ultrasonic signal deflected due to target object’s position, resulting in error. (Source: Macduino)

The intense sensitivity of ultrasonic sensors makes them efficient, but that sensitivity can also cause problems. Ultrasonic sensors can detect false signals coming from the airwaves disturbed by an air conditioning system and a pulse coming from a ceiling fan, for instance.

Ultrasonic sensors can detect objects placed within their range, but they cannot distinguish between different shapes and sizes. However, one can overcome this limitation can by using two sensors instead of just one sensor. One can install both sensors a distance away from each other, or they can be adjacent. By observing the overlapped shaded region, one can get a better idea of the shape and size of the target object.

Figure 8: Representation of overlapping region when one places two ultrasonic sensors at a distance or adjacent to each other. (Source: msu.edu)

 

References:

https://www.mouser.com/ds/2/813/HCSR04-1022824.pdf[ii] https://www.mpja.com/download/hc-sr04_ultrasonic_module_user_guidejohn.pdf
https://www.mpja.com/download/hc-sr04_ultrasonic_module_user_guidejohn.pdf
https://www.teachengineering.org/activities/view/nyu_soundwaves_activity1
https://www.arrow.com/en/research-and-events/articles/ultrasonic-sensors-how-they-work-and-how-to-use-them-with-arduino
https://en.wikipedia.org/wiki/Anemometer
https://senix.com/toughsonic-ultrasonic-sensor-sea-level-measurement/
Principles of Thermal Ecology: Temperature, Energy and Life; Clarke, Andrew. 2017
http://www.maxcessintl.com/fife
https://en.wikipedia.org/wiki/Web-guiding_systems
https://www.maxbotix.com/uav-ultrasonic-sensors.htm
https://www.mouser.com/ds/2/813/HCSR04-1022824.pdf
http://cmra.rec.ri.cmu.edu/content/electronics/boe/ultrasonic_sensor/1.html
https://www.egr.msu.edu/classes/ece480/capstone/fall09/group05/docs/ece480_dt5_application_note_nkelly.pdf
https://www.egr.msu.edu/classes/ece480/capstone/fall09/group05/docs/ece480_dt5_application_note_nkelly.pdf

You may also like:


  • Microcontroller Top Talks in July 2019 on EDABoard.com
  • Inertial Measurement Unit
    Inertial Measurement Units: The hidden key to Apollo success, now…

  • Ultrasonic sensors detect multiple objects using wide field of view
  • rohm
    Ultra-compact earthquake detection sensor modules include false-indicator prevention
  • Chirp CH-101
    Time-of-Flight sensor combines ultrasonic transducer with DSP on mixed-signal ASIC

Filed Under: FAQ, Featured, microcontroller, Sensor modules Tagged With: biral, FAQ

Reader Interactions

Comments

  1. sravya says

    September 26, 2019 at 8:00 am

    Hii I am interfaced node mcu with ultrasonic sensor to know about water level in my home upstair for automatic motor on and off Throw IoT, I used pub nub console for demo purpose first I connected the node mcu and relay board, with single power source it was working properly, After I connected two different power supplies in real time operation the data was send throw pub nub relay data light was blinking but relay was not operated I don’t know what’s the wrong any body have solution ????

    Reply
    • Aimee Kalnoskas says

      September 26, 2019 at 9:26 am

      Hi, Sravya, and thank you for your questions. The best place to get an answer would be to visit one of our online, engineer-to-engineer support forums. There are lots of smart folks there who can help you answer your question. Visit edaboard.com or electro-tech-online.com (or both!), register, and then post your question.
      Cheers,
      Aimee Kalnoskas

      Reply
  2. Hari says

    June 25, 2020 at 9:49 am

    We are looking for a sensor which can detect a fast travelling object(air gun pellet with speed between 600 to 100p fps) on target board. Accuracy/precision should be in 0.1mm in an area of 1ft × 1ft.
    Could you suggest which sensor will be best.
    Please do copy of reply toy email address also

    Reply
  3. Eny says

    October 29, 2020 at 10:17 am

    Hi..is this ultrasonic sensor use the application of thermodynamic and heat transfer? Thank you

    Reply
  4. Abhishek N says

    May 17, 2024 at 7:46 am

    Hi. has anyone tested this sensor in cylindrical chambers with small dia around 100mm. I found that in the cylindrical chamber, measurements are not correct maybe because of ultrasonic transmission pattern. Can anyone comment on this?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Featured Contributions

Five challenges for developing next-generation ADAS and autonomous vehicles

Securing IoT devices against quantum computing risks

RISC-V implementation strategies for certification of safety-critical systems

What’s new with Matter: how Matter 1.4 is reshaping interoperability and energy management

Edge AI: Revolutionizing real-time data processing and automation

More Featured Contributions

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center

EE ENGINEERING TRAINING DAYS

engineering
“bills
“microcontroller
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

DesignFast

Design Fast Logo
Component Selection Made Simple.

Try it Today
design fast globle

Footer

Microcontroller Tips

EE World Online Network

  • 5G Technology World
  • EE World Online
  • Engineers Garage
  • Analog IC Tips
  • Battery Power Tips
  • Connector Tips
  • DesignFast
  • EDA Board Forums
  • Electro Tech Online Forums
  • EV Engineering
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips

Microcontroller Tips

  • Subscribe to our newsletter
  • Advertise with us
  • Contact us
  • About us

Copyright © 2025 · WTWH Media LLC and its licensors. All rights reserved.
The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media.

Privacy Policy