I2S digital sound modules utilize the industry-standard 24-bit I²S interface. The I²S interface allows to connect them directly to an ESP32 (but NOT an ESP8266). The INMP441, and also the recently tested ICS-43434 (thanks to Serg74) work very well with SR WLED, and they perform much better than any analog device at a comparable price.
from INMP441, ICS-43434
from PDM (e.g. SPM1423)
from Other
to ESP32 GPIO
L/R
SEL
SEL
Gnd
ground => left channel. Don't leave this pin unconnected!
SD
DATA
DOUT
32
serial data
WS
CLK
LRCK
15
left right clock
SCK
--
BCLK
14
serial clock
--
--
MCLK
0
master clock (if needed)
VDD
3V3
VDD
3.3V
power don't use 5V!
GND
GND
GND
Gnd
ground, 0V
ESP32 pins in the table are just examples. In fact any available GPIO can be used for I²S on ESP32.
* SD can be either an in/out pin (gpio < 34) or an input-only pin (gpi >= 34),
* while WS and SCK must be in/out pins (gpio < 34).
use Generic I2S for INMP441, ICS-43434, and other non-PDM devices
use Generic I2S PDM for PDM microphones like SPM1423
use SPH0645 for adafruit SPH0645
use ES7243 for Lyra-T mini, and other board that have the ES7243 chip
use Generic I2S with Mclk only for devices that have an addition pin for 'master clock'
Important: please make sure that your I2S device provides sound input on the LEFT audio channel! For the INMP441 this is achieved by wiring the 'L/R' connection to GND (ground). Only exception is the "ES7243" driver, which is always using the RIGHT audio channel.
Pins
Since 0.12.0, you can change I2S GPIO pins in the Sound Settings interface; on ESP32 any available GPIO can be used for I²S. The 'SD' signal could also be mapped to an input-only (GPI) pin (*), if you are low on GPIO pins. You'll need to reboot when done with pin assignment - don't forget to "save". To reboot, please press 'reset' on your ESP32. Unfortunately a restart by software ("soft reboot") is not always sufficient to activate new driver settings.
Line-in
In addition to I2S microphones, there are solutions available for line-in via I2S. We already have driver support for Boards/Shields with "es7243" chip, and we're investigating "es8388".
Other I2S ADC (analog-to-digital-converter) devices and microphones that have a standard I2S interface may already work with WLED-SR, by using one of the I2S "Generic" drivers (Generic I2S, Generic I2S PDM, or Generic I2S with Mclk). It is important however that sound input comes on the LEFT audio channel. Please keep in mind that this is a spare-time open source project - we do our best to make generic drivers but we cannot test with all available devices.
Notes for older releases of SR WLED (before 0.13.2)
(*) Due to a problem that was fixed very recently, its not possible to use input-only GPI pins in older releases of SR WLED. There will be no warning if you try to do so. This problem is solved in the latest release version of SR WLED.
In old releases, you need to change GPIO pins used by defining I2S_WS, I2S_SD, and I2S_SCK in your PlatformIO config, or by editing the values in audio_reactive.h.
Still having problems?
We do not have these digital microphones running on an ESP8266.
Having problems getting the INMP441 running with WLED? Here's a test sketch (which you can compile with the Arduino IDE): https://pastebin.com/Ua7s7LYF
. If you are still having a problem with that sketch, change the line with ONLY_LEFT to ONLY_RIGHT. If that works, you'll need to go into audio_source.h and change that line.
Initial I2S support by @spedione
Some I2S audio modules and boards
IMNP441
This is the IMNP441; you can find it in many shops including Amazon and Aliexpress. It works very well with SR WLED.
ICS-43434
Here's the first board I've seen with the ICS-43434 at: https://www.tindie.com/products/serg74/digital-i2s-microphone-ics-43434-add-on/
I2S ADC for Line-In
It is recomended to capture audio using a digital input for Line-In rather than the analog solution, see this guide Line-Input
the library from pschatzmann has examples for how to connect an I2S DAC for playing music from Bluetooth on a speaker. The main difference for SR-WLED should be to put the "bluetooth ESP" into "I2S slave" mode (instead of being the "I2S Master"). There is some information on this website: https://www.eevblog.com/forum/microcontrollers/esp32-as-i2s-(audio)-slave
make sure the "I2S slave" device is sending 24bit or 16bit Phillips Standard data format.