-
Notifications
You must be signed in to change notification settings - Fork 131
Digital Microphone Hookup
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).
See also ⇒ Sound setting examples for common microphones
Microphone type (SR-WLED sound settings)
- 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.
Since 0.12.0, you can change I2S GPIO pins in the Sound Settings interface; on ESP32 any available GPIO (in-out pin) 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.
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.
-
(*) 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
, andI2S_SCK
in your PlatformIO config, or by editing the values in audio_reactive.h.
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
This is the INMP441; you can find it in many shops including Amazon and Aliexpress. It works very well with SR WLED.
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/
Looking to add line-in with I2S support? You might want to try I2S ADC boards that use one of these chips:
Many I2S ADC boards expect an additional MCLK signal ("Main Clock" aka "System Clock" aka "Master Clock" aka "Memory Clock"). MCLK is sometimes labelled SCLK for "system clock". For these boards with 4 data pins, use our Generic I2S with MCLK
input driver, and connect MCLK pin to GPIO pin 0, 1, or 3 on ESP32.
with I2S on-board microphone and I2S Line-In (SR WLED support not available yet, but being developed)
In principle, its possible to have a second ESP32 that provides sound input to WLED via I2S.
- some interesting explanations on the I2S bus: https://diyi0t.com/i2s-sound-tutorial-for-esp32
-
pschatzmann has created A Simple Arduino Bluetooth Music Receiver and Sender for the ESP32
-
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.
Introduction
Installing and Compiling
First Time Setup
Running Sound Reactive WLED
2D Support
Sound Settings
2D LED Preferences
ARTI-FX
UDP Sound Sync
Sound Reactive Animations
Non-Reactive Animations
Digital Microphone Hookup
Analog Audio Input Options
Using my PC for the Sound
News
It's Not Working
Noise and Spikes
Connectivity Issues
WLED Programming Notes
Modifying Sound Reactive WLED
Future Directions
Adding a new Settings Page
On Lossy Colours
Sliders in WLED
Testing