I started a few days ago, with microelectronics, and esp´s.
I am able to program in vb.net, but Yaml is always a bit hard, especially with the intentions and so on ^^^
I try now already 2 days, to get the INMP441-Microphone to work, but I just get it kinda working as DB-Meter
with this config:
esphome:
name: esp32-02
friendly_name: esp32_02
esp32:
board: esp32dev
framework:
type: arduino
external_components:
- source: github://stas-sl/esphome-sound-level-meter
# Enable logging
logger:
level: DEBUG
logs:
i2s: DEBUG
microphone: DEBUG
sound_level_meter: DEBUG
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxx"
ota:
platform: esphome
password: "xxxxxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
ap:
ssid: "Esp32-02 Fallback Hotspot"
password: "eVv4rVmMxxfi"
captive_portal:
###########################################################
# INMP441 I²S-MEMS-Mikrofon (Arduino-Framework)
#
# SD → GPIO32
# WS → GPIO15
# SCK → GPIO14
# VDD → 3V3
# GND → GND
###########################################################
i2s:
bck_pin: GPIO14 # Serial Clock (SCK)
ws_pin: GPIO15 # Word Select (WS)
din_pin: GPIO32 # Serial Data (SD)
sample_rate: 48000 # 48 kHz
bits_per_sample: 32 # 32 Bit (MIC liefert 24 Bit + 8 Bit Padding)
bits_shift: 8 # Rechts‐Shift um 8 Bit für 24→32 Bit Alignment
use_apll: true # Optional: präziserer Takt
###########################################################
# Sound Level Meter (External Component)
###########################################################
sound_level_meter:
id: sound_level_meter1
update_interval: 1s
buffer_size: 1024
warmup_interval: 500ms
mic_sensitivity: -26dB
mic_sensitivity_ref: 94dB
offset: 0dB
groups:
- sensors:
- type: eq
name: "Leq_1s"
###########################################################
# Schalter zum Ein/Abschalten des Sound-Meters
###########################################################
switch:
- platform: template
name: "Decibel Meter ON/OFF"
lambda: |-
return id(sound_level_meter1).is_on();
turn_on_action:
- sound_level_meter.turn_on: sound_level_meter1
turn_off_action:
- sound_level_meter.turn_off: sound_level_meter1
restore_mode: RESTORE_DEFAULT_ON
- platform: restart
name: "Decibel Meter Reset"
###########################################################
# System-Sensoren
###########################################################
sensor:
- platform: wifi_signal
name: "WiFi ESP32"
update_interval: 60s
binary_sensor:
- platform: status
name: "ESP32 Status"
I tried now everthing i can imagine. I tried different GPT-Models for help, i googled like a maniac but i cant get this thing to work.
As soon as i want to use this mic, to stream audio to my HA, i always seem to have to change:
from, i2s to i2s_Audio, preferable in the esp-ide.
But i cant get any signal even no mention of i2S_audio even initializing or so…
My current theory is that i don’t set the values correct, the mic delivers 24 bit audio + 8 bit padding.
I think that every version of an i2S_Audio Microphone was doomed cause i dont find anything how to set this bitshift in I2S Audio.
Does someone has this mic running for them and can give me some hints or ideas ?
Edit:
this is my current try with i2s_audio:
esphome:
name: esp32-02
friendly_name: esp32_02
esp32:
board: esp32dev
framework:
type: esp-idf
version: recommended
external_components:
- source: github://stas-sl/esphome-sound-level-meter
# Enable logging
logger:
level: DEBUG
logs:
i2s_audio: DEBUG
microphone: DEBUG
# Enable Home Assistant API
api:
encryption:
key: "2FaGoZVe8OwVAjwv3X4n0f9WXPgonBMN8qCCdFGbqSU="
ota:
platform: esphome
password: "b2dfc90bd3b3dba1075d977caf95d0c5"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
ap:
ssid: "Esp32-02 Fallback Hotspot"
password: "eVv4rVmMxxfi"
captive_portal:
i2s_audio:
- i2s_lrclk_pin: GPIO14
i2s_bclk_pin: GPIO15
id: i2s_Audio_1
microphone:
- platform: i2s_audio
i2s_audio_id: i2s_Audio_1
id: microphone_in
i2s_din_pin: GPIO32
adc_type: external
channel: left
pdm: false
bits_per_sample: 32bit
bits_per_channel: 24bit
sample_rate: 16000
use_apll: True
voice_assistant:
microphone: microphone_in
on_start:
- logger.log: voice_start
on_tts_start:
- logger.log: tts_start
on_tts_end:
- logger.log: tts_end
on_end:
- logger.log: voice_end
- delay: 1s
on_error:
- logger.log: voice_error
###########################################################
# System-Sensoren
###########################################################
sensor:
- platform: wifi_signal
name: "WiFi ESP32"
update_interval: 60s
binary_sensor:
- platform: status
name: "ESP32 Status"