Obtaining the maximum amount of data about an environment is a perpetual quest in robotics. Measuring distances is a fundamental component of this data.

Ultrasound sensors are very commonly used to measure distance because they are inexpensive and easy to handle. They are also used to avoid obstacles, to navigate, and for what is known as map building.

This article focuses on this technology, its benefits and limitations, how it is used and what the differences are between the sensors on offer.

The different ways of determining position of a robot using a signal

Before examining ultrasound sensors more closely, let’s see what other technologies are available. All sensors make it possible to gain a picture of the environment (contact, odometry, sensitivity to light, to sound, to heat, etc.). Some sensors can be used to measure the distance of obstacles, and consequently enable a robot to take a decision depending on the obstacles, or lack of obstacles, around it. This is referred to as range finding, i.e. measuring the distance of a remote point.

Besides ultrasounds, two other range-finding technologies are used to carry out such measurements:

  • Infrared
  • Laser

The following table introduces the main advantages and disadvantages of the various options in terms of the solutions offered by mobile robot manufacturers as shown on this website.

  Ultrasonic sensor Infrared Laser
Range From 1 to 250 cm From 5 to 80 cm Several metres to tens of metres depending on the model.
Directivity Cone of approx. 30° Cone of approx. 5° The most directional (around one degree, or even half a degree).
Accuracy Relatively accurate but accuracy lessens with distance, with the measurement angle and with temperature and pressure conditions. Relatively accurate but accuracy lessens over distance. Accurate to within a few centimetres over measurements of several metres.
Cost Inexpensive Inexpensive Relatively expensive
Sensibility to interference Sensitive to temperature and pressure. Also sensitive to other robots using the same frequency, which can cause problems in competition. Sensitive to strong light sources containing a high level of infrared radiation, and also to the colour and type of obstacles. Cannot detect objects that reflect lasers (windows, chrome-plated objects, etc.).



Sound and ultrasound

Sound is a mechanical, elastic wave spreading through a physical medium in the form of longitudinal or compressional waves. This phenomenon is, for example, put to good use by loudspeakers, which cause a membrane to vibrate, which in turn causes the air to vibrate. Sound spreads more quickly the denser the environment, which explains why sound travels faster underwater than in the air. It also explains why ultrasonic sensors do not work in a vacuum, because sound waves cannot travel in a vacuum. You will therefore never see ultrasonic sensors on space probes or lunar rovers.

Ultrasound has a frequency of over 20,000 Hz and is therefore inaudible to humans (hence its name).

There are two types of ultrasound, depending on frequency range:

  • Low-power ultrasound, which is used for measuring distance (range finding), non-destructive tests, echography (ultrasound scanning) and sub-marine acoustics. This is the type of ultrasound of interest to us here; and
  • High-power ultrasound, which changes the environment within which it spreads. Its effect depends on the medium through which it is travelling, and may be mechanical, thermal or chemical.

Ultrasound in nature

Many animals can hear ultrasound, such as dogs and bats. Bats also have the special ability to emit ultrasound for the purposes of finding their way around, known as echolocation. This is exactly the principle used by the robots we program. Other animals have this faculty (whales, dolphins, chiroptera (bat family) and some rodents). They use ultrasound not only for finding their way around, but also to pinpoint prey and to communicate.

Information Society Technologies created the Bat-Bot robot in order to better understand the echolocation process. In fact, while echolocation in water is well-understood through sonar, it is much less so in air. The aim of the CIRCE project conducted by Antwerp University is to better understand these phenomena and make it possible to then offer much more advanced and effective ultrasonic sensors than those currently found on the market. In fact, as we will see later, these sensors are quick and easy to use, but problems do arise as the environment gets more complex.

Humans have put echolocation to good use in various fields. One of the best-known is the ultrasound scan, which can be used to see certain living tissues working (for example, a foetus in a mother’s womb or joint ligaments). The other well-known use is sonar, used by military ships and submarines.

Ultrasound sensors for mobile robots

Ultrasound sensors work by measuring the return time of a sound wave – inaudible to the human ear – emitted by the sensor (transceiver). As the speed of sound is essentially stable, the obstacle’s distance can then be deduced.

Physical and technical properties of ultrasound sensors

The sensors supplied often take the form of a pair of eyes, because there are two key parts:

  • The transmitter
  • The receiver

The transmitter emits a sound at a defined frequency (typically around 40 kHz) and the receiver collects the sound reflected back by obstacles. Distance to objects is calculated by measuring the time taken by the sound to return to the receiver.

How does an ultrasound sensor function

The shape of the beam is characteristic of the sensor used. Figure 1 shows a typical shape for an ultrasonic beam.

Structure of an ultrasound beam

Note that the effective working angle is approximately 30° (which is large compared with other types of sensor), with smaller secondary lobes on each side. Measurement will consequently be more accurate within the central cone of 30°, and less accurate towards the sides. This explains why ultrasound sensors are typically mounted on rotating components so that different measurements can be taken using the central section of the viewing cone.

