mirrorok 发表于 2007-6-14 16:22:47

An Introduction to Robot Sonar 机器人声纳的文章

http://www.robotbuilder.co.uk/Resources/Articles/138.aspx



An Introduction to Robot Sonar                                          Bill Marshall

What is Sonar?

Sonar is a method of finding the distance to an object by measuring the time it takes for a pulse of sound (usually ultrasound) to make the round trip back to the transmitter after bouncing off the object. At sea level, in air, sound travels at about 344 metres per second (1130 feet per second). In practical terms this means 2.5 cm is covered in about 74 microseconds. These sorts of numbers are easily managed by a simple microcontroller system. Imagine the time measurements you would have to make if light was used instead! In principle, all you do is send a burst of ultrasound from a suitable transmitter, setting a clock or timer running at the same time. When the receiver picks up the reflected signal or ‘echo’, the clock is stopped and the elapsed time is proportional to the distance. Easy. Well, yes and no. There are some practical problems that need to be addressed.



Transducer Characteristics

An ultrasonic transducer is basically a miniature loudspeaker tuned to emit or receive a single frequency, usually 40 kHz. The sound does not emerge from the front of the



device in a nice pencil-shaped beam, but has a shape like that in Figs. 1b and 1c.







            





Remember that these shapes are three-dimensional, so Fig.1a would be a cylinder shape. The wide beam transducer puts out a lot of energy sideways, and if the receiver sensitivity has the same shape then you may have problems with the ‘direct’ signal. In other words the receiver picks up the transmitted pulse not just the echo. I found I had just this problem when I used the URR Cybot’s transducers with my new Cy-Q circuits, so I replaced them with narrower beamwidth devices with a pattern like Fig.1c. The length of the main ‘lobe’ gives an indication of likely maximum range. Obviously, use enough power and you can detect objects many metres away, but this is pointless in a small, Cybot-sized robot. Two metres should be enough; less if all you want to do is avoid hitting things rather than construct a ‘map’ of the room.



Reflection Problems

If targets were always at right-angles to the axis of the beam, distance measurements would be reliable and accurate. Unfortunately they seldom are, and to make it worse the target material may be such that no signal is bounced back at all. Fig. 2 illustrates some problematic situations. For simplicity, the signal path is shown as a single line.







         







If the robot is heading towards the wall at an angle, then you can see from Fig.2a that the measured distance will be too long.A strange effect occurs when the angle with the wall becomes shallower as in Fig.2b. At a certain critical angle, Specular Reflection takes place and all the signal is reflected away from the robot. In other words, the wall disappears because there is no echo! This critical angle depends on the wall material and its surface: a very smooth gloss finish on a skirting board can lead to specular reflection. Slightly rough surface materials, such as cardboard cause the signal to be scattered in all directions, so at least some makes it back to the receiver. Fig.2c shows how specular reflection in a corner can fool the sonar into making a very large error indeed.



The hardness of the target material is also an important factor. A skirting board will reflect most of the energy, absorbing very little, but soft furnishings (or trouser legs!) will do the reverse. This means that the maximum detection range is large for the walls, but soft objects may not be ‘seen’ until the robot is nearly on top of them. Note that this does not affect the accuracy of distance measurements, only the maximum range at which a particular object can be detected.



Noise Interference

The sonar signal is a short burst of ultrasound at 40 kHz, way above frequencies humans can hear. Bats use sonar at these and higher frequencies and a useful tool for ‘listening’ to your sonar is a Bat Detector available in kit form for about 20 GBP. The transducers are tuned piezo-electric devices so the transmitter only emits the one frequency, and the receiver is very insensitive to frequencies away from 40 kHz. Most extraneous noise from say, the robot’s motors will thus be ignored. However motor vibration fed to the transducer through the robot body will cause trouble. Sharp mechanical shocks can also provide a false echo, for example if the front castor runs over a crack in a hard floor. That is why Cybot’s transducers are mounted in foam rubber. Only the receiver transducer needs this treatment however. An alternative would be to mount the motor/gearbox assemblies on foam rubber instead.



Electronics

The transmitter transducer can be driven directly from say, a pair of microcontroller port lines, taking each high and low alternately. The piezo-electric device behaves like a church bell when struck: it resonates at its natural frequency. A single pulse applied to the terminals will set it ‘ringing’ at 40 kHz for a number of cycles, adequate for this job. The receiver transducer output will be very small, so an amplification circuit is necessary to bring it up to a sensible level. The clock or timer necessary for measuring the signal ‘time of flight’ can usually be found built-in to most microcontrollers. A circuit diagram for a 4-channel sonar system is given in Fig 3.













A 74HC138 decoder chip provides the transmitter drive. Logic signals Sel Tx0 and Sel Tx1 enable one of 4 possible transducer units. These same signals drive the CD4052 analogue multiplexer ensuring that the corresponding receiver output is routed back to the microcontroller via Sonar Rx Out. Pulsing a transmitter just involves toggling Toggle Tx from 0 to 1 and back again.



The Sonar Rx Out signal connects to a comparator input of a suitable microcontroller such as the PIC 16F627 or 16F877. The reference input to the comparator will be set by experiment to minimize the reception of false echoes caused by noise.



Programming

The program is quite simple:



Enable a 16-bit timer and its interrupt on overflow. Set up comparator reference and enable its interrupt.

Select sonar channel.

Pulse transmitter, clear timer and set it counting.

Either an echo arrives before the timer overflows, generates a comparator interrupt and stops the timer with a count proportional to the time taken for the echo to return.

or   no echo arrives and the timer overflows generating a different interrupt indicating no in-range object detected. This time-out is necessary, otherwise the robot will wait for ever if there is no target.

If an echo is detected, wait around for the whole burst to be received before sending another pulse. This wait period can be determined by trial and error, or if an oscilloscope is available the received burst length can be measured.





There are other issues and problems, but these are the main ones. At least air is a uniform medium: in the sea, sonar encounters problems with temperature boundaries and layers of varying salinity. It’s amazing underwater sonar works at all!

lionmilk 发表于 2007-6-14 20:40:24

不错的文章。

标题改为“An Introduction to Robot Sonar 机器人超声定位(测距)简介”是不是更让大家好理解些?

声纳,总感觉是船上用的东西。

Hyzilla01 发表于 2016-1-15 21:27:55

很不错的文章
页: [1]
查看完整版本: An Introduction to Robot Sonar 机器人声纳的文章