Hello everybody,
I need an help to solve this issue.
I am trying to enable voice assistant on an esp32, but everytime I enable the wake word switch I constantly get a static noise (like something is frying) from the speaker.
How can I solve?
This is really annoying because it seems an easy process to complete… where is the mistake?
I have already tried changing the mike as well as the wiring and the esp32 and separate the BCLK/LRCLK for input and output but I always get the same problem.
These are the device I am using:
- esp32 d1 mini form Az Delivery (https://www.amazon.it/dp/B08BTLYSTM?psc=1&ref=ppx_yo2ov_dt_b_product_details)
- Mic INMP441 (https://www.amazon.it/gp/product/B09G9LDQ48/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1)
- Amp MAX98357 3W (https://www.amazon.it/gp/product/B098R61GGG/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1)
- Speaker 8 Ohm 2W (https://www.amazon.it/gp/product/B0BLGPHZHJ/ref=ppx_yo_dt_b_asin_title_o03_s02?ie=UTF8&psc=1)
this is the code I am using:
esphome:
name: zero-test
friendly_name: zero-test
on_boot:
- priority: -100
then:
- wait_until: api.connected
- delay: 1s
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
esp32:
board: wemos_d1_mini32 # esp32dev # nodemcu-32s # az-delivery-devkit-v4 #wemos_d1_mini32 <= I tried all these but none works fine
framework:
type: esp-idf
version: recommended
logger:
api:
encryption:
key: "myBase64api"
ota:
password: "ota_password"
wifi:
ssid: !secret wifi_iot_ssid
password: !secret wifi_iot_password
ap:
ssid: "zero-test-wifi"
password: "IC2-CC-C=3xkJX"
manual_ip:
static_ip: 192.168.207.42
gateway: 192.168.207.254
subnet: 255.255.255.0
dns1: 192.168.207.254
domain: .mydomain.cloud
# captive_portal:
# i2s_audio:
# i2s_lrclk_pin: GPIO19
# i2s_bclk_pin: GPIO23
i2s_audio:
- id: i2s_in
i2s_lrclk_pin: GPIO19 # ws
i2s_bclk_pin: GPIO23 # sck
- id: i2s_out
i2s_lrclk_pin: GPIO22 #
i2s_bclk_pin: GPIO21 #
microphone:
- platform: i2s_audio
id: mic
adc_type: external
i2s_din_pin: GPIO5 #
pdm: false
channel: right
bits_per_sample: 32bit
i2s_audio_id: i2s_in
speaker:
- platform: i2s_audio
id: big_speaker
dac_type: external
i2s_dout_pin: GPIO26 #
mode: mono
i2s_audio_id: i2s_out
voice_assistant:
microphone: mic
use_wake_word: false
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 2.0
speaker: big_speaker
id: assist
on_error:
- if:
condition:
switch.is_on: use_wake_word
then:
- switch.turn_off: use_wake_word
- switch.turn_on: use_wake_word
on_client_connected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_client_disconnected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
binary_sensor:
- platform: status
name: API Connection
id: api_connection
filters:
- delayed_on: 1s
on_press:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
on_release:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
switch:
- platform: template
name: attiva wake word
id: use_wake_word
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
entity_category: config
on_turn_on:
- lambda: id(assist).set_use_wake_word(true);
- if:
condition:
not:
- voice_assistant.is_running
then:
- voice_assistant.start_continuous
on_turn_off:
- voice_assistant.stop
- lambda: id(assist).set_use_wake_word(false);