Hexamite

Ultrasound and Microcontroller Applications

Main Index

Speed of Sound

The nominal value for speed of sound in seawater is nominally 1500 m/s at about 13 degrees centigrade. At salinity level of 35 parts per thousand, depth 0 meters and temperature 0 degrees, speed of sound is 1449.3 m/s. Speed of sound in air is nominally 346m/s at 25 degrees, this speed drops to 331 at 0 degrees. The temperature dependency is second order given that other parameters are constant.

 

Speed of sound in air (some applications using 40khz ultrasonic sensors)

Speed of sound in air is mainly effected by temperature, humidity however has some effect. Temperature gradients in air and humidity effect the attenuation of sound, temperature whirlpools may refract the sound and to some effect reflect the impeding sound.

Speed of sound as a function of temperature only:

c = 331,3 (m/s) * (1+T/273)1/2

c = 1087 (ft/s) * (1+T/273)1/2

T is temparture in centigrade Co

 

Sound Attenuation in Seawater

Attenuation in seawater is composed of geometric spreading, shear and dilatational viscous losses, relaxation of the MgSO4, and applicable boundary conditions. At lower frequency under 1khz an unidentified relaxation mechanism dominates the attenuation. The absorption losses in this medium are effected by temperature (relaxation), depth (pressure) and salinity.

 

Sound Attenuation in Air

Overall attenuation in air can be composed from the following: geometric spreading, conduction and shear viscosity losses, molecular relaxation, boundaries, refraction by non-homogeneous atmosphere,  diffraction by turbulence. Atmospheric absorption is a function of distance and is effected by secondary factors like temperature, humidity and atmospheric pressure. Decibel variations in atmospheric attenuation due to secondary factors can be more than an order of magnitude.

Most significant attenuation is due to relaxation or absorption of the medium. This attenuation for ultrasound apears to be mostly linear with respect to the decibel scale, and can be given in terms of db/ft or db/m.

a=0.01(db/ft) * f 

a=0.033(db/m) * f

where: a is attenuation and f is frequency in terms of KHZ 

Geometric spreading depends on the transducer used, and is sensitive to the beam width.

 

The 40Khz Sonic Wave (some applications using 40khz ultrasonic sensors)

The media through which the sound travels in the following is assumed to be air, see (HE-US series Transceivers). Any material different from air (density and speed of sound) is referred to as the object (this includes solids, gasses and liquids). An object can also be temperature gradient in air, although not chemically different it will conduct sound at an altered speeds. All objects reflect, absorb and feed a portion of the wave through. 

The amplitude of the wave reflected is directly proportional to how much surface is available on the object for coherent reflection. Surface size, shape and orientation, are major factors contributing to the strength of the reflected signal; material composition is also a factor. A part of the wave landing on the surface of the material is reflected, while a part of the wave penetrates the material and is eventually reflected of any surface boundaries encountered while travelling within the material. Hence you will receive a signal coming from inside the material as well, but it is minuscular.

example

Figure E1.

Measurement of Position (echo ranging)

If T0 is the time at which a burst of pulses is transmitted (see fig. E1 TX) and T1 is the time at which the transmitted burst is received (see fig. E1 RX), then the distance D from the sensor to the object can be determined.

D = 0.5 * C * ( T1-T0 ) ... (EQ1)

Where:
D = Distance to Object
C = Speed of Sound
T0 = Time at which sonic wave is transmitted
T1 = Time at which sonic wave is received
Using the Microcontroller

It is straight forward to trigger a timer (stopwatch) when the sonic burst is transmitted and stop the timer when the transmitted burst is received. Many readily available embedded microcontrollers and microcomputers have a integrated timer/counter which operate similar to a stopwatch. These timers can be incremented ever microsecond or once every few nanoseconds. In many cases, means to capture the time is also provided; this way you do not have to stop the timer, you capture time on the fly.

Assuming that sound travels 344m/s; we can calculate the best displacement resolution expected using ordinary microcontrollers, in terms of meters. In the following it is assumed the microcontroller is able to capture time within a microsecond, hence smallest measure of time is 0.000001 or 1ls.

D = 0.5 * Speed of Sound * ( smallest measurable time increment )

D = 0.5 * 344 * (0.000001) = 0.000172 meters

Ideally, the displacement of an object, can be measured with a precision of approximately 0.2 millimeters using a common microcontroller referred to above.

 

Doppler Effect

If the object is traveling at speed V as shown in figure E1., the wavelength of the received (reflected) sonic burst (rx) will be different from that of the transmitted burst (tx) (Doppler Effect). The following relationship can be deducted:

krx = C * ktx / (C+V) ..object approaching (EQ2)

krx = C * ktx / (C-V) ..object retreating (EQ3)

Where:
k = Wavelength (ktx transmitted wavelength, krx received wavelength)
C = Speed of Sound
V = Velocity of the Object

Since Frequency = 1/ (Time period) and Frequency = (speed of sound)/wavelength, this relationship can be re-written using EQ2 and 3 for V in terms of frequency. It goes like this:

V = C * ( Frx / Ftx - 1 ) ..object approaching

V = C * ( 1 - Frx / Ftx) ..object retreating

Here F stands for frequency

It is better to measure time difference with the microcontroller than measuring frequency. Since frequency of a sinusoidal wave, can be expressed in terms of the time periods between the wave peaks, (F = 1/T). The relationship above can be expressed in terms of time instead of frequency, which yields:

V = C * ( Ttx / Trx - 1 ) ..object approaching

V = C * ( 1 - Ttx / Trx ) ..object retreating

T = Time period between wave peaks
C = Speed of sound
V = Velocity of object
Practical Consideration when using Microcontrollers

If the frequency of the transmitted wave is 40Khz, then the time period between peaks is 1/40000 equivalent to 25 microseconds.

Lets assume we have a microcontroller which increments a timer once every microsecond, and calculate the resolution by which we can distinguish between different velocities. Clearly the microcontroller can only count to 25 in 25 microseconds. The computer can only tell us that a wave front was received somewhere between counts, it cannot tell us the exact time it happened. Thus if the time period T between wave peaks is 24.5 microseconds, the computer will tell us that the period between peaks is 25 microsecond. For the microcomputer to tell us that the time between peaks is 24 microseconds the actual time, must be an element below that, like 23.9999 microseconds, but this depends on capture capability.

Now we can calculate what speed difference we can measure using the microcomputer under ideal conditions.

V = 344 * (25/24 - 1) = 14.33 m/s and similarly

V = 344 * (25/23 - 1) = 29.91 m/s

The above would require ideal conditions, if the wave peak picked for measurement is distorted or shifted due to complications in the environment, your measurement will not be reliable

It is better to send burst of sonic waves like 100 waves and then average the periods between tops on the reflected wave. This will significantly increase the resolution of measurement and improve reliability. It will take 2500 microseconds to transmit 100 wave fronts. In this case the microcontroller can count to 2500 between wave peaks measured. We can calculate the ideal resolution of measurement as follows.

V = 344 * (2500/2499 - 1) = 0.14 m/s

This is equivalent to a motion of 0.5 Km/Hour or 0.32 Miles/Hour.

New Product: Hexamite Multi Processor Development System