The vector sum (Rs) = Rsx + Rsy = (R1x + R2x R3x) +
(R1y + R2y) and the bearing angle is the arctan of Rsy/Rsx.
Obviously, these calculations will only work if the samples
have a reasonable amplitude and there is some difference
between channels. Otherwise, the results will be noisy.
Consider the following example:
h1 = 150 h2 = 120 h3 = 90
R1x = 75 R2x = 60 R3x = -90 Rsx = 45
R1y = 130 R2y = -104 R3y = 0 Rsy = 26
arctan(Rsy/Rsy) = arctan(26/45) = arctan(0.577) = 30°
This theory is all very nice, but there are a lot of
practical problems with trying to replicate the human ability
to localize sound. Several problems affect both phase and
amplitude processing. Of course, noise is always a problem
in signal processing, and noise can come from many sources.
There is noise from sources you don’t want to localize.
There is noise from vibrations (such as robot motion) that
affects all three microphones simultaneously. There are
echoes from nearby walls, interior corners, and ceilings;
echoes can be thought of as acoustic multipath.
The ROBOEAR microphones are laid out in a horizontal
plane and the theory assumes a sound source in the same
plane. If the sound comes from more than 45° above or
below the microphones, the accuracy drops off rapidly.
Doing cross-correlation on an eight-bit microcontroller
has its own set of problems. The most obvious is memory
limitations. I originally thought I could work around that
by using a zero-crossing detector (a one-bit ADC; analog-to-digital converter) and doing all the multiplies needed to
compute cross-correlation functions as exclusive-ORs.
Theoretically, it should work (I have the simulations
to prove it!), but analog noise, differences in op-amp and
comparator input offset voltages, and comparator response
time necessitated such a high sampling rate that I was still
The ROBOEAR processes eight-bit ADC data sampled
at 20 kHz. The packed raw data uses 508 bytes of RAM.
The 127 unpacked data bytes from each channel are
stored in three 128-byte buffers. That uses 892 bytes of the
PIC16F1847’s 1,024 bytes of RAM, leaving only 132 bytes
for variables and 24-bit math registers.
For amplitude difference processing, the major problem
is that there usually isn’t much amplitude difference
between the channels. Sound pressure
drops off with the square of distance. This
means the sound source must be close to
the ROBOEAR microphones in order for there
to be an appreciable difference in sound
pressure over the few centimeters between
Photo 1 shows the ROBOEAR circuit
board and Schematic 1 shows the power
supply circuitry. The ROBOEAR circuit board
is set up for an external 9 VDC power supply.
All ROBOEAR circuitry runs on +5V, which is
provided by a 78M05 regulator. A heatsink
is not really needed as the ROBOEAR draws
less than 100 mA. A TLE2426 rail-splitter in
a TO-92 package provides a 2. 5 VDC virtual
ground for the single supply op-amps used in
the analog circuitry.
Photo 1. The assembled ROBOEAR-1 circuit
Figure 3. The geometric relationships used to calculate the
44 SERVO 09/10.2018