|
| 1 | +--- |
| 2 | +description: Voice Assistant System with ReSpeaker V3 and XIAO ESP32S3 |
| 3 | +title: Voice Assistant System with ReSpeaker V3 and XIAO ESP32S3 |
| 4 | +keywords: |
| 5 | +- ESP32S3 |
| 6 | +- XIAO |
| 7 | +- reSpeaker |
| 8 | +- Home Assistant |
| 9 | +image: https://files.seeedstudio.com/wiki/wiki-platform/S-tempor.png |
| 10 | +slug: /reSpeaker_v3_HA |
| 11 | +last_update: |
| 12 | + date: 4/2/2024 |
| 13 | + author: Jessie |
| 14 | +--- |
| 15 | + |
| 16 | +Say 'hello' to effortless control and 'goodbye' to tapping on screens with our voice assistant system.<br/> |
| 17 | +Picture this: you're cozied up on your couch, and with just a simple shout-out to the [ReSpeaker V3](https://www.seeedstudio.com/XIAO-ESP32S3-p-5627.html), you can switch up the lights, crank up the tunes, or even ask about the weather – all without lifting a finger. Thanks to a nifty little [Seeed XIAO ESP32S3](https://www.seeedstudio.com/XIAO-ESP32S3-p-5627.html) chip, you've got a mini-but-mighty brain that hooks up your voice to Home Assistant, making your smart home smarter and your life a whole lot easier. So, if you're ready to make your home listen and respond to your voice as if it's just another member of the family, let's get started on this voice-activated adventure! |
| 18 | + |
| 19 | + |
| 20 | +## Getting Started |
| 21 | + |
| 22 | +Navigate to your [Home Assistant web interface](http://homeassistant.local:8123/). |
| 23 | + |
| 24 | +To unlock the full potential of Home Assistant and gain access to advanced features, it's recomended to enable the `Advanced mode` in the user interface. |
| 25 | + |
| 26 | +Click on your profile, and enable the `Advanced mode`. |
| 27 | + |
| 28 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/SenseCAP/wio_tracker/advanced-mode.png" alt="pir" width={800} height="auto" /></p> |
| 29 | + |
| 30 | + |
| 31 | +### Install Add-ons |
| 32 | + |
| 33 | +Go to [Settings > Add-ons](https://my.home-assistant.io/redirect/supervisor). |
| 34 | + |
| 35 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/add-ons.png" alt="pir" width={800} height="auto" /></p> |
| 36 | + |
| 37 | + |
| 38 | +Under the Official `add-ons` section, you will find the `ESPHome`, `Whisper`, `Piper`, `openWakeWord` add-on, and click `Install`. |
| 39 | + |
| 40 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/.png" alt="pir" width={800} height="auto" /></p> |
| 41 | + |
| 42 | +Enable `Start on boot` and `Watchdog`, and click `Start`. |
| 43 | + |
| 44 | + |
| 45 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/start-addons.png" alt="pir" width={800} height="auto" /></p> |
| 46 | + |
| 47 | +:::tip |
| 48 | +After the installation script has finished, restart Home Assistant to apply the changes. |
| 49 | + |
| 50 | +Go to `Settings` > `System` > `Restart`. |
| 51 | + |
| 52 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/SenseCAP/wio_tracker/restart.png" alt="pir" width={800} height="auto" /></p> |
| 53 | +::: |
| 54 | + |
| 55 | +Navigate to `Settings` -> `Devices & Services`, you will find these integrations under the `Discovered`. |
| 56 | + |
| 57 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/device-page.png" alt="pir" width={800} height="auto" /></p> |
| 58 | + |
| 59 | +Click `CONFIGURE` and `SUBMIT`. |
| 60 | + |
| 61 | + |
| 62 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/config-success.png" alt="pir" width={800} height="auto" /></p> |
| 63 | + |
| 64 | + |
| 65 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/device-page.png" alt="pir" width={800} height="auto" /></p> |
| 66 | + |
| 67 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/entities.png" alt="pir" width={800} height="auto" /></p> |
| 68 | + |
| 69 | +### Add Seeed Studio XIAO ESP32S3 to ESPHome |
| 70 | + |
| 71 | +* Step 1: Navigate to `ESPHome`, and click `+ NEW DEVICE`. |
| 72 | + |
| 73 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/add-new-esphome.png" alt="pir" width={800} height="auto" /></p> |
| 74 | + |
| 75 | + |
| 76 | +* Step 2. Enter a Name for your device, then click `NEXT`. |
| 77 | + |
| 78 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/next11.png" alt="pir" width={500} height="auto" /></p> |
| 79 | + |
| 80 | +* Step 4. Select `ESP32-S3`. |
| 81 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/choose-s3.png" alt="pir" width={800} height="auto" /></p> |
| 82 | + |
| 83 | +* Step 5. Click `SKIP`, we will configure this file manually. |
| 84 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/.png" alt="pir" width={800} height="auto" /></p> |
| 85 | + |
| 86 | +* Step 6. Click `EDIT` and copy the following code: |
| 87 | + |
| 88 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/config.png" alt="pir" width={800} height="auto" /></p> |
| 89 | + |
| 90 | +<details> |
| 91 | + |
| 92 | +<summary>.yaml</summary> |
| 93 | + |
| 94 | +```cpp |
| 95 | +esphome: |
| 96 | + name: esp32s3 |
| 97 | + friendly_name: ReSpeakerv3 |
| 98 | + platformio_options: |
| 99 | + board_build.flash_mode: dio |
| 100 | + board_build.mcu: esp32s3 |
| 101 | + # on_boot: |
| 102 | + # then: |
| 103 | + # - if: |
| 104 | + # condition: |
| 105 | + # switch.is_on: |
| 106 | + # then: |
| 107 | + # - voice_assistant.start_continuous: |
| 108 | + |
| 109 | + |
| 110 | +esp32: |
| 111 | + board: esp32-s3-devkitc-1 |
| 112 | + variant: esp32s3 |
| 113 | + framework: |
| 114 | + type: esp-idf |
| 115 | + version: recommended |
| 116 | + |
| 117 | +logger: |
| 118 | + level: VERY_VERBOSE |
| 119 | + |
| 120 | +api: |
| 121 | + |
| 122 | + |
| 123 | +wifi: |
| 124 | + ssid: "Wi-Fi name" |
| 125 | + password: "Wi-Fi password" |
| 126 | + |
| 127 | +captive_portal: |
| 128 | + |
| 129 | +external_components: |
| 130 | + - source: github://QingWind6/ESPHome_XIAO-ESP32S3 |
| 131 | + |
| 132 | +i2s_audio_xiao: |
| 133 | + i2s_lrclk_pin: GPIO7 |
| 134 | + i2s_bclk_pin: GPIO8 |
| 135 | + i2s_mclk_pin: GPIO9 |
| 136 | + |
| 137 | + |
| 138 | +microphone: |
| 139 | + - platform: i2s_audio_xiao |
| 140 | + id: xiao_mic |
| 141 | + adc_type: external |
| 142 | + i2s_din_pin: GPIO44 |
| 143 | + pdm: false |
| 144 | + bits_per_sample: 32bit |
| 145 | + channel: left |
| 146 | + |
| 147 | +speaker: |
| 148 | + - platform: i2s_audio_xiao |
| 149 | + id: xiao_speaker |
| 150 | + dac_type: external |
| 151 | + i2s_dout_pin: GPIO43 |
| 152 | + mode: stereo |
| 153 | + |
| 154 | +voice_assistant: |
| 155 | + microphone: xiao_mic |
| 156 | + use_wake_word: true |
| 157 | + noise_suppression_level: 0 |
| 158 | + auto_gain: 0dBFS |
| 159 | + volume_multiplier: 1 |
| 160 | + speaker: xiao_speaker |
| 161 | + id: assist |
| 162 | + on_listening: |
| 163 | + - light.turn_on: |
| 164 | + id: led |
| 165 | + blue: 100% |
| 166 | + red: 0% |
| 167 | + green: 0% |
| 168 | + effect: "Slow Pulse" |
| 169 | + on_stt_vad_end: |
| 170 | + - light.turn_on: |
| 171 | + id: led |
| 172 | + blue: 100% |
| 173 | + red: 0% |
| 174 | + green: 0% |
| 175 | + effect: "Fast Pulse" |
| 176 | + on_tts_start: |
| 177 | + - light.turn_on: |
| 178 | + id: led |
| 179 | + blue: 100% |
| 180 | + red: 0% |
| 181 | + green: 0% |
| 182 | + brightness: 100% |
| 183 | + effect: none |
| 184 | + on_end: |
| 185 | + - delay: 100ms |
| 186 | + - wait_until: |
| 187 | + not: |
| 188 | + speaker.is_playing: |
| 189 | + - script.execute: reset_led |
| 190 | + on_error: |
| 191 | + - light.turn_on: |
| 192 | + id: led |
| 193 | + red: 100% |
| 194 | + green: 0% |
| 195 | + blue: 0% |
| 196 | + brightness: 100% |
| 197 | + effect: none |
| 198 | + - delay: 1s |
| 199 | + - script.execute: reset_led |
| 200 | + on_client_connected: |
| 201 | + - if: |
| 202 | + condition: |
| 203 | + switch.is_on: use_wake_word |
| 204 | + then: |
| 205 | + - voice_assistant.start_continuous: |
| 206 | + - script.execute: reset_led |
| 207 | + on_client_disconnected: |
| 208 | + - if: |
| 209 | + condition: |
| 210 | + switch.is_on: use_wake_word |
| 211 | + then: |
| 212 | + - voice_assistant.stop: |
| 213 | + - light.turn_off: led |
| 214 | + |
| 215 | +light: |
| 216 | + - platform: esp32_rmt_led_strip |
| 217 | + id: led |
| 218 | + name: None |
| 219 | + disabled_by_default: true |
| 220 | + entity_category: config |
| 221 | + pin: GPIO1 |
| 222 | + default_transition_length: 0s |
| 223 | + chipset: ws2812 |
| 224 | + num_leds: 1 |
| 225 | + rgb_order: grb |
| 226 | + rmt_channel: 0 |
| 227 | + effects: |
| 228 | + - pulse: |
| 229 | + name: "Slow Pulse" |
| 230 | + transition_length: 250ms |
| 231 | + update_interval: 250ms |
| 232 | + min_brightness: 50% |
| 233 | + max_brightness: 100% |
| 234 | + - pulse: |
| 235 | + name: "Fast Pulse" |
| 236 | + transition_length: 100ms |
| 237 | + update_interval: 100ms |
| 238 | + min_brightness: 50% |
| 239 | + max_brightness: 100% |
| 240 | + |
| 241 | +# light: |
| 242 | +# - platform: monochromatic |
| 243 | +# id: led |
| 244 | +# name: "Desk Lamp" |
| 245 | +# output: light_output |
| 246 | +# effects: |
| 247 | +# - pulse: |
| 248 | +# name: "Slow Breathing Light" |
| 249 | +# transition_length: 5s # 缓慢呼吸灯,渐变时间较长 |
| 250 | +# - pulse: |
| 251 | +# name: "Fast Breathing Light" |
| 252 | +# transition_length: 1s # 快速呼吸灯,渐变时间较短 |
| 253 | +# - pulse: |
| 254 | +# name: "Fast Pulse" |
| 255 | +# transition_length: 0.5s |
| 256 | +# update_interval: 0.5s |
| 257 | +# min_brightness: 0% |
| 258 | +# max_brightness: 100% |
| 259 | + |
| 260 | +output: |
| 261 | + - platform: ledc |
| 262 | + id: light_output |
| 263 | + pin: GPIO21 |
| 264 | + inverted: true |
| 265 | + |
| 266 | + |
| 267 | +script: |
| 268 | + - id: reset_led |
| 269 | + then: |
| 270 | + - if: |
| 271 | + condition: |
| 272 | + - switch.is_on: use_wake_word |
| 273 | + - switch.is_on: use_listen_light |
| 274 | + then: |
| 275 | + - light.turn_on: |
| 276 | + id: led |
| 277 | + effect: none |
| 278 | + |
| 279 | + else: |
| 280 | + - light.turn_off: |
| 281 | + id: led |
| 282 | + |
| 283 | + |
| 284 | +switch: |
| 285 | + - platform: template |
| 286 | + name: Use wake word |
| 287 | + id: use_wake_word |
| 288 | + optimistic: true |
| 289 | + restore_mode: RESTORE_DEFAULT_ON |
| 290 | + entity_category: config |
| 291 | + on_turn_on: |
| 292 | + - lambda: id(assist).set_use_wake_word(true); |
| 293 | + - if: |
| 294 | + condition: |
| 295 | + not: |
| 296 | + - voice_assistant.is_running |
| 297 | + then: |
| 298 | + - voice_assistant.start_continuous |
| 299 | + on_turn_off: |
| 300 | + - voice_assistant.stop |
| 301 | + - lambda: id(assist).set_use_wake_word(false); |
| 302 | + |
| 303 | + - platform: template |
| 304 | + name: Use Listen Light |
| 305 | + id: use_listen_light |
| 306 | + optimistic: true |
| 307 | + restore_mode: RESTORE_DEFAULT_ON |
| 308 | + entity_category: config |
| 309 | + on_turn_on: |
| 310 | + - script.execute: reset_led |
| 311 | + on_turn_off: |
| 312 | + - script.execute: reset_led |
| 313 | +``` |
| 314 | +</details> |
| 315 | + |
| 316 | + |
| 317 | +* Step 7: Click `SAVE` and then `INSTALL`. |
| 318 | + |
| 319 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/click-install.png" alt="pir" width={800} height="auto" /></p> |
| 320 | + |
| 321 | + |
| 322 | +* Step 8: Choose `Manual Download` -> `Modern-format`. |
| 323 | + |
| 324 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/manual-download.png" alt="pir" width={800} height="auto" /></p> |
| 325 | + |
| 326 | + |
| 327 | +* Step 9: Connect the XIAO ESP32S3 to your PC via a USB Type-C cable. |
| 328 | + |
| 329 | +* Step 10: Navigate to [Web-ESPHome](https://web.esphome.io/), click `CONNECT`, then choose the port and connect it. |
| 330 | + |
| 331 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/connect-port.png" alt="pir" width={800} height="auto" /></p> |
| 332 | + |
| 333 | + |
| 334 | +* Step 11: Select the `.bin` file we just downloaded, and click `INSTALL`. |
| 335 | + |
| 336 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/install.png" alt="pir" width={800} height="auto" /></p> |
| 337 | + |
| 338 | +Wait for a few minutes for the installation. After the installation is successful, you will see the following prompt. |
| 339 | + |
| 340 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/install-done.png" alt="pir" width={800} height="auto" /></p> |
| 341 | + |
| 342 | + |
| 343 | + |
| 344 | + |
| 345 | + |
| 346 | +### Add Voice Asssitant |
| 347 | + |
| 348 | +Navigate to `Settings` -> `Voice Assistant`. |
| 349 | + |
| 350 | + |
| 351 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/voice-assistant.png" alt="pir" width={800} height="auto" /></p> |
| 352 | + |
| 353 | +Enter a name and select: |
| 354 | + |
| 355 | +**Speech to text**: `Whisper` |
| 356 | + |
| 357 | +**Text to speech**: `Piper` |
| 358 | + |
| 359 | +**Wake word engine**: `openwakeword` |
| 360 | + |
| 361 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/piper-config.png" alt="pir" width={800} height="auto" /></p> |
| 362 | + |
| 363 | + |
| 364 | +Choose a wakeword you preferred. |
| 365 | + |
| 366 | + |
| 367 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/choose-wakeword.png" alt="pir" width={800} height="auto" /></p> |
| 368 | + |
| 369 | + |
| 370 | + |
| 371 | +<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/respeakerv3/piper-config.png" alt="pir" width={800} height="auto" /></p> |
| 372 | + |
0 commit comments