Ultrasonic Acoustic Sensing

This lecture is about advanced sensors and we'll focus primarily on sonar or ultrasonic sensors as they are the workhorse sensor of mobile robotics. You can find out about other sensors for extracting range information from my notes for last year's class. Ultrasonic sensors are often used in robots for obstacle avoidance, navigation and map building. Much of the early work was based on a device developed by Polaroid for camera range finding. From the Hitechnic Ultrasonic Sensor web page we learn that their "ultrasonic range sensor works by emitting a short burst of 40kHz ultrasonic sound from a piezoelectric transducer. A small amount of sound energy is reflected by objects in front of the device and returned to the detector, another piezoelectric transducer. The receiver amplifier sends these reflected signals (echoes) to [a] micro-controller which times them to determine how far away the objects are, by using the speed of sound in air. The calculated range is then converted to a constant current signal and sent to the RCX." The Hitechnic sensor is different from the Polaroid sensor in that it has separate transmitter and receiver components while the Polaroid sensor combines both in a single piezoelectric transceiver; however, the basic operation is the same in both devices.

There are a number of complications involved in interpreting the time-of-flight information returned by an ultrasonic sensor. If the sensor face is parallel to the surface of the nearest object and that surface is flat, reflective and relatively large, e.g., a plaster wall, then the information returned by the sensor can be reasonably interpreted as the distance to the nearest object in front of the sensor. However it the object deviates significantly from this ideal object, the time-of-flight information can be misleading. Here is one of the more benign sorts of interpretation error caused by the fact that the signal (corresponding to a propagating wave of acoustic energy) spreads as it propagates further from the sensor with most of the energy of the leading edge confined to a 30 degree cone. If the surface is angled with respect to the face of the sensor (as it is below) then the time of flight information will record the distance to nearest point within the 30-degree cone.

To complicate things still further, the beam is not entirely confined to a narrow cone. As the picture below indicates there are so-called side lobes which if reflected first could confuse interpretation of the time-of-flight information. The dark curve represents the equipotentials of the sound energy level.

It's not unusual that scenes appear differently depending on your perspective. In the case of sonar, due to the relatively wide beam width important features of the environment only show up when the robot is close enough to observe them. In the following sequence (adapted from the web pages of the Seattle Robotics Club), the doors of a room only appear as the robot gets closer.

Just as in the case of light sensors, understanding the properties of the surfaces of objects is important in effectively using ultrasonic sensors. Size, proximity, arrangement (of multiple objects), geometry and surface characteristics (e.g., specular versus diffuse) all have to be accounted for in the process of interpretation. Of course the trouble is that the robot won't know these characteristics so it will either have to infer them or assume that the variation in these characteristics is just another source of noise. As we'll see when we get to the lecture on uncertainty, the interpretation of sonar data is a good application for probabilistic methods. The interpretation problem becomes particularly interesting when we are faced with combining (or fusing) the data from multiple sensors or multiple readings from a single sensor. Fusing sensor data allows a robot to build up a more comprehensive representation of its environment.

Sonar Calibration Experiments

I've never used the Hitechnic sensor before and I couldn't find a great deal of information about it online; so I designed a little rig for sonar calibration and performed a few experiments to get a feel for the Hitechnic sensor.

Here's a simple experiment showing how the orientation of an object can cause it to be visible to sonar in some poses but invisible in others. The target object is a Lego IR tower set 30 cm from the sonar sensor. When the face of the tower is parallel to the ultrasonic wave front, the sensor correctly estimates the distance to the tower, but, when the tower is turned so that its face is turned at approximately 45 degrees to the wave front, the tower "disappears."

In the next experiment, I simulated detecting the distance to a wall at different angles to the sonar. The wall in this case is simulated by a smoothly sanded wooden board about 8 cm high and 30 cm distant from the sensor at the point along the axis emanating from the center of the sensor perpendicular to the sensor face. I also tried a similar experiment with a piece of plaster wall board (1/2 inch sheet rock) about 25 cm high. In both cases, the wall "disappeared" when the wall and the plane of the sensor face were at an angle of approximately 40 degrees. All this really means is that at approximately 40 degrees not enough energy is reflected back to the sensor and the timer "times out" before receiving a return signal.

To test the accuracy of the sensor, I ran a series of tests positioning a wooden board tangent to an idealized circular wave front at 10 cm increments along lines at an angle of 0, 15, 30 and 45 degrees to the axis emanating from the center of the sensor perpendicular to the sensor face. This is easier to show than to say; the red crosses in the following marked-up image show representative sample points.

I used two lengths of board: one long board simulating a wall and a second board about four inches wide simulating a small obstacle. The following table summarizes the experiments. Note that as the distance increases the sensor values decrease. Perhaps initially the value is set to be 1024 and the timer decrements the value at each tick of the clock. I set the sensor port to light sensor mode and recorded the raw sensor values. The speed of sound at 21 degrees Celcius (69.8 degrees Farenheit) is approximately 344.2 meters per second (approximately 1129.3 feet per second). So the sonar ping should travel 90 cm in about (90 / (344.2 100)) = 0.002615 seconds.

Sonar Data from Experiments

Distance 0 deg - wall 0 deg - obst 15 deg - wall 15 deg - obst 30 deg - wall 30 deg - obst 45 deg - wall 45 deg - obst
10 cm 1020 1019 1020 1019 1020 1019 937 386
20 cm 981 981 981 981 981 975 386 386
30 cm 930 929 930 930 931 385 386 386
40 cm 885 879 879 885 385 878 386 386
50 cm 834 828 834 835 386 386 none none
60 cm 783 783 783 790 782 789 none none
70 cm 738 738 731 738 none none none none
80 cm 687 681 686 693 none none none none
90 cm 642 648 635 647 none none none none

You'd need to run a lot more experiments with different materials and different shaped, posed and positioned objects before you could construct a sensor model that would suffice for a range of real-world situations. In many applications, you can limit the sorts of materials and objects your robot will encounter. But no matter what your application some amount of experimentation will be needed to design an effective sensing strategy. Don't assume that the values returned by a sonar correspond to the distance to the nearest object!


The piezoelectric effect refers to the voltage produced between surfaces of a solid dielectric (nonconducting substance) when a mechanical stress is applied to it. Conversely when a voltage is applied across certain surfaces of a solid that exhibits the piezoelectric effect, the solid undergoes a mechanical distortion. Such solids typically resonate within narrow frequency ranges. Piezoelectric materials are used in transducers, e.g., phonograph cartridges, microphones, and strain gauges, that produce an electrical output from a mechanical input. They are also used in earphones and ultrasonic transmitters that produce a mechanical output from an electrical input.