ESP32-Audio-Kit (ESP32-A1S) with Squeezelite for Notifications

Can you dm me to avoid spamming this thread?

I have the same board and could use some help also… :slight_smile:

Very interested and watching.
What amplifier you use ?

How loud is your ESP32-A1S 2974 ES8388?

I think my DAC is not working. But I dont know why.

Its very loud with the built in amp

See it here: [ESPHome] ESP32-Audio-Kit (ESP32-A1S) - YouTube

1 Like

okay, that show me that it should work generaly, but my problem with my ESP32-A1S 2974 ES8388 is that I want to use it as a squeezebox-client. :frowning:

Any ideas what could be wrong in my config?
Is there something I can do or I need to do?

In the bottom line of my device is this written:
fw: Muse.16.1036.master-cmake, mode: Muse
Is this the right firmware for my ESP32-A1S ES8388?

Here is my setup:
dac_config: model=ES8388,bck=27,ws=25,do=26,sda=33,scl=32,i2c= 16
set_GPIO: 21=amp,22=green:0,39=jack:0
stereo speaker connecth through headphone-jack.

For install I used the https://raspiaudio.github.io/ webinstaller and choose MUSE.

A Muse is a different device with a different audio DAC (https://raspiaudio.com/produit/muse-proto)

Use the I2S firmware as it’s the correct firmware for the ESP32-A1S.

That looks correct.

EDIT:
I flashed one of my ESP32-A1S with that web installer as I have never tried it, and it seems to drop the Muse firmware no matter what you choose for a firmware. This is a problem for ESP32-A1S Audio-Kit’s.

See post #7 in this thread ( https://forums.slimdevices.com/showthread.php?113804-ESP32-A1S-Audio-Kit-V2-2&p=1007039&viewfull=1#post1007039 ) to properly flash your ESP32-A1S

I tried connecting mine to stereo speakers through a jack and the audio was quiet as a whisper. Through the speaker line out, it’s loud. I guess the amp isn’t working on the headphone-jack output.

I was able to get the board working in ESPHome using the configurations posted in this thread. I got keys 4-6 working on mine by enabling internal pull-up resistors for those keys - like this:

  - 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

Watch out for a loud static burst on attached speakers when the board resets after updating through ESPHome. It might be possible to avoid this by only setting the Amp switch on after everything else has booted using on_boot.

1 Like

I forgot to say that my squeezelite-player are now working awesome! I can 100% say that it does not depend on the jacks.

Here is my final setup:
dac_config : model=ES8388,bck=27,ws=25,do=26,sda=33,scl=32,i2c= 16
set_GPIO : 21=amp,22=green:0,39=jack:0
stereo speaker connect through headphone-jack.
To flash I took:
https://raspiaudio.github.io
and I need I2S. This was my main problem :slight_smile:

FYI

1 Like

Nice job.
May I ask what that is for?

  1. it is not a valid URL.
    https://github.com/esphome/esphome.git@pull/3552/head
    404 Not found.

  2. I thought we just give the i2s is enough for ESPHOME to send data to DAC, and DAC will output to the amplifier, what is that external_components for?

And My card is V2.2 A221. On the top of the back of the ESP32, there is a silk print “ESP32-A1S B238”.

Sorry, dup question.

It’s for the ES8388 dac

Thank you. I see.

After several hours of research, I found:

The audio chip is responsible for routing the output or input to the correct final device and controlling the volume. The **ES8388** must be programmed via **I2C**! In order to do this I found [this solution](https://github.com/thaaraak/ESP32-ES8388/) from thaaraak which inspired me to try to convert the [original ADF driver](https://github.com/espressif/esp-adf/tree/master/components/audio_hal/driver/es8388) from Espressif, so that it can be used in Arduino.

If we want to switch between speaker and headphone, we need send i2c command to ES8388,
I am still working on that, learning from the beginning…

I am really thrilled that this thread, which was originally just a question on my part, has turned into a repository on great ways to use this board.

Ironically, I got busy with work right about the same time this thread started blowing up and never got to do anything with my board until today. I followed the instructions in the two posts by @Akriss (#18 and #23) and am loving at all this can do.

One note to add to that tutorial is that you’re not limited to mp3s. I have Google TTS in my config and I have been able to use that for notifications as well.

I was also very interested to see @hareeshmu pure ESPHome solution (#28), as I have been switching my microcontroller devices from Arduino to ESPHome little by little.

My next question is whether there is any chance of using the mics on this board with some of HA’s new voice control stuff? But maybe it’s way too under-powered…

1 Like

Likely you could have a websocket always on broadcast and run a KWS/Beamformer upstream.
Not enough under the hood for KWS on ESP32 really when loaded with Squeezlite. You can just about squeeze in a simple KWS model on a esp32 and very little else.

Its a shame Esspressif or the cloners don’t just do a ADC/DAC board that you can dupont to any ESP32, but maybe with the esp32-s3 due to its vector instructions can approach near x10 speedup over the esp32.

They have the ESP32-S3-Korvo-2 but its bloat loaded and overpriced really as a step up from the ESP32-A1S.
Espressif seem to always do these technology demonstrators / dev kits showing off how much function you can fit on one board, whilst the maker community would likely quickly embrace modular low-cost addons and likely springboard more commercial product that way.

On the S3 they have a full audio pipeline, ML Onnx base and TFlite4Micro and the esp32-s3-box demonstrates and complete KWS to ASR/TTS solution sort of badly as wow they have packed it to the absolute max.
As a broadcast on KWS hit, if you don’t bloat them to the level of the esp32-s3-box you maybe could squeeze in squeezelite aswell, but dunno for sure.

Here was my project that hacks esphome with the Esspressif wake word and speech recognition examples onto a ESP32-S3-Korvo-1. Getting media player working is still a work in progress but there is plenty of flash left. (Smallest app partition is 0x400000 bytes. 0x291770 bytes (64%) free.)

The Esspressif wake word and speech recognition are OK is all I will say when considering its a ESP32-S3, but nothing to write home about from what my ESP32-S3-Box & Box-Lite manage.
Likely jettisoning some function and importing an Onnx KWS via GitHub - espressif/esp-dl: Espressif deep-learning library for AIoT applications or TFLite4Micro GitHub - espressif/esp-tflite-micro: TensorFlow Lite Micro for Espressif Chipsets could produce better results and maybe still squeeze in squeezelite.

42IO managed to get KWS only running on esp32 but doubt it would run with squeezelite also.

PS I should mention that the Espressif documentation gives credit to https://arxiv.org/pdf/1811.07684.pdf which is now implemented in the training framework Googleresearch offer google-research/kws_streaming/experiments/kws_experiments_12_labels.md at master · google-research/google-research · GitHub
Well actually a bc_resnet_1 but that is there aswell the framework covers a huge array of KWS models and at 1st can a bit daunting and confusing but actually is an amazing resource for KWS.

There are some different versions for the ESP32-Audio Kit
How would you do this for the version with AC101 instead of ES8388?

1 Like