2026-11-21

A four-mic ESP32-S3 board that resolves direction to a 2-degree grid, for about 107 RMB of parts

Open HardwareMEMS MicrophoneDirection of ArrivalESP32-S3AudioGCC-PHATPCB DesignSensor Selection
A four-mic ESP32-S3 board that resolves direction to a 2-degree grid, for about 107 RMB of parts

One microphone answers whether there is sound. Knowing where it came from takes at least two, and the distance between them decides how finely you can resolve an angle: a shorter baseline turns the same time difference into a larger angle, and therefore into a larger error. So the first decision in sound-source localisation hardware is not the chip. It is the geometry.

This board, a CERN-OHL-S-2.0 open hardware project published on OSHWHub with full schematic, PCB sources and an ESP-IDF firmware repository, starts from that geometry. Four analogue-output MEMS microphones sit on a circle of 40 mm radius, 90° apart, giving an 80 mm opposite baseline and an orthogonal cross array. The four analogue channels go into an ES7210 four-channel audio ADC sampling at 48 kHz / 16 bit synchronously, come back to the ESP32-S3 over I²S TDM, and the chip runs GCC-PHAT for pairwise time differences followed by SRP-PHAT over a 2° grid from 0° to 360°. Sixteen WS2812 pixels on the board edge, one every 22.5°, point at the answer.

The physics that sets the radius

Localisation rests on time difference of arrival. A wavefront reaches the near microphone first and the far one later, and the path difference divided by the speed of sound is the delay. Two microphones constrain the source to one sheet of a hyperboloid; four give enough constraints for the intersection to be a direction.

The problem is the scale. At 343 m/s across an 80 mm baseline, the maximum delay is 233 µs. At 48 kHz that is 11.2 samples for the entire range. One sample of error translates into

Radius Opposite baseline Max delay Samples at 48 kHz Angle error per sample Spatial aliasing
10 mm 20 mm 58 µs 2.8 20.5° 8.6 kHz
20 mm 40 mm 117 µs 5.6 10.2° 4.3 kHz
40 mm 80 mm 233 µs 11.2 5.1° 2.14 kHz

The table explains two constraints at once. The aperture cannot be small: at a 10 mm radius, one sample of timing error is a 20° direction error, while 40 mm compresses it to 5.1°. And the aperture cannot be arbitrarily large: once the baseline exceeds half a wavelength, the same delay maps to several possible directions — spatial aliasing — with the crossover at c/2d, which is 2.14 kHz for 80 mm. Above that frequency the array cannot tell where a sound came from.

Forty millimetres is the compromise: quantisation error pushed down to the 5° level, aliasing pushed up to 2.14 kHz, which covers the main energy of speech and birdsong. The firmware adds a 1.5–6 kHz band-pass ahead of GCC-PHAT for exactly that band, which also rejects wind noise, table vibration and DC drift. The band-pass does not solve aliasing; the mirror peak does. A symmetric cross array necessarily produces a null at 180°, so the firmware compares the energy of the two peaks, requires five consecutive frames to agree, and only then locks the direction.

Three hardware details worth copying

The microphones run on an analogue rail, not the digital 3.3 V. The ES7210 and the microphone bias come from a TPS7A2033 low-noise LDO, then through a 0 Ω resistor that isolates it into A_3V3; analogue and digital ground meet at exactly one 0 Ω point. The reason is concrete: Wi-Fi transmit current steps, if coupled into the microphone supply, make all four channels wobble at once, and non-synchronous wobble is indistinguishable from a real phase difference.

All four I²S lines carry 22 Ω series resistors. MCLK, SCLK, LRCK and SDOUT1 each get source termination to damp overshoot on the longer traces.

External power goes through current-limited load switches. Two TPS22950s connect 3V3 to 3V3_OUT and VBUS to VBUS_OUT, with the limit programmed by a 1.15 kΩ resistor on ILIM. A miswired external sensor cannot take the controller with it.

The firmware lesson that generalises

The most transferable finding is that the coefficients cannot be moved between sample rates. The first-order IIR weighting used inside the GCC variant is tied to the sampling frequency. Take coefficients tuned at 16 kHz and run them at 48 kHz and the passband drifts to roughly 4.5–18 kHz, leaving only a sliver of usable bandwidth — which presents as usable localisation range dropping by half. It is the kind of bug that looks like a hardware problem.

The same board also carries a second mode: decimate 48 kHz to 16 kHz through a 12th-order FIR anti-aliasing filter, feed a 9.7 KB INT8 quantised model for timbre classification, and run inference entirely on-chip with no network involvement. Switching modes is one macro in main/app_mode.h. Audio that never leaves the device is a feature worth noticing for anyone building presence or event detection.

Cost, and what the accuracy claim means

The board has 172 designators including four M2 screws, and the BOM totals about 107 RMB for components only — no PCB fabrication, enclosure, shipping or tax. The four SPM0687LR5H-1 microphones are 57.80 of that, more than half, at 14.45 each. The ESP32-S3R8 is 11.18, the 16 MB flash 8.77, the ES7210 2.89, the sixteen LEDs 5.40, the two load switches 4.44. Everything else is passives and connectors.

The stated accuracy is ±5–10°, and it comes with an assumption attached: far-field plane waves. Bring the source closer than about 50 cm and the assumption fails — a tap or a finger snap can be off by 30°. That is not a defect in the board, it is what a 80 mm aperture can physically do. It also means the honest way to describe this device is as a direction indicator, not a tracker: sixteen LEDs at 22.5° spacing are a good match for ±5–10° of angular information, and pretending otherwise would be worse engineering than the LEDs are.

← All news