Professional-grade I2S audio streaming system for ESP32 with comprehensive reliability features.
This project now uses 3 consolidated documentation files:
- README.md (this file) - Quick Start & Overview
- DEVELOPMENT.md - Complete Technical Reference
- TROUBLESHOOTING.md - Diagnostics & Solutions
- Hardware: ESP32-DevKit or Seeed XIAO ESP32-S3
- Microphone: INMP441 I2S digital microphone
- Tools: PlatformIO IDE or CLI
- Server: TCP server listening on port 9000
ESP32-DevKit:
INMP441 Pin β ESP32 Pin
CLK β GPIO 14
WS β GPIO 15
SD β GPIO 32
GND β GND
VCC β 3V3
Seeed XIAO ESP32-S3:
INMP441 Pin β XIAO Pin
CLK β GPIO 2
WS β GPIO 3
SD β GPIO 9
GND β GND
VCC β 3V3
-
Clone the project
git clone <repo> cd arduino-esp32
-
Edit
src/config.hwith your settings:// WiFi #define WIFI_SSID "YourNetwork" #define WIFI_PASSWORD "YourPassword" // Server #define SERVER_HOST "192.168.1.50" // Your server IP #define SERVER_PORT 9000 // TCP port
-
Upload firmware
pio run --target upload --upload-port COM8
-
Monitor serial output
pio device monitor --port COM8 --baud 115200
[INFO] ESP32 Audio Streamer Starting Up
[INFO] WiFi connected - IP: 192.168.1.19
[INFO] Attempting to connect to server 192.168.1.50:9000 (attempt 1)...
[INFO] Server connection established
[INFO] Starting audio transmission: first chunk is 19200 bytes
- Sample Rate: 16 kHz
- Bit Depth: 16-bit
- Channels: Mono (1-channel)
- Bitrate: ~256 Kbps (~32 KB/sec)
- Chunk Size: 19200 bytes per TCP write (600ms of audio)
- β WiFi auto-reconnect with exponential backoff
- β TCP connection state machine
- β Transient vs permanent error classification
- β Automatic I2S reinitialization on failure
- β Memory leak detection via heap trending
- β Hardware watchdog timer (60 seconds)
- β 8 Serial commands for runtime control
- β Real-time statistics every 5 minutes
- β 6 configurable debug levels
- β System health monitoring
Send serial command: STATS
Response: Current uptime, bytes sent, error counts, memory stats
Send serial command: DEBUG 4
(0=OFF, 1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=VERBOSE)
Send serial command: SIGNAL
Response: Current RSSI in dBm
Send serial command: RECONNECT
Send serial command: HELP
βββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β I2S Audio ββββββββ Adaptive ββββββββ WiFi/TCP β
β Input β β Buffer β β Network β
β (16kHz) β β (adaptive) β β Manager β
βββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β β
INMP441 Server (TCP)
Microphone Port 9000
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β State Machine (main loop) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β INITIALIZING β CONNECTING_WIFI β CONNECTING_SERVER β
β β β
β CONNECTED β (loops) β
β β β
β (error?) β ERROR state β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
HELP - Show all available commands
STATS - Print system statistics (uptime, bytes sent, memory, errors)
STATUS - Print current system state
SIGNAL - Print WiFi RSSI (signal strength) in dBm
DEBUG [0-5] - Set debug level (0=OFF, 5=VERBOSE)
RECONNECT - Force server reconnection
REBOOT - Restart the ESP32
ESP32 won't connect to WiFi?
- Verify WiFi credentials in
config.h - Ensure network is 2.4 GHz (not 5 GHz)
Server connection timeout?
- Check
SERVER_HOSTmatches actual server IP - Verify server is listening:
ss -tuln | grep 9000 - Check firewall allows port 9000
No audio streaming?
- Verify I2S pins match your board
- Check microphone connections
- Send
STATScommand to see error count
For detailed help, see TROUBLESHOOTING.md.
See src/config.h for complete reference:
- WiFi: SSID, password, retry settings
- Server: Host, port, reconnect backoff
- I2S: Sample rate (16kHz), buffer sizes
- Safety: Memory thresholds, watchdog timeout
- Debug: Log level (0-5)
October 21, 2025 - Connection Startup Bug Fix
- Fixed 5-second startup delay before first server connection
- Added
startExpired()method to NonBlockingTimer - Server connections now attempt immediately after WiFi
October 20, 2025 - Protocol Alignment Complete
- TCP socket options verified and aligned
- Data format: 16kHz, 16-bit, mono β
- Chunk size: 19200 bytes β
- Full server/client compatibility β
- Complete Technical Reference β
DEVELOPMENT.md - Troubleshooting & Diagnostics β
TROUBLESHOOTING.md - Source Code β
src/directory
Status: β Production Ready | Last Updated: October 21, 2025 | Version: 2.0