2023-04-12 01:53:24 +02:00
I²S Audio Microphone
====================
.. seo ::
:description: Instructions for setting up I²S based microphones in ESPHome.
:image: i2s_audio.svg
2023-10-27 00:29:59 +02:00
The `` i2s_audio `` microphone platform allows you to receive audio via the the :doc: `/components/i2s_audio` .
This platform only works on ESP32 based chips.
.. warning ::
Audio and voice components consume a significant amount of resources (RAM, CPU) on the device.
2024-01-09 02:07:24 +01:00
2023-10-27 00:29:59 +02:00
**Crashes are likely to occur** if you include too many additional components in your device's
configuration. In particular, Bluetooth/BLE components are known to cause issues when used in
combination with Voice Assistant and/or other audio components.
2023-04-12 01:53:24 +02:00
.. code-block :: yaml
# Example configuration entry
microphone:
- platform: i2s_audio
2023-05-10 06:37:47 +02:00
id: external_mic
adc_type: external
2024-05-07 07:40:12 +02:00
i2s_din_pin: GPIOXX
2023-04-12 01:53:24 +02:00
2023-05-10 06:37:47 +02:00
- platform: i2s_audio
id: adc_mic
adc_type: internal
2024-05-07 07:40:12 +02:00
adc_pin: GPIOXX
2023-05-10 06:37:47 +02:00
2023-04-12 01:53:24 +02:00
Configuration variables:
------------------------
2023-05-10 06:37:47 +02:00
- **adc_type** (**Required** , enum):
- `` external `` : Use an external ADC connected to the I²S bus.
- `` internal `` : Use the internal ADC of the ESP32. Only supported on ESP32, no variant support.
2023-04-12 01:53:24 +02:00
2023-05-22 21:02:20 +02:00
- **channel** (*Optional* , enum): The channel of the microphone. One of `` left `` or `` right `` . Defaults to `` right `` .
2024-01-09 02:07:24 +01:00
- **sample_rate** (*Optional* , positive integer): I2S sample rate. Defaults to `` 16000 `` .
2023-05-26 05:50:47 +02:00
- **bits_per_sample** (*Optional* , enum): The bit depth of the audio samples. Note that while set to `` 32bit `` , the samples
will be scaled down to 16bit before being forwarded.
One of `` 16bit `` or `` 32bit `` . Defaults to `` 16bit `` .
2024-01-09 02:07:24 +01:00
- **use_apll** (*Optional* , boolean): I2S using APLL as main I2S clock, enable it to get accurate clock. Defaults to `` false `` .
2024-07-16 06:28:47 +02:00
- **i2s_mode** (*Optional* , enum): The I²S mode to use. One of `` primary `` or `` secondary `` . Defaults to `` primary `` .
2023-05-08 20:03:36 +02:00
- **i2s_audio_id** (*Optional* , :ref: `config-id` ): The ID of the :ref: `I²S Audio <i2s_audio>` you wish to use for this microphone.
2023-04-12 01:53:24 +02:00
- All other options from :ref: `Microphone <config-microphone>`
2023-05-10 06:37:47 +02:00
External ADC
------------
2023-05-10 06:43:35 +02:00
- **i2s_din_pin** (**Required** , :ref: `Pin Schema <config-pin_schema>` ): The GPIO pin to use for the I²S `` DIN/SDIN `` *(Data In)* signal, also referred to as `` SD/SDATA `` *(Serial Data)* or `` ADCDAT `` *(Analog to Digital Converter Data)* .
2023-05-10 06:37:47 +02:00
- **pdm** (**Required** , boolean): Set this to `` true `` if your external ADC uses PDM (Pulse Density Modulation) instead of I²S.
.. note ::
PDM microphones are only supported on ESP32 and ESP32-S3.
Internal ADC
------------
.. note ::
Internal ADC microphones are only supported on a regular ESP32, not the variants.
- **adc_pin** (**Required** , :ref: `Pin Schema <config-pin_schema>` ): The GPIO pin to use for the ADC input.
Known Devices
-------------
M5Stack Atom Echo
***** ***** ***** **
.. code-block :: yaml
microphone:
- platform: i2s_audio
adc_type: external
2024-05-07 07:40:12 +02:00
i2s_din_pin: GPIOXX
2023-05-10 06:37:47 +02:00
pdm: true
RaspiAudio Muse Luxe
***** ***** ***** *****
.. code-block :: yaml
microphone:
- platform: i2s_audio
2024-05-07 07:40:12 +02:00
i2s_din_pin: GPIOXX
2023-05-10 06:37:47 +02:00
adc_type: external
pdm: false
2023-04-12 01:53:24 +02:00
See also
--------
- :doc: `index`
- :ghedit: `Edit`