M5StickC plus as voice remote

Hello,
I have an M5StickC plus that I want to use as a voice remote for the new Assist feature, just like in the example with the M5Atom Echo, but on a StickCplus.

Is this possible, and if yes, how?

Thanks in advance
Aaron

The stick has a microphone, so you should be able to use it at least for that.
No speaker, though.

What is your level of “how”? :wink:

@koying My level of “how” is that I don’t know how to set up the microphone on the StickCplus in ESPhome (the pin assignment is very confusing for me) and I need the YAML for the mic.

Thanks for your help
Aaron

The base YAML would be media-players/m5stack-atom-echo.yaml at 836631e8ca446c84485bba2199f21fdfb398ba89 · esphome/media-players · GitHub

Remove everything speaker / media player related.
GPIO-wise, just play with it :wink:

How far along have you gotten with this? I decided to break out my old Stickc and install the voice stuff on it. I would like the response printed on the screen but I have no idea how to do that. It prints in the log so it should be possible. This little thing would make a nice little Home Assistant remote since we don’t have a wake word option yet.

I initially tried it but my problem was that the pins of the mic weren’t known

Docs say its GPIO0 and GPIO34


image

The problem is that we don’t know the pins for this:

Which is required when using a mic

any progress so far? thanks

I found project - M5StickC with speaker hat. Could that hat be used as speaker function?

I also have one of these and would love to use it as my voice remote. Just chiming in to bump and follow this thread.

Hi,
I built a barometer with the M5StickC Plus2 and an ENV III Hat with ESPHome.

I’m going to try a voice assistant with the M5Stickc Plus 2 and an SPK2 Hat. I’m waiting for my parts and to assemble this. I’ll keep you informed.

1 Like

Hi,
I managed to get the speaker (SPK2) to work with this configuration to make a media_player.

i2s_audio:
  i2s_lrclk_pin: GPIO0
  i2s_bclk_pin: GPIO26

media_player:
  - platform: i2s_audio
    id: media_stickc
   name: Media Player
    dac_type: external
    i2s_dout_pin: GPIO25
    mode: mono

But for the microphone, I can’t do it yet. This configuration doesn’t work.

i2s_audio:
  i2s_lrclk_pin: GPIO0

microphone:
  - platform: i2s_audio
    id: stickc_microphone
    i2s_din_pin: GPIO34
    adc_type: external
    pdm: true

Yes !!!
I managed to get the microphone to work. I’m doing some more testing and will share the code.

[10:09:47][D][voice_assistant:439]: State changed from STOPPING_MICROPHONE to AWAITING_RESPONSE
[10:09:48][D][voice_assistant:563]: Event Type: 4
[10:09:48][D][voice_assistant:591]: Speech recognised as: "quelle est la température du salon"
[10:09:48][D][voice_assistant:563]: Event Type: 5
[10:09:48][D][voice_assistant:596]: Intent started
[10:09:48][D][voice_assistant:563]: Event Type: 6
[10:09:48][D][voice_assistant:563]: Event Type: 7
[10:09:48][D][voice_assistant:619]: Response: "La température est de 17.4 °"
[10:09:48][D][light:036]: 'M5StickC PLUS2 Voice' Setting:
[10:09:48][D][light:051]:   Brightness: 60%
[10:09:48][D][light:085]:   Transition length: 1.0s
[10:09:48][D][voice_assistant:563]: Event Type: 8
[10:09:48][D][voice_assistant:639]: Response URL: "http://192.168.1.xxx:8123/api/tts_proxy/b973e9a209b4b43bb13890560f26b8364a4864e3_fr-fr_a022601376_tts.piper.mp3"
[10:09:48][D][voice_assistant:439]: State changed from AWAITING_RESPONSE to IDLE

edit:

[20:08:16][D][voice_assistant:439]: State changed from STOPPING_MICROPHONE to AWAITING_RESPONSE
[20:08:18][D][voice_assistant:563]: Event Type: 4
[20:08:18][D][voice_assistant:591]: Speech recognised as: "Ă©teindre cuisine"
[20:08:18][D][voice_assistant:563]: Event Type: 5
[20:08:18][D][voice_assistant:596]: Intent started
[20:08:18][D][voice_assistant:563]: Event Type: 6
[20:08:18][D][voice_assistant:563]: Event Type: 7
[20:08:18][D][voice_assistant:619]: Response: "Éteint"
[20:08:18][D][text_sensor:064]: 'text-to-speech': Sending state 'Éteint'
[20:08:18][D][light:036]: 'M5StickC PLUS2 Voice' Setting:
[20:08:18][D][light:051]:   Brightness: 60%
[20:08:18][D][light:085]:   Transition length: 1.0s

micro configuration for esphome:

output:
  # Buzzer output. to be set to off otherwise the microphone doesn't work.   
  - platform: ledc
    pin:
      number: GPIO2
    id: buzzer
    inverted: false

i2s_audio:
  - id: mic_adc
    i2s_lrclk_pin:
       number: GPIO0
       allow_other_uses: true
       ignore_strapping_warning: true
  - id: spk_adc #test for speaker
    i2s_lrclk_pin:
       number: GPIO0
       allow_other_uses: true
       ignore_strapping_warning: true
    i2s_bclk_pin: GPIO26


microphone:
  - platform: i2s_audio
    id: stickc_microphone
    i2s_din_pin: GPIO34
    adc_type: external
    channel: left
    i2s_audio_id: mic_adc
#    bits_per_sample: 16bit #better ??
#    sample_rate: 44100 #better ??
    pdm: true
2 Likes

Could you please provide the full YAML file for the Voice Assistant setup you showed in the picture?
I would like to replicate it, also like the answer being displayed on the screen. I have one question though:
Are you able to turn off the screen completely from within HA? I would need that functionality because even with nothing displayed the back-light is still on…

Best regards
Aaron Eisele

yes, I opened a topic to ask for help configuring the sepaker and I shared my code.

Yes.

Would this also work with the original M5StickC plus (non-2 model)? I only have that on hand atm and this would be the perfect project to give it a use

Normally yes, you will need to change LED port on the GPIO10 (GPIO19 for the Plus2).

output:
  - platform: ledc
    pin: GPIO19
    id: led_pwm

M5StickC Plus

M5StickC Plus 2

2 Likes

Have you had any luck getting the M5StickC Speaker Hat to work with the M5StickC PLUS v1.1?

I have been banging my head against the wall because the Media Player shows up in Home Assistant but sound no comes out of the speaker.

I have reduced the code to the BARE MINIMUM to test the media player.
I’ve tried various combinations of GPIO pins 0, 25, and 26…the result is still silence.

substitutions:
  device_name: "m5stickc-plus--spk2-hat"
  device_friendly_name: "Laundry Room - M5StickC Plus Speaker"
  
esphome:
  name: ${device_name}
  friendly_name: ${device_friendly_name}
  platform: ESP32
  board: m5stick-c
  platformio_options:
    upload_speed: 115200
  project:
    name: m5stack.stickc_plus-spk2_hat
    version: "1.0.0"
  min_version: 2023.5.0

# Enable logging
logger:

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

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "M5Stickc-Plus-Spk2-Hat"
    password: "super_secret"

captive_portal:

i2s_audio:
#   Audio for Speaker
  - id: spk_adc
    i2s_lrclk_pin: GPIO0

media_player:
  - platform: i2s_audio
    id: media_out
    name: ${device_friendly_name}
    i2s_audio_id: spk_adc
    dac_type: internal
    mode: left
    id: dac_output