Ultrasonic sensor

On this page 7

An ultrasonic sensor is a range sensor that emits a pulse of high-frequency sound, usually between 40 kHz and a few hundred kHz, and measures the time until the echo returns from an object. Among sensors in robotics it is one of the simplest and cheapest ways to detect obstacles and measure distance, typically from a few centimeters to several meters.

Because sound reflects from almost any solid surface regardless of color or transparency, an ultrasonic sensor sees glass, dark objects and clear plastic that can confuse optical sensors. Its weaknesses are a wide, coarse beam, sensitivity to angled surfaces and a slow update rate compared with LiDAR or depth cameras.

How an ultrasonic sensor measures distance

The sensor uses a piezoelectric transducer that vibrates when driven by a voltage burst and produces an electrical signal when an echo strikes it. Many robotics modules use one transducer to transmit and a second to receive, while automotive parking sensors use a single transducer for both.

Distance follows from the time-of-flight principle: distance equals the speed of sound multiplied by the round-trip time, divided by two. In air at 20 degrees Celsius sound travels at about 343 meters per second, so an echo after 5.8 milliseconds corresponds to roughly one meter.

After transmitting, the transducer keeps ringing for a short time, and echoes arriving during this ringdown period cannot be detected. This creates a blind zone, often 2 to 30 centimeters depending on the design, inside which the sensor reports nothing useful.

Key parameters and typical values

Selecting an ultrasonic sensor means matching its frequency, range and beam width to the task. Higher frequencies give finer resolution and narrower beams but are absorbed faster in air, which shortens the range.

ParameterTypical rangeWhat it affects
Operating frequency40 to 400 kHzRange, resolution and beam width
Measuring rangeAbout 2 cm to 10 mUsable working distance
Beam angleAbout 10 to 60 degreesLateral coverage and ambiguity
ResolutionAbout 1 mm to 1 cmSmallest detectable distance change
Update rateAbout 10 to 50 Hz per sensorReaction time at speed
Blind zoneAbout 2 to 30 cmMinimum measurable distance
Typical ultrasonic sensor parameters

The update rate is limited by physics: the sensor must wait for echoes from the farthest expected target before firing again. For a 5 meter range the round trip already takes about 30 milliseconds, which is why ultrasonic arrays often fire sensors in staggered sequences to avoid crosstalk.

Ultrasonic sensors compared with other range sensors

In robotics, the ultrasonic sensor competes with infrared, time-of-flight and LiDAR sensors. Each uses a different physical signal, so each has a distinctive pattern of strengths and blind spots, and robust robots often combine two of them.

SensorSignalStrengthWeakness
Ultrasonic sensorSound pulseSees glass and dark objects, low costWide beam, slow, angle sensitive
Infrared sensorReflected infrared lightSmall, fast, cheapAffected by color and sunlight
Time-of-flight sensorModulated lightPrecise, narrow fieldFails on transparent surfaces
LiDARScanned laser pulsesDetailed maps, long rangeCostly, misses glass
RadarRadio wavesWorks in dust, fog and rainLower angular resolution
Range sensing technologies compared

This complementarity explains a common design pattern: a robot navigates with LiDAR but carries a ring of ultrasonic sensors around its base as a safety layer, catching glass doors, table legs and low obstacles that the laser scanner can miss.

Using ultrasonic sensors on a robot

Good results depend more on placement and signal handling than on the sensor itself. Mounting height, spacing between sensors and filtering of noisy readings determine whether the data is useful for obstacle avoidance.

SituationRecommended choiceReason
Several sensors side by sideFire them in sequencePrevents one sensor hearing another
Robot moving quicklyCombine with a faster sensorUpdate rate limits reaction time
Large temperature swingsCompensate the speed of soundSpeed changes about 0.6 m/s per degree
Noisy or spurious readingsApply median filteringRemoves isolated false echoes
Liquid or bin level sensingUse a narrow-beam industrial unitAvoids echoes from container walls
Practical decisions when integrating ultrasonic sensors

Ultrasonic readings are usually treated as a cone of uncertainty rather than a point. Classic occupancy grid mapping marks the whole arc at the measured distance as possibly occupied and the space inside the cone as probably free, which turns coarse measurements into a useful map over time.

Limitations and failure modes

Most ultrasonic errors arise from how sound reflects. Smooth surfaces act like acoustic mirrors, so a wall hit at a shallow angle sends the echo away from the receiver and the sensor reports no obstacle at all.

  • Specular reflection: angled smooth walls beyond about 30 degrees may return no echo.
  • Multipath echoes: sound bouncing via a second surface makes objects appear farther away.
  • Soft absorbing materials such as foam, curtains and clothing return weak echoes.
  • Crosstalk between neighboring sensors produces phantom obstacles.
  • Wind, temperature gradients and acoustic noise from compressed air can disturb readings.

A common misconception is that the reported distance belongs to the object straight ahead. In reality the sensor returns the nearest echo anywhere inside its beam, so a narrow doorway can appear blocked by its frame, and a small object off to the side can look as if it sits in the robot path. Treating each reading with its full beam geometry, rather than as a single ray, prevents many false stops and missed openings in narrow spaces.

Put simply

An ultrasonic sensor works like a bat or a dolphin. It makes a very high-pitched click that people cannot hear and listens for the echo. The longer the echo takes to come back, the farther away the object is.

It is cheap and can notice things that cameras and lasers miss, like a glass door. The catch is that it sees only a blurry cone in front of it, so it tells a robot that something is there, not exactly what or where.

In practice

A small delivery robot operating in an office building uses a 2D LiDAR for navigation, but during trials it repeatedly drove toward glass partitions and the transparent doors of meeting rooms. The laser beams passed through the glass, so the map showed open space where there was a wall.

Engineers added six ultrasonic sensors around the front bumper, firing in sequence at about 15 Hz each, and configured the planner to stop when any reading dropped below 40 centimeters. The glass collisions stopped, and the robot also began detecting the thin metal legs of chairs that the scanner had missed. The ultrasonic layer did not replace the LiDAR; it closed its blind spots at very low cost.