The Basics of Ultrasonic Sensors

The Basics of Ultrasonic Sensors

By Jeff Smoot

Ultrasonic sensors have been available for decades, and yet they continue to own a large portion of the sensing market due to their capabilities, flexibility, and low cost. As more products have become autonomous, demand has increased even further with their inclusion in robots, autonomous vehicles, and drones. Understanding how an ultrasonic sensor works, how it can be utilized, the pros and cons of using one, and their common applications will show how they are just as pertinent now as when they were first introduced.

What is an Ultrasonic Sensor?

Ultrasonic sensors emit a chirp usually between 23 kHz and 40 kHz, much higher than the typical audible range of human hearing at 20 kHz, hence the term ultrasonic. Using this chirp, they measure the amount of time it takes for the sound to bounce off an object. This is based on the same basic principles of echolocation used by bats to find their prey. As the speed of sound in air at room temperature is 343 meters per second, that time can be easily converted to distance, remembering that the ultrasonic chirp travels both to and from the object being sensed.

Distance (meters) = (time elapsed [seconds] * 343 [meters/second]) / 2

The units can be changed in this equation to fit the needs of a specific application, but the simplicity of the equation shows the relatively straightforward operation of an ultrasonic sensor.

How Does an Ultrasonic Sensor Work?

Moving from theory to reality, an ultrasonic sensor requires two parts, both a transmitter and a receiver. In the most standard configuration, these are placed side-by-side as close together as reasonably possible. With the receiver close to the transmitter, sound travels in a straighter line from the transmitter to the detected object and back to the receiver, yielding smaller errors in the measurements. There are also ultrasonic transceivers where the transmitter and receiver functions are integrated into a single unit, minimizing error as much as physically possible while also significantly reducing the PCB footprint.

Diagram of an ultrasonic sensor’s basic operation
Basic operation of an ultrasonic transmitter and receiver pair

The acoustic waves that leave the transmitter are more similar in shape to light leaving a flashlight than a laser, so spread and beam angle must be considered. As the sound waves travel farther from the transmitter, the area of detection grows laterally and vertically. This changing area is why ultrasonic sensors give their coverage specification in either beam width or beam angle instead of a standard detection area. When comparing this beam angle between manufacturers, it is recommended to verify that the beam angle is either the full angle of the beam or the angle of variation from the straight line from a transducer.

Diagram demonstrating an ultrasonic sensor with a wide and narrow beam angle
Understanding the beam angle is essential for establishing the detection area

A secondary effect of the beam angle is the range of the device. In general, a narrow beam yields a greater detection range as the energy of the ultrasonic pulse is more focused and can go farther before dissipating to unusable levels. Inversely, a wider beam spreads that energy in a wider arc, reducing the expected detection range. Choosing the ideal beam width is highly dependent on the application, with wide beams better at covering larger areas and general detection, while more narrow beams avoid false positives by limiting the detection area.

What’s the Difference Between an Ultrasonic Transmitter, Receiver, and Transceiver?

When searching for individual components, ultrasonic sensors can be acquired as independent transmitters and receivers or as a combination of the two in a single unit, known as an ultrasonic transceiver. Because ultrasonic transceivers combine the transmit and receive functions into a single unit, they ultimately save PCB space in the final design. However, transceivers typically have a larger “blind zone” (i.e. minimum working range) of approximately 30 cm or more. There are higher frequency ultrasonic transceivers available that improve the blind zone down to approximately 5 cm.

The main benefit of individual transmitter and receiver combinations are their smaller blind zones in the range of 0 cm to 20 cm. They also hold better sensitivity ratings than transceivers, which has a direct correlation to detecting signals, in particular a weak signal that might be hindered by environmental factors. This is useful in power-constrained applications because the individual transmitter/receiver combo can be driven with less power than a transceiver, while still achieving the same signal sensitivity. When it comes to selecting an individual transmitter and receiver pairing, it is important to observe that their frequency ratings are within 1 kHz of each other to achieve the best signal sensitivity.

Although ultrasonic transmitters, receivers, or transceivers are often purchased separately and assembled with custom circuitry and firmware, they are also sometimes available as a single unit, pre-mounted on a PCB in the standard range finding configuration and a simple logic board. While simpler to use, designers do give up a great deal of flexibility and customization by using these modules.

Examples of an ultrasonic transmitter, receiver, and transceiver
Examples of an ultrasonic transmitter, receiver, and transceiver

Analog vs. Digital Ultrasonic Sensors

Most analog ultrasonic sensor options are actuated by sending a trigger signal to the transmitter with the receiver sending back a signal when the echo is detected. The length of the pulse and any encoding can be customized by the designer as needed. This process ultimately leaves the time calculation between trigger and echo, as well as the decoding, to a host controller. There are digital ultrasonic sensor modules that calculate the distance onboard and then transmit the distance to the host through the communication bus.

Strengths and Weaknesses of Ultrasonic Sensors

As with any technology, ultrasonic sensors are best utilized in certain situations or applications over others. A few of their strengths include the following:

  • Ultrasonic sensors are unaffected by the color of the objects being detected, including translucent or transparent objects such as water or glass.
  • Their minimum and maximum ranges are quite flexible, with most ultrasonic sensors capable of detecting as near as a few centimeters up to approximately five meters. Specifically configured modules can even measure up to nearly 20 meters.
  • With decades of use, this mature technology is very reliable and well understood, yielding consistent results.
  • Ultrasonic sensors provide relatively precise measurements, within 1% typically and even more precision if desired.
  • They can make many measurements per second, yielding quick refresh rates.
  • As there are no rare materials needed, they are usually quite inexpensive.
  • Ultrasonic sensors are resistant to electrically noisy environments as well as most acoustic noise, particularly when using modules equipped with encoded chirps.

Although a versatile technology, ultrasonic sensors due have several limitations to consider before making a final sensor selection:

  • As the speed of sound is dependent on temperature and humidity, environmental conditions may change the precision of the measurements.
  • Although the detection zone is three dimensional, an ultrasonic sensor only detects that there is something a certain distance from the detector and cannot provide feedback on where the object is in the sensing area nor any features such as shape or color.
  • While their form factor is relatively small and they can be integrated into cars or industrial applications without any concerns, ultrasonic sensors may be too large for very small, embedded projects.
  • Like any sensor, they can get dirty, wet, or frozen, which will cause them to be erratic or non-functional.
  • Due to their dependence on sound, which in turn depends on a medium of some sort, ultrasonic sensors do not work in a vacuum.

Where are Ultrasonic Sensors Typically Used?

The first of the two most common ultrasonic sensor applications is liquid level sensing, as they can detect liquids of any color or opacity yet are also non-contact. The second is general object detection due to their low cost and simplicity. Specific object detection applications include anti-collision detection for vehicles, people detection, presence detection, box sorting, pallet detection with forklifts, bottle counting on drink filling machines, and many more.

Drawing of a robot vacuum utilizing ultrasonic sensors for object detection
Ultrasonic sensors can be used in autonomous vacuum cleaners for object detection

An example of a more creative usage for ultrasonic sensors would be to use the one-way functionality of ultrasonic transmitters and receivers separately. While the ultrasonic pulses are outside of human audible ranges, they are within the hearing ranges of various animals. An ultrasonic transmitter could conceivably use its emitters to scare off animals, such as birds, while an ultrasonic receiver could be used for noise detection.

Summary

Ultrasonic sensors are a well-known technology that continues to be extremely relevant in many industrial and consumer applications. Their simplicity, low cost, and robust build make them an excellent choice for many new products requiring presence detection or distance measurement. Yet the ability to change both the hardware and software configurations make them extremely versatile for even more demanding situations.

Have comments regarding this post or topics that you would like to see us cover in the future? Send us an email at cuiinsights@cuidevices.com
Jeff Smoot

Jeff Smoot

V.P. of Engineering

Since joining CUI Devices in 2004, Jeff Smoot has revitalized the company's Quality and Engineering departments with an emphasis on developing, supporting, and bringing products to market. With a focus on the customer’s success, he also spearheaded the establishment of an Application Engineering team to provide enhanced in the field and online engineering design and technical support to engineers during their design process. Outside of the office, Jeff enjoys the outdoors (skiing, backpacking, camping), spending time with his wife and four children, and being a lifelong fan of the Denver Broncos.