# Sonar for obstacle avoidance: how many sensors and where to place them?

For avoiding obstacles during 2D robot navigation what is the best position/angle to place the sonar sensors? How many should there be?

I would like to know if there is some theory or examples for the problem of placing. I realize that it depends on the way that the robot moves and its geometry, but I am searching for general answers.

• Why don't you just use a servo. Some sonar sensors are so expensive that if you need a wide angle, a servo would be easier, cheaper, and use less pins. There is a disadvantage: you can't go as fast because it wouldn't be able to sense fast enough unless you get a high quality sensor. Also, servos take lots of power, so beware. I know you already have an answer, I just wanted to point this out for the community. Jan 30 '13 at 1:18

Generally the main factor in positioning sensors is the actual beam width of the sensors themselves. It's usually the case that the longer range the sensor is, the narrower the beam width.

So firstly you need to work out the range you are aiming to sense at and pick some sensors that work at that range.

Then you've got to decide on how wide an angle span you want to sense distance at. For instance, you may decide to cover everything in-front and to the sides of a robot (a 180 degree range, 90 degrees to either side of straight-ahead).

You then divide the angle span by the beam width of your chosen sensor to get the number of sensors you need.

Using the above example, if you have sensors with a 90 degree beam width, you'd only need two of them, each at 45 degrees either side of straight-ahead. If you had longer-range sensors with, say, a 20 degree beam width, you'd need 9 of them to cover the same area.

Obviously the beam width is not an exact measurement so its probably safer to have some overlap of the beams. Finally, the sensors should be installed symmetrically between the left and right sides of the robot.

To expand on thisismyrobot's answer, beam width is indeed important. However, there are a number of other factors, such as the reflectivity of the environment (acoustic "brightness"), transmission frequency, etc.

Although it is from 1988, Obstacle Avoidance with Ultrasonic Sensors covers the challenges well - the physics of echo-ranging appear to have changed little over the years :)

The Ultrasonic sonar sensors article on Generation Robots introduces some of the more interesting issues in ultrasonic ranging: beam shapes and lobes (see the 50kHz figure).

From there, you should visit these more detailed articles on beam characteristics and sensor selection: