lag values for each baseline.
a. Find the maximum cross-correlation value and
matching lag value for each baseline.
b. Look up the bearing angle for the three lag values.
8. Signal the host data is ready.
The processing power required for all this is a severe
challenge for an eight-bit microcontroller. For example,
calculating the cross-correlation values involves three
baselines, 13 lags per baseline (- 6 to + 6), and 115 points per
lag (the fully overlapped portion of each channel’s 127 data
points). That means it takes 4,485 eight-bit multiplications
and 24-bit additions just to do the cross-correlation. Despite
the processing demand, if the amplitudes
are okay in step 4, the ROBOEAR can repeat
the process at least four times a second.
Cross-correlation works best with
long time series; this produces very high
and narrow peaks when the time series
line up. One of the consequences of the
limited memory available is the relatively
short (127 samples) time series from the
three channels. Because of these short
time series, the cross-correlation functions
produce broad peaks.
Figure 5 is a real example from the
ROBOEAR. Because the peaks are so flat,
the position of the maximum can easily shift
±1 lag from one data set to the next, solely
due to noise. This limits the accuracy of the
computed bearings from each baseline. So,
even though the ROBOEAR could compute
bearings with a lot of precision, they would
not be very accurate. Therefore, I decided
to have the ROBOEAR report bearings as
Using sectors simplifies the process of
reducing the cross-correlation ambiguities
to a single solution. In fact, the only thing
we need to know is if the maximum cross-correlation occurred at a positive lag, zero,
or a negative lag. Figure 6 shows how this works.
For example, consider a source at 90°. The
maximum cross-correlation for any source between 0°
and 180° should be found at a positive lag for baseline
1-2 (color coded red). For baseline 2-3 (green), the
maximum cross-correlation should be at a negative lag;
the same is true for baseline 3-1 (blue). Thus, if the order
of the signs of the lags for the three baselines is (+, -, -),
then the bearing is in the sector centered at 90°.
So, what happens if maximum cross-correlation
for one of the baselines has a lag of zero? A lag of
zero means the source is on a line perpendicular to the
baseline. For the example above, if the lag for baseline
3-1 was zero, then the order would be (+,-,0) and the
solution would be the sector centered at 120°.
There are 12 30° wide sectors; each one is identified
by a unique sequence. However, there are more than 12
possible sequences. Suppose the lag sequence was (+,+,+).
The source would need to be on the left side of all three
baselines — an impossible situation. This kind of situation
can happen in the presence of noise and echoes.
When a unique solution is impossible, the bearing
angle is returned as 0xFF in BAM or its equivalent decimal
value of 358.
The performance of the ROBOEAR in a real world
situation depends on so many external factors, it’s
impossible to predict. I ran a series of indoor tests using
a radio at a distance of 1.5 meters as the sound source.
Because of the way the amplitude bearing is calculated, it
will always yield a solution.
Qty Part Reference
8 0.1 µFd, 0.1” LS C1, C3, C4, C5, C13, C23, C33, C44
1 100 µFd, axial C2
1 100 nFd, 0.2” LS C6
10 1.0 µFd, 0.2” LS C10, C11, C20, C21, C30, C31, C40-C43
3 0.001 µFd, 0.2” LS C12, C22, C32
3 2.2K, 1/8W, 5% R10, R20, R30 (red-red-red-gold)
6 10K, 1/8W, 5% R11, R12, R21, R22, R31, R32 (brown-black-orange-gold)
3 1M, 1/8W, 5% R13, R23, R33 (brown-black-green-gold)
3 3.3K, 1/8W, 5% R14, R24, R34 (orange-orange-red-gold)
3 33K, 1/8W, 5% R15, R25, R35 (orange-orange-orange-gold)
2 1.1K, 1/8W, 5% R40, R41 (brown-brown-red-gold)
1 10K, 10-pin SIP RN1
1 PIC16F1847 U1
1 TLE2426CLP U2
1 LM78M05 U3
3 MCP602 U10, U20, U30
3 MCP3001 U11, U21, U31
1 MAX232ACPE U40
1 18-DIP socket U1
1 16-DIP socket U40
6 8-DIP socket U10, U11, U20, U21, U30, U31
1 DC power jack J1
1 DB9 female connector J2
6 2-pin header J3, J4, J6, J10, J20, J30
1 4-pin header, 2x2 J5
1 6-pin header, 1x6 J7
1 8-pin header, 2x4 J8
1 ROBOEAR-1 circuit board
4 Self-tapping screws for mounting the printed circuit board in a plastic case
3 Electret microphones
Figure 5. An example of cross-correlation values versus lag for the
three microphone baselines.
48 SERVO 09/10.2018