Sonar 2 Equations

A) Coordinate System

Figure 1 shows the Cartesian coordinate system I used on my sonar system. This system uses two planes which are separated by a line perpendicular from the face of the transmitter. The face of the transmitter transducer is X = 0 and Y = 0. In Plane 1 (right plane) both the angle and X are positive and in Plane 2 both the angle and X are negative. In both planes Y is positive and increase as the distance from the transmitter increases. In my system both receivers are six inches from the transmitter.

Figure 1 – Sonar Coordinate System

Echo Time and distance

Distance in inches = ( echo time in uS / 2 ) / 74.0 = Echo Time uS / 148.0

Divided by 2 because the echo time is a round trip, double the distance

Divided by 74.0 because sound travels one inch in 74.0uS at 25°C.

B) Identifying Objects from two echoes

If the object is directly in front of the sonar system the time it takes the echo from an object to reach the right and left receivers will be the same. As the object is moved to the left or right of the sonar’s center the echo will take longer to reach one receiver that the other receiver. From this time difference the objects coordinates can be calculated. This gives you the X and Y location of the closest edge of the object relative to the sonar’s transmitter. From the pulse width of the echoes the length of the object can be estimated and the object’s far edge coordinates can be calculated. Since a number of factors can affect the signal’s pulse width the far edge coordinates is only an estimate.

C) Correlation between Right and Left Echoes

When combining the echoes from the right and left receivers to determine the coordinates of an object, it is important to make sure the two echoes are actually from the same object. Echoes from objects at an angle greater than 30° from the sonar’s norm will be very weak and it is unlikely that both receivers will receive echoes from an object at an angle greater than +/-30°. Therefore 30° can be used to establish the maximum difference in time between left and right echo signals coming from the same object.

Trig can be used to calculate this max difference, however it can be approximated using the equation below. In this equation, Dmax is a good estimate of the maximum distance between echoes coming from the same object. At a distance of 40” the two echoes must be within about 4” to be from the same object. At a distance of 80” the two echoes must be within about 1.0” to be from the same object.

Maximum distance between two echoes from same object

Eavg = ( Edr + Edl) / 2

Dmax = 2060188 / ( Eavg / 0.00009315)1.050964

Dmax = Maximum Distance between two echoes to be from same object

Edr = Right Echo Distance

Edl = Left Echo Distance

Eavg = Average Echo Distance

Graph #1 – Max Distance between two echoes from same object

D) Objects with two echoes within maximum seperation

a) Object is in front or to the side

Echoes received be directly in front of the sonar system or off to one side or the other of the sonar system. The equations to calculate the X coordinate of an object is slightly different for objects directly in front verses object to the side of the sonar system. Figure 2 shows the echoes, A & C from an object in front of the sonar and within two perpendiculars from the center of each receiver. Figure 3 shows the echoes, A & C, from an object outside the receivers’ perpendiculars.

Figure 2, Object inside Receivers’ perpendiculars

Figure 3, Object outside Receivers’ perpendiculars

b) X Calculations

1) Objects Inside Receivers’ Perpendicular, Figure 2

If the sqrt ( abs( A2 – C2)) is less than the distance between the two receivers the object is within the receivers’ perpendiculars.

When an object is inside the perpendiculars, the X calculations from two echoes is calculating the distance to the center of the object, not to the edge of the object.

The equation is (see Appendix A for derivation):

if ( A > C )

X2 = (C2 – A2 + X12)/ 2X1

Xo = X2 – X1/2

if ( C > A )

X2 = (A2 – C2 + X12)/ 2X1

Xo = X2 – X1/2

Xo = X distance to the center of object from the sonar norm

A = Echo distance to right side receiver ( ET / 148)

C = Echo distance to the left side receiver (Et / 148)

X1 = Distance between the two receivers.

All distances are in inches.

Echo Time is in uS.

2) Objects Outside Receivers’ Perpendicular, Figure 3

If the sqrt ( A2 – C2) is greater than the distance between the two receivers the object is outside the receivers’ perpendiculars.

When an object is outside the perpendicular, the X calculations from the two echoes is the distance to object’s closest edge.

The equations is (See Appendix B for derivation):

if ( A > C )

X2 = (A2 –– C2 – X12)/ 2X1

Xo = ( X2 + X1/2 )

if ( C > A )

X2 = (C2 -A2 – X12)/ 2X1

Xo = -( X2 + X1/2 )

Xo = X distance from sonar norm to leading edge of object

A = Echo distance to right side receiver

C = Echo distance to the left side receiver

X1 = Distance between the two receivers.

All distances are in inches.

Echo Time is in uS.

3) Y Calculations

The object’s Y coordinate is the distance from the Sonar plane, to the face or the object closest edge. In Figures 1 & 2 this distance labeled Y. The equation for Y is the same if the object is inside or outside the receivers’ perpendiculars. It is:

Yo = sqrt (C2 – X22)

E) Object with only one Echo

There is a 12” on the outside of each receiver window, the separation of the two receivers, where an object will be picked up by one receiver and not the other receiver.

Figure #4 – Single Echo area

This window can be described with the following equation.

XRmin = C * Sin 30° ) – 12”

XLmin = -C * Sin 30° ) + 12”

An object detected by one receiver and not the other falls somewhere between Xmin and Xmax. From my testing it appears the width of this window is more like 8” and good estimate of the object’s X coordinate can be obtained with the following equation.