The width of this cone (30°) is both an advantage and a disadvantage. It is a disadvantage because any obstacle detected is not located precisely within the detection cone. Measurement of position is therefore relatively imprecise. It is, in contrast, an advantage in that it enables the environment to be scanned more effectively, and narrower objects, such as chair legs, will definitely be detected.

The diagram below shows three typical measurement scenarios.

Measurement scenarios for ultrasound sensors

The first scenario will generate a precise measurement because the ultrasound sensor is opposite and perpendicular to the obstacle.

The second scenario will also generate a precise measurement, but will give a “view” of the obstacle located directly opposite the ultrasound sensor.

The third scenario will generate an inaccurate measurement however, given that it is the left side of the ultrasound sensor that is taking the measurement.

It is essential to properly understand the beam structure for the ultrasound sensor being used if it is intended for map building. This is less true for obstacle avoidance.

The fact that ultrasonic sensors are blind at very short distances also needs to be taken into account. This is because of the time delay between emitting the ultrasonic wave and the start of detecting the reflected wave, which is necessary so as not to interfere with measuring.

Some limitations of ultrasound sensors for robots

The shape of obstacles plays an essential role, because it may cause the robot to incorrectly visualise its environment.

> Obstacle shape

Errors caused by obstacle shapes for ultrasound sensors

As the figure above shows, errors generated by obstacle shapes have to be taken into consideration.

> Obstacle texture

Texture also plays an important role. A carpeted wall will reflect waves less well than a painted wall.

> Cross-talk

Two ultrasound sensors cannot be used side by side because if they use the same frequency it is not possible to distinguish which one has emitted a wave. This is referred to as cross-talk.

Another solution for a robot that has more than one ultrasound sensor is to activate them one after the other, which reduces the overall refresh rate.

> Perceptual aliasing

Among the other types of limitation worth mentioning is the problem of perceptual aliasing. This problem arises when a robot is confronted with ambiguous situations that prevent it from choosing with any certainty the most appropriate action, because it lacks enough data about the environment. For example, while an ultrasound sensor enables a robot to position itself alongside a wall, it doesn’t usually enable the robot to know where it is located along the wall – is it at the start, middle or end? Two measurements taken at any point along a wall will provide the same information (unless the robot reaches the end and it detects the absence or presence of a corner).

This problem therefore refers to a sensor’s inability to differentiate between all the different locations within an environment.

To circumvent this problem, several algorithms are possible: learning-based algorithms, memory algorithms, etc.

The way the robot is programmed is an effective way of minimising these side effects, as is increasing the number of sensors.

Examples of ultrasound sensor implementation in robotics

The following are some videos showing examples of ultrasound sensor use.

Obstacle avoidance

In this video, the robot heads towards the most open area. The Boe-Bot kit was used here.


Here, the designer has programmed the robot so that it is static, but uses the ultrasound sensor as radar. It displays the objects it encounters on the screen of the NXT intelligent brick.


The various ultrasound sensors

We will concentrate here on the ultrasound sensors offered within the robot ranges offered by Generation Robots.

Lego Mindstorms NXT

Ultrasound sensor used in Lego Mindstorms NXT kits

This ultrasound sensor is included in the Lego Mindstorms NXT kit.

The product’s official specifications are as follows:

  • Detection range: from 0 to 255 cm with a margin of +/- 3 cm
  • I2C BUS interface
  • Resolution of approximately 6 cm
  • Dimensions: 55 mm x 42 mm x 26 mm

The few limitations that have emerged with this ultrasound sensor are:

  • Measurements under 4 cm cannot be made. This is because of the return time needed for the wave;
  • Measurements up to 20 cm are relatively accurate within an angle ranging between -8° and +30°. In fact, the receiver is on the left and the transmitter on the right, which explains why measurements made on the left are less accurate than measurements made on the right; and
  • Between 20 and 80 cm, measurements can still be made with a margin of error under 8%, which is not too bad for a sensor of this kind.

This sensor can be configured in the usual programming environments of NXT-G and Microsoft Robotics Studio.

Vex Robotics

Ultrasound sensor for Vex Robotics

This ultrasound sensor is not included in the basic kit but is available separately on Génération Robots by following this link.

This sensor’s technical specifications are as follows:

  • Transmission frequency: 40 Hz
  • Distance measurement: between 3 cm and 3 m
  • Pulse duration: 250 ?s

This ultrasound sensor requires the RobotC programming kit, which is included within the kits sold on Generation Robots.

An example of using the ultrasound sensor with a Vex robot:



Ultrasound sensor for Parallax

This ultrasound sensor is not included in the basic kit but is available separately. It is adaptable both for Boe-Bots and Sumobots.

This product’s technical specifications are as follows:

  • Distance measurement: between 2 cm and 3.3 m
  • Average error less than 0.5 cm
  • Transmission frequency: 40 Hz

The transmitter is on the right and the receiver on the left when looking at the sensor head on (as shown in the figure below).


Ultrasonic sensors are easy to configure and, when combined with other sensors, enable very useful data to be provided about the robot’s environment. Your robots will no doubt have one or more sensors of this type!




Generation Robots (

All use and reproduction subject to explicit prior authorization.


Stay in touch with robotics and its development. Sign up for our newsletter!