https://github.com/bertrik/espmicserver
Records audio on an ESP8266 from an I2S microphone and serves it as WAV data over a TCP stream
https://github.com/bertrik/espmicserver
esp8266 i2s i2s-microphone
Last synced: 12 days ago
JSON representation
Records audio on an ESP8266 from an I2S microphone and serves it as WAV data over a TCP stream
- Host: GitHub
- URL: https://github.com/bertrik/espmicserver
- Owner: bertrik
- License: mit
- Created: 2025-04-19T20:52:30.000Z (30 days ago)
- Default Branch: master
- Last Pushed: 2025-04-22T18:11:26.000Z (27 days ago)
- Last Synced: 2025-05-07T21:07:02.530Z (12 days ago)
- Topics: esp8266, i2s, i2s-microphone
- Language: C++
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EspMicServer
Records audio on an ESP8266 from an I2S microphone and makes it available as a network stream## Hardware
The hardware consists of the following:
* wemos d1 mini board, containing an ESP8266
* INMP441 microphone, connected with dupont wireConnections are as follows:
| Wemos | INMP441 | Remark |
| ----- | ------- |- |
| D5 | WS | Sample clock |
| D6 | SD | Data-out from the mic |
| D7 | SCK | High speed bit clock|
| D8 | L/R | Tells mic which I2S channel to use |
| GND | GND | Ground |
| 3V3 | VDD | Power supply |## Software
### ESP8266 firmware
The firmware uses platformio.It initialises the microphone for 16000 Hz sample rate.
Pin D8 sets the I2S channel (left/right) that the microphone publishes data on.The firmware opens a TCP port that external applications can connect to. Connecting to it causes an initial WAV header to be sent with audio format information, followed by continuous mono 16-bit signed samples from the microphone.
Build it using visual code + platformio plugin, or from the command line:
One-time initialisation to install platformio:
```bash
python3 -m venv .venv
source .venv/bin/activate
pip3 install platformio
```Reinitialise the python virtual environment later when working on the code again:
```bash
source .venv/bin/activate
```Compile/upload the code and monitor serial output:
```bash
pio run -t upload
pio device monitor
```### Host-side audio receiver
There are several options.One is to use `ffplay` from the ffmpeg package:
```
ffplay tcp://espmicserver.local:1234
```Another is to use `sox` in combination with netcat `nc`:
```
nc espmicserver.local 1234 |play -t wav -
```