Echo received by Right Receiver

Leading edge coordinates

Yo = ( Echo Time /148 )

Xo = 0.5*C – 10

Echo received by Left Receiver

Leading edge coordinates

Yo = ( Echo Time / 148 )

Xo = 10 – 0.5*C

F) Far Edge or Object Width Calculations

The Pulse Width of the returned echo is a good indication of size (length) of the object. However, there are a number of things other things that will also affect the pulse width of the echo.

These are a main things that will affect the pulse width of an echo.

Material object is made of.

Angle of the object.

Height of object.

Width of object.

Distance the object is from the sonar.

Transmitter Pulse Width.

Receiver ringing

The first two are unknowns which at this time cannot be factored in an equation. However, in my Sonar 3 system I am measuring the amplitude of the echo pulse which may help identify the objects material and angle.

The echo from an object of some given size will have a minimum pulse width that is related to the transmitted signal’s pulse width. The transmitter pulse width is related to the number of transmitter cycles and the amount of ringing. In my Sonar 2 I used two transmit cycles in most of my testing which resulted in in resulted in a transmitter pulse width of about 150uS, two cycles plus ringing. This creates an offset of about 1.8” which must be subtracted from the far edge calculation. In my Sonar 3 I have reduced the transmit cycles to one and am working on some ideas to reduce the ringing.

Both the width and height of the object will change the Pulse Width of the returned echo. The reason this happens is because as you move across the surface of the object away from closest edge the distance to the receiver increases and it takes longer for the echo to return. To the receiver this appears to be one long echo which produces a longer pulse width.

For objects with two matching echoes, I use the largest pulse width. However I am still reviewing this. It might be better to use the pulse width of the shortest echo distance or an average of the two pulse widths.

Also distance affects the pulse width. When the same object is moved further away from the sonar system its pulse width becomes shorter. Therefore there is a need for a correction factor, which I have labeled K, that adjusts the pulse width based on echo distance. I am still working on defining the best value for K.

The following equations are used to generate a rough estimate of the size of the object. They can be used to tell the difference between a thin pole and a wall, but there are too many unknowns to accurately determine the width of the object

Figure 5 – Object Size

Ed = Echo Distance to the closest edge of object in inches

Edf = Echo distance to far edge

PW = Pulse Width in uS

Pw = Pulse Width in inches

Os = Object Size, inches

K = Pulse width correction for distance, for now it is zero.

Adjust Pulse Width for distance and Convert to inches

Pw = (( PW / 2 ) / 74 ) * ( Ed * K ) // Convert Pulse Width to Inches

Far Edge Echo Distance

Edf = Ed + Pw

Object Size

OS = √ ( Edf2 – Ed2 )

Far Edge Coordinates Calculations

Assuming the Object Size is its width, not it height, these are coordinates of the far edge.

Far Edge Xe = Xs + OS

Far Edge Y = Assumed to be same as near edge Y

F) Examples

a) Single Echo Object

Echo Time (A) = 9,960uS

Echo Pulse Width = 300uS

Leading Edge Equations

Yo = ( Echo Time /148 )

Xo = 0.5*C – 10

Calculation

Yo = 9960 / 148 = 67.2”

Xo = 0.5 *67.2 – 10 = 23.6”

Yo = 67.2”

Xo = 23.6”

Far Edge Calculation from Pulse Width

Pw = (( PW / 148 ) * ( Ed * K )

Pw = (( 300us / 148 ) = 2.0”

Edf = Ed + Pw

Edf = 67.2 + 2.0 = 69.2”

OS = √ ( Edf2 – Ed2 )

OS = √ (69.22 – 67.22) = 16.6”

Xe = Xs + OS

Xe = 23.6” + 16.6” = 40.2”

Object Size = 16.6”

Far Edge X = 40.2″ (estimate)

b) Double Echo Object, Inside Perpendiculars

Right Receiver Echo (A) Time = 8,513uS Distance = 57.5”

Left Receiver Echo (C) Time = 8,330uS Distance ” 56.2”

Pulse Width = 850uS

Leading Edge Calculation

X2 = (A2 –– C2 + X12)/ 2X1

Xo = X1/2 – X2

Yo = sqrt (C2 – X22)

X & Y Calculations

X2 = ( 56.22 – 57.52 + 122 ) / ( 2 * 12) = 1.2

X0 = 6.0 – 1.2 = 4.8”

Y0 = sqrt ( 56.22 – 1.22 ) = 56.1”

Xo = 4.8”

Y0 = 56.1”

Far Edge Calculation from Pulse Width

Right Pulse Width > Left Pulse Width, use Right Pulse Width

Pw = (( PW / 148 ) * ( Ed * K )

Pw = (( 850us / 148 ) = 5.7”

Edf = Ed + Pw

Edf = 57.5 + 5.7 = 63.2”

OS = √ ( Edf2 – Ed2 )

OS = √ (63.22 – 57.52) = 26.3”

Xe = Xs – OS

Xe = -6.1” – 26.3” = -32.4”

Object Size = 26.3”

Far Edge X = -32.4” (estimate)

The pulse width of the returned echo is 850uS which corresponds to an object size of about 26”. If this is the width of the object its far edge X coordinate would be 32.4”. However, this is out of the sonar’s range at a Y distance of 56.2”, therefore this large pulse width must be due to the height of the object and may not be an indication of its width. All we can say is this is an indication of the objects size.