Waveshare-s3-audio-board ESPHome VoiceAssistant

I have been working on getting the speaker and microphone to work together on the i2s_audio bus. thought I would share my progress.

Board:

Code:

In the end I had to modify ES8311 module by adding settings for forcing it to act as i2s master so that I could have two i2s_audio busses sharing access and thereby allowing for music to play at the same time as voice commands are detected and delt with.

The code is messy as I have been trying many paths to get it working. but wanted to share it until all is done.

  • speaker is working
  • mic is working
  • LED animations
  • Progress Sounds
  • buttons are working (vol+/- mute)
  • Music stream
  • camera is working (separated into a yaml package to make the config a bit less confusing)
3 Likes

Very nice - I just purchased one hoping to do the same (I saw it was supported by ESP-IDF) but I’ve only had the chops to get some buttons working.

Awesome work!

a yaml package (to keep the code cleaner) that enables the camera and exposes a bunch of camera control to HA have also been added

This device looks very interesting

I have purchased this hardware can I use as voice assistance in home assistance?
Thanks

Yes

It has mics and speaker.
You can use HAvoice yaml as template and change gpio to match this device. Maybe other changes needed but that’s basically it.

Pretty sure someone will post yaml here once they set it up.

I’m curious to hear from users: are the SoC resources adequate for handling voice functions and camera operation?

Hi, thanks for this configuration, got it working in HA.

This board is driving me crazy. I want to install a Voice AI chat firmware on it. I’ll attach my Audio.h and Audio.c files. I’ve gotten the i2s speaker and microphone working, but the output is completely fragmented. It speaks for about half a second, followed by half a second of noise. Even AI can’t get it to work. I’ve already doubled the buffers, but nothing helps. Maybe it’s related to the master/slave issue?
I pasted the code here:
https://sharetext.io/624b6a4d

that is what my code does, github link! :wink:

in my config camera is set to 0fps so camera will only activate when you open it in home assistant and then pause when not viewed to save resources. voice assistant and music streaming concurrently is handled just fine

1 Like

just a note (without going thru your code). The i2s bus needs a MCLK from the ESP (GPIO12) as the ADC and DAC does not have this natively. also you then need to decide what chip will decide the master clock, I used the ADC to circumvent a Esphome conflict

Maybe the main post was unclear but THIS CODE IS FULLY WORKING… :smiley:

Thank you. Why you use external comonenet for 8311. Why not use esphome component for 8311?

external_components:
  - source:
      type: git
      url: "https://github.com/sw3Dan/waveshare-s2-audio_esphome_voice"
      ref: main
    components: [ es8311 ]
    refresh: 0s

EDIT
So I didnt put 2 and 2 together when I read your github. Basically had to do it to get things working and no audio without it.

Anyway. Your code works perfectly and these speakers are great. My initial impression is that they are at least equal to the HAVPE and honestly it seems like they are in fact better, minus the button and rotary.

the feet are on speaker grill and usb at top of unit which is weird so I put rubber feet on plexi side. Im sure they did this for a reason but whatever it is I plan to ignore and suffer whatever consequence comes or with a little fabric cover the speaker grill to reduce dust and water if it becomes and issue.

Hi @Dan333,
Thanks for sharing this, just got myself this board from AliExpress and have been playing around with it for a bit.
Proper newbie question here but how on earth do I get your github repo installed onto the device? I can flash bin files web.esphome.io but no idea how to generate them.
TYSM in advance :slightly_smiling_face:

Never mind - I figured it out, for anyone else all I did was setup ESPHome in HA, add the YAML from the main repo, added the correct secrets in, then install > manual local. Then use the ESP website to flash the bin file!

My 2 units just arrived from Waveshare in record time. Thanks for the advance work on this device. I am quite impressed with the quality and construction of this devices and beats my old Atom Echo… almost as inexpensive as well, but superior