ESP32 a1s Audio kit for voice assistant

Hi folks

I really want to get started with voice but the atom echos are out of stock

but a do have a couple of esp32 A1-s audio kits I played with as players

They have two built in mics is there a how-to implement these in esphome?

1 Like

Also there is sample code here

I’ve got it working as a media server but can’t get the internal mic anyone know what i2s gpio pin the internal mic is on ?

Found a post saying gpio 35 but voice to text not hearing anything

This it my config any ideas on getting mic working

esphome:

name: esp32-media

friendly_name: esp32 media

esp32:

board: esp32dev

framework:

type: arduino

Enable logging

logger:

Enable Home Assistant API

api:

encryption:

key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

ota:

password: “xxxxxxxxxxxxxxxxxxxxxxxxx”

wifi:

ssid: !secret wifi_ssid

password: !secret wifi_password

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:

ssid: "Esp32-Media Fallback Hotspot"

password: "eAoRUxEpjcxZ"

captive_portal:

i2c:

sda: GPIO33

scl: GPIO32

external_components:

  • source: github://pr#3552

    components: [es8388]

    refresh: 0s

es8388:

media_player:

  • platform: i2s_audio

    name: “ESP32 Audio Kit”

    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

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:

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

Please post your yaml as yaml, not as markup.

Use three backticks ``` before and after your code, on separate lines. That way you will maintain proper formatting.

1 Like

esphome:
  name: esp32-media
  friendly_name: esp32 media

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

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxx"

ota:
  password: "xxxxxxxxxxxxx"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-Media Fallback Hotspot"
    password: "xxxxxxxx"

captive_portal:

i2c:
  sda: GPIO33
  scl: GPIO32
 
external_components:
  - source: github://pr#3552
    components: [es8388]
    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
 
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

Thanks hopefully its readable now, the board works as a media player when I press to talk can see the voice assistant start but it nothing appears to be heard and if I try more then once get white noise on the speakers

this is the type of board im using but did not buy from this seller

https://www.aliexpress.com/item/1005005368093317.html?spm=a2g0o.productlist.main.3.614f67b5XVARuf&algo_pvid=bb3f6c66-435f-4069-b423-d3bc96a909f9&aem_p4p_detail=202305090644149109631710612800000688722&algo_exp_id=bb3f6c66-435f-4069-b423-d3bc96a909f9-1&pdp_npi=3%40dis!GBP!15.72!13.36!!!!!%402100bbf516836398544076152d0745!12000032764208224!sea!UK!0&curPageLogUid=3AwvG6HwKRNT&ad_pvid=202305090644149109631710612800000688722_2&ad_pvid=202305090644149109631710612800000688722_2

Figure 7 of the ESP32-A1S datasheet shows the ES_I2S_DSDIN signal connected to GPIO26 This is the same pin as the media_player pin, might be bidirectional or just rx/tx convention? Maybe try with both set to 26 or just the microphone to see if you can get it working separately.

There is also a signal marked ES_I2S_ADSDOUT connected to the ES8388. This connects to physical pin #11, which looks to be GPIO35 which would agree with reference to prior post.

If you look at the PR3552 code and discussion, there are some i2c commands sent to the ES8388 chip for configuration during setup. This might just setup the DAC and not the MIC. Adding some i2c to get the mic configured to what esphome expects might be necessary.

Thanks for the input I tried GPIO 26 and this didn’t make any difference so put it back to 35, think you are correct that something additional is needed to bring the mics online I saw that the folks with ESPMuse lux were having a similar issue tried their solution but didn’t help latest code below


esphome:
  name: esp32-media
  friendly_name: esp32 media

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

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  password: "xxxx"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-Media Fallback Hotspot"
    password: "xxxxx"

captive_portal:

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: GPIO35
    dac_type: external
    mode: stereo

i2s_audio:
  i2s_lrclk_pin: GPIO25
  i2s_bclk_pin: GPIO27

microphone:
  - platform: i2s_audio
    i2s_din_pin: GPIO26
    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

Wish I had somthing constructive to add but I’m stuck at this point as well.

Everything working except microphones.

Board:
JESSINIE ESP32 Audio Kit ESP32 WiFi Bluetooth Module ESP32-A1S Module Audio Development Board BLE Low Power Dual-core 64Mb Serial Adapter Port to WiFi Board

ESP32 Audio Kit V2.2 A221

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 !

1 Like

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