# Understanding Ultrasonic Sensors

The longevity and continuing popularity of ultrasonic sensors can be attributed to the fact that they are inexpensive, highly adaptable, and can be used in a wide variety of applications. Their adaptability has meant that more recently, they have also found uses in newer technologies such as autonomous vehicles, industrial drones, and robotic equipment. In this article, we explain the principle of operation of ultrasonic sensors, consider their advantages and disadvantages, and review some of their most common applications.

## What are ultrasonic sensors?

The term ultrasonic refers to audio frequencies that are beyond the range of human hearing (20 kHz). Ultrasonic sensors are devices that use these frequencies for presence detection and/or to calculate the distance to a remote object.

## How do they work?

The basic operation of an ultrasonic sensor is analogous to how bats use echolocation to find insects while in flight. A transmitter emits a short burst of high-frequency sound waves called a ‘chirp’ containing frequencies between 23 kHz and 40 kHz. When this pulse of sound hits an object, some of the sound waves are reflected back to the receiver. By measuring the length of time between when the sensor transmits and receives the ultrasonic signal, the distance to the object can be calculated using the following equation:

where:

d = distance (meters)

t = time between transmission and reception (seconds)

c = speed of sound (343 meters per second)

Note that d is the measured distance for the sound pulse to travel in both directions – this must be multiplied by 0.5 to calculate the duration of travel in one direction, which ultimately equals the distance to the object.

The simplest ultrasonic sensors are configured to have the transmitter and receiver located adjacent to each other (Figure 1). This arrangement maximizes the amount of sound traveling in a straight line from the transmitter, while reflecting in a straight line back to the receiver, thereby helping to reduce measurement errors.

Ultrasonic transceivers combine a transmitter and receiver in a single enclosure. This further improves measurement accuracy (by minimizing the distance between them) while having the added benefit of reducing board space.

Figure 1: Basic ultrasonic transmitter/receiver arrangement. (Image source: CUI Devices)

When calculating the distance to an object based on the readings from a sensor, several factors must be considered. Sound naturally travels in all directions (vertically and laterally), so the further the pulse of sound travels from the transmitter, the greater the opportunity it has to spread out over a wider area – much like how a beam of light spreads out from a flashlight (figure 2).

It is for this reason that ultrasonic sensors are not specified for a standard area of detection, instead, they are specified for either beam angle or beam width. Some manufacturers specify sensor beams from the transmitter by full-angle deviation while others specify by straight-line deviation. When making comparisons between sensors from different manufacturers, it is important to be aware of how they specify sensor beam angle.

Figure 2: Beam angle is an important specification to understand in sensor selection. (Image source: CUI Devices)

Beam angle also has implications for the operating range and accuracy of an ultrasonic sensor. Sensors that transmit narrow, focused beams can detect objects that are more physically distant than sensors that produce wider beams. This is because their beam can travel longer distances before spreading too wide to be detectable. This also makes them more accurate for object detection and less likely to give a false indication of a remote body being present. While wide beam sensors are less accurate, they are better for use in applications that require general-purpose object detection over a wider area.

Equally worthy of consideration is the choice to be made between using an analog or digital sensor. Analog sensors are only responsible for generating the ultrasonic chirp and receiving its echo. This echo must be subsequently converted into a digital format so that it can be used by the system microcontroller that performs the object distance calculation. Systems designers must make allowances for the analog-to-digital conversion delay in their calculations. In addition to generating and receiving audio signals, digital ultrasonic sensor modules also include a slave microcontroller that performs the distance calculation before transmitting this figure over a communications bus to a master system microcontroller.

System engineers must also decide whether to design a custom sensor with a separate transmitter and receiver (along with other discrete components) or use a fully integrated transceiver (Figure 3). Compared to individual transmitters and receivers, integrated ultrasonic transceivers have the advantages of being smaller (thereby saving PCB space), being simpler to use, and improving accuracy in some applications. However, they place greater constraints, with fewer degrees of freedom to adjust how the sensor is designed into an application.

Figure 3: Separate ultrasonic transmitter and receiver and integrated ultrasonic transceiver modules. (Image source: CUI Devices)

## Benefits

The decision to use an ultrasonic sensor instead of other types of proximity/presence detection sensors is largely application-dependent. However, they provide many advantages:

• Unlike optical and IR sensors, ultrasonic sensors operate independently of color. This means that the color of an object does not affect its measurement accuracy.
• Similarly, translucent or transparent materials like glass and water do not negatively impact their performance.
• They provide great flexibility for object detection and distance measurement over a wide range – typically from a few centimeters up to several meters but can be custom designed to operate up to 20 meters.
• They have stood the test of time; based on uncomplicated physical principles, which allow them to perform consistently and reliably.
• Although unsophisticated, they are surprisingly accurate, with 1% (or less) measurement error.
• They can be designed to operate with a high ‘refresh rate’ in applications that require several measurements per second to be made.
• They are constructed using easily accessible and relatively inexpensive components.
• They provide high immunity to electrical noise and can be designed to transmit ‘chirps’ with specially encoded information, to overcome the effects of background acoustic noise.

## Limitations

While offering many benefits and advantages over other sensor types, ultrasonic sensors do have some shortcomings:

• Temperature and humidity affect the speed of sound. This means that environmental conditions can impact the accuracy and stability of distance measurements and they may even require extra compensation circuitry.
• Ultrasonic sensors can only be used to provide distance measurements or object detection – they do not indicate object location or provide information about the shape or color of an object.
• While suitable for industrial and automotive products, their size can present challenges in small, embedded applications.
• Similar to most sensors, they are vulnerable to moisture, extreme temperatures, and harsh conditions, which can adversely affect their performance or even render them unusable.
• Sound requires a medium in which to travel, meaning ultrasonic sensors cannot be used in applications operating in a vacuum.

## Typical applications

Ultrasonic sensors are commonly used to detect the levels of liquid in a vessel. They are particularly suited to this application because they are unaffected by the color (or absence thereof) of the liquid being detected. Also, since they do not touch the liquid, there is no safety concern when detecting volatile substances.

Their simplicity and relatively low cost mean that they are also common in general-purpose object detection applications. Some examples of these applications include vehicle and people detection (Figure 4). They are also used in factories for pallet/box sorting, in drink filling machines, and for counting objects on a production line.

Figure 4: Autonomous vacuum cleaners can use an ultrasonic sensor to avoid collisions. (Image source: CUI Devices)

The transmitter and receiver can also be used independently in certain applications. The high-frequency chirp is audible to animals (who have a higher threshold of hearing than humans) and so can be used in animal deterrent applications. On the other hand, receivers can be used for sound detection as part of security systems.

## Summary

Based on mature and well-understood physical principles, their relative simplicity and versatility, combined with low cost, have allowed ultrasonic sensors to stand the test of time. Commonly used for distance measurement and presence detection in a variety of consumer and industrial applications, ultrasonic sensors have shown that they will continue to find uses in newer and ever more challenging applications well into the future.