Im experimenting with ESP32 and integration as sound detection
I have INMP441 mic and ESP32 dev board.
I connected HA esphome the the dev board successfully.
At first i want to create something simple with the mic - detect any sound on mic and report it in HA dashboard as binary switch/sensor (i.e. sound/no-sound) - can anyone share an example?
Tried to look in web didn’t find such simple example, all are focused on HA voice assistance activation which im not interested for now
Laster on my end project would need to detect a specific beep sound frequency, using some kind of FIR filter, i have seen standalone ESP32 projects but w/o HA integration on this - I wonder if anyone have done something like that
im trying first the minimal config mentioned there:
configs/minimal-example-config.yaml
but after it flushes, the esp32 web server is not responding (my guess stuck in something but dont knoe how to debug this)
here is my esphome yaml
substitutions:
name: esphome-web-16ae04
friendly_name: ESPHome Web 16ae04
esphome:
name: ${name}
friendly_name: ${friendly_name}
name_add_mac_suffix: false
project:
name: esphome.web
version: '1.0'
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# level: DEBUG
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
# Set up a wifi access point
ap: {}
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
import_full_config: true
# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
authorizer: none
# To have a "next url" for improv serial
web_server:
external_components:
- source: github://stas-sl/esphome-sound-level-meter
i2s:
bck_pin: 25
ws_pin: 26
din_pin: 33
sample_rate: 48000 # default: 48000
bits_per_sample: 32 # default: 32
# right shift samples.
# for example if mic has 24 bit resolution, and i2s configured as 32 bits,
# then audio data will be aligned left (MSB) and LSB will be padded with
# zeros, so you might want to shift them right by 8 bits
bits_shift: 8 # default: 0
sound_level_meter:
# update_interval specifies over which interval to aggregate audio data
# you can specify default update_interval on top level, but you can also
# override it further by specifying it on sensor level
update_interval: 1s # default: 60s
# buffer_size is in samples (not bytes), so for float data type
# number of bytes will be buffer_size * 4
buffer_size: 1024 # default: 1024
# see your mic datasheet to find sensitivity and reference SPL.
# those are used to convert dB FS to db SPL
mic_sensitivity: -26dB # default: empty
mic_sensitivity_ref: 94dB # default: empty
# for flexibility sensors are organized hierarchically into groups.
# each group can have any number of filters, sensors and nested groups.
# for examples if there is a top level group A with filter A and nested
# group B with filter B, then for sensors inside group B filters A
# and then B will be applied:
# groups:
# # group A
# - filters:
# - filter A
# groups:
# # group B
# - filters:
# - filter B
# sensors:
# - sensor X
groups:
- sensors:
- type: eq
name: Leq_1s