Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Sound Radar

A four-microphone ESP32-S3 sound-direction demo that estimates where a sound came from using TDOA and displays the direction on a TFT screen plus a web dashboard.

Chinese · Quickstart · How It Works · Web Dashboard

GitHub repo Platform Arduino Signal License

ESP32 Sound Radar prototype with four microphones and TFT display

Why This Exists

This is a compact sound-localization prototype built with an ESP32-S3, four I2S microphone modules, and a TFT screen. It listens for sharp sound events, filters out low-energy noise, estimates the time difference of arrival between microphone pairs, and turns that into a direction angle.

The project is intentionally simple: one Arduino sketch, one physical prototype, and one browser dashboard for calibration.

Features

  • Four-microphone I2S sampling using two ESP32 I2S peripherals.
  • High-pass filtering, energy thresholding, normalization, and cross-correlation TDOA estimation.
  • Direction sector drawn directly on a TFT screen.
  • ESP32-hosted web dashboard with live waveforms, radar view, TDOA values, and tuning sliders.
  • Runtime tuning for I2S sample offsets, energy threshold, and display sector width.
  • Wi-Fi station mode with fallback access point when no local Wi-Fi is configured.

Hardware

Part Role
ESP32-S3 Main controller, I2S sampling, web server, signal processing
4x I2S microphone modules Sound arrival-time sensing
TFT display with TFT_eSPI Local direction display
Breadboard / wiring Prototype microphone geometry

Wiring Used In This Sketch

Signal group ESP32 pin
MIC1 + MIC2 shared I2S data GPIO 4
MIC1 + MIC2 BCLK GPIO 5
MIC1 + MIC2 WS/LRCLK GPIO 6
MIC3 + MIC4 shared I2S data GPIO 39
MIC3 + MIC4 BCLK GPIO 37
MIC3 + MIC4 WS/LRCLK GPIO 38

For each I2S microphone pair, set the two microphone modules to opposite left/right channel selections so the shared data line carries a stereo pair. Configure the TFT pins in your local TFT_eSPI setup file.

Quickstart

  1. Install the ESP32 board package in Arduino IDE.
  2. Install these libraries:
    • ESPAsyncWebServer
    • AsyncTCP
    • ArduinoJson
    • TFT_eSPI
  3. Open src/esp32_sound_radar/esp32_sound_radar.ino.
  4. Select an ESP32-S3 board and upload the sketch.
  5. Open Serial Monitor at 115200 baud.
  6. Connect to the printed dashboard address.

If WIFI_SSID is left as YOUR_WIFI_SSID, the ESP32 starts a fallback access point:

SSID: ESP32-Sound-Radar
Password: soundradar
Dashboard: http://192.168.4.1

Web Dashboard

The ESP32 serves a dashboard at / and streams waveform data over /ws.

The dashboard shows:

  • four microphone waveforms
  • TDOA values in microseconds
  • estimated direction angle
  • radar-style direction fan
  • sliders for I2S0/I2S1 offset calibration
  • sliders for noise energy threshold and sector width

How It Works

  1. Two I2S buses read four microphones as two stereo pairs.
  2. The sketch applies configurable sample offsets to align the I2S streams.
  3. A high-pass filter reduces low-frequency drift.
  4. Low-energy frames are ignored using an adjustable threshold.
  5. The remaining frame is normalized so correlation is less sensitive to volume.
  6. Cross-correlation estimates the lag between microphone signals.
  7. Averaged horizontal/vertical lag estimates are converted into an angle with atan2.
  8. The direction is drawn on the TFT display and streamed to the browser.

This is an experimental prototype, not a calibrated measurement instrument. Microphone spacing, orientation, room reflections, and module timing differences all affect accuracy.

Project Layout

src/esp32_sound_radar/esp32_sound_radar.ino
  Main Arduino sketch with sampling, filtering, TDOA, TFT drawing, and web UI.

.github/assets/sound-radar-build.jpg
  Photo of the physical prototype used in the README.

Notes

  • Do not commit real Wi-Fi credentials. The public sketch uses placeholders and AP fallback.
  • For better direction accuracy, keep microphone positions symmetric and mechanically stable.
  • The dashboard uses Chart.js from a CDN, so waveform charts need internet access in the browser.

License

MIT License. Commercial use, modification, distribution, and private use are allowed.

About

ESP32-S3 four-microphone sound radar using I2S, TDOA, TFT direction display, and a web tuning dashboard.

Topics

Resources

Stars

19 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages