I get a crackling sound when turning on the ‘Use wake word’ switch.
Maybe related: it’s not exposed as a mediaplayer.
I have no clue if this is a HW issue or code?
Based on https://www.youtube.com/watch?v=zhlIaBG3Ldo I used a broken BT speaker, I removed the components and used:
- Lolin C3 mini
- DFRobot MAX98357 I2S Amp
- INMP441 MEMS Mic I2S
The parts are not exactly the same as in the video, I had the ESP already from a previous project and MIC/AMP were the easiest to get.
This is the connection diagram info:
AMP | MIC | ESP | |
---|---|---|---|
Yellow | BCLK | SCK | 6 |
Blue | LRC | WS | 7 |
Grey | DIN | 5 | |
Black | GND | GND | GND |
Red | VCC | 5V | |
Red | VDD | 3V3 | |
Green | SD | 3 |
ESP code
esphome:
name: speaker
friendly_name: speaker
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: esp32-c3-devkitm-1
framework:
type: esp-idf
version: recommended
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "redacted"
ota:
- platform: esphome
password: "redacted"
wifi:
networks:
- ssid: air2
password: !secret wifi_password
- ssid: air
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Speaker Fallback Hotspot"
password: "redacted"
captive_portal:
# Text sensors with general information.
text_sensor:
# # Expose ESPHome version as sensor.
# - platform: version
# name: ESPHome Version
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: IP
ssid:
name: SSID
bssid:
name: BSSID
# Sensors with general information.
sensor:
# Uptime sensor.
- platform: uptime
name: Uptime
# WiFi Signal sensor.
- platform: wifi_signal
name: WiFi Signal
update_interval: 60s
i2s_audio:
i2s_lrclk_pin: GPIO7
i2s_bclk_pin: GPIO6
microphone:
- platform: i2s_audio
id: mic
adc_type: external
i2s_din_pin: GPIO3
pdm: false
speaker:
- platform: i2s_audio
id: big_speaker
dac_type: external
i2s_dout_pin: GPIO5
# mode: mono
voice_assistant:
microphone: mic
use_wake_word: false
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 2.0
speaker: big_speaker
id: assist
switch:
- platform: template
name: Use 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);
I have triple checked the connections to be right which are based on the example of Lewis.
Flashed with ESPhome builder 2025.3.3