ESP32 a1s Audio kit for voice assistant

can you share the code you used?

its posted in this thread see post 10

esphome:
  name: esp32-audio-kit

esp32:
  board: esp-wrover-kit
  framework:
    type: arduino

logger:

api:
  encryption:
    key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:
  password: "xxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  ap:
    ssid: "esp32-audio-kit Fallback Hotspot"
    password: "xxxxxxxxxxxxxxxxxxxx"

captive_portal:

web_server:
  port: 80

i2c:
  sda: GPIO33
  scl: GPIO32
 
external_components:
  - source: github://pr#3552
    components: [es8388]
    refresh: 0s

  - source: github://pr#4775
    components: [adc, i2s_audio, microphone]
    refresh: 0s
 
es8388:
media_player:
  - platform: i2s_audio
    name: "ESPAudioKit"
    id: AudioKit
    i2s_dout_pin: GPIO26
    dac_type: external
    mode: stereo

i2s_audio:
  i2s_lrclk_pin: GPIO25
  i2s_bclk_pin: GPIO27

microphone:
  - platform: i2s_audio
    i2s_din_pin: GPIO35
    id: mic1
    adc_type: external
    pdm: false

switch:
  - platform: gpio
    pin: GPIO21
    name: "AMP Switch"
    restore_mode: ALWAYS_ON

voice_assistant:
  microphone: mic1
    
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: true
      mode:
        input: true
    name: "Jack Status"

  - platform: gpio
    pin:
      number: GPIO036
      inverted: true
    name: "Key 1"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO013
      inverted: true
    name: "Key 2"
    filters:
      - delayed_off: 10ms

  - platform: gpio
    pin:
      number: GPIO019
      inverted: true
    name: "Key 3"
    filters:
      - delayed_off: 10ms
      
  - platform: gpio
    pin:
      number: GPIO023
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 4"
    filters:
      - delayed_off: 10ms
      
  - platform: gpio
    pin:
      number: GPIO018
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 5"
    filters:
      - delayed_off: 10ms
      
  - platform: gpio
    pin: 
      number: GPIO005
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Key 6"
    filters:
     - delayed_off: 10ms

    on_press:
      - voice_assistant.start:
    on_release:
      - voice_assistant.stop:
    on_click:
      - media_player.toggle: AudioKit  

light:
  - platform: binary
    name: "Test LED 1"
    output: light_output_1
  - platform: binary
    name: "Test LED 2"
    output: light_output_2
 
output:
  - id: light_output_1
    platform: gpio
    pin: GPIO22
    inverted: true
  - id: light_output_2
    platform: gpio
    pin: GPIO19
    inverted: true
1 Like

Any luck getting the ESP audio kit working?

1 Like

Everything but the microphone.

Hi, I got the ESP32-A1S audio kit microphone working, but it is not straightforward … this is still under development in the es8388 driver support:
https://github.com/esphome/esphome/pull/3552#issuecomment-1556031035
Please report your boards configurations to check how many of you have capacitors placed in the wrong positions !

I just received your exact same board (ESP32 Audio Kit V2.2 A247) and the capacitors are in the lowest position and the second from last positions are empty. So I will move them tomorrow night and test out the code. Thanks for the work.

Same here. I got one move okay but then tweezers flicked the other across the room. Looks like they were 140nF 0402 package.

1 Like

my dog ate my electronics?

1 Like

I’ll need to take your advice and buy the spare upfront

I put the @Night.Dav3 patches from the PR3552 discussion in a repository if anyone wants to test them out. Change the external_components section from above yaml as shown below.

external_components:
  - source: github://mulcmu/esphome-es8388-a1s@nightdav-patch
    components: [es8388]
    refresh: 0s

  #### Not needed if on 2023.5.0 or later
  # - source: github://pr#4775
  #   components: [adc, i2s_audio, microphone]
  #   refresh: 0s
1 Like

Moving the caps looks easy enough do you need to also update the register too or is that in the new patch ?

The external component I posted above now has the setup changes recommended by @Night.Dav3 up through this post. So the register changes to get mics working and now enable automatic gain correction for improved voice detection.

It compiles fine for me but I haven’t tested as I messed up while moving one of the capacitors.

You have to modify the caps and use the new code to have it working.

@mulcmu : voice assistant uses the right mic in mono mode, so if you do the mod on the right mic only it might work…

1 Like

I can’t find anywhere what the size of the JST connectors are for connecting the speakers.
Can anyone provide information?
Thank you

Jst-xh 2.54mm

1 Like

Thanks for your hard work and assi6 have it working now after moving the caps and using the new code

I have the same v2.2 A247 board.
I will move the capacitors to the correct positions.
I would just like to know what is the distance from the microphone so that the assist recognizes the voice command correctly?

I had the beard at arms length on the desk and it could still function

if got everything working but i wanted to connect a screen to the i2c buss what io pins are these where on the board has to be scl sda ?