Skip to content

This GITHUB will walkthrough step-by-step on how to connect Seeed Studio XIAO ESP32S3 with ESPHome running on Home Assistant and send the sensor data/ control devices after connecting Grove modules to XIAO ESP32S3. So, let's get started!

Notifications You must be signed in to change notification settings

Zachay-NAU/ESPHome-Support-on-Seeed-Studio-XIAO-ESP32S3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 

Repository files navigation

ESPHome-Support-on-Seeed-Studio-XIAO-ESP32S3

This GITHUB will walkthrough step-by-step on how to connect Seeed Studio XIAO ESP32S3 with ESPHome running on Home Assistant and send the sensor data/ control devices after connecting Grove modules to XIAO ESP32S3. So, let's get started!

Introduction

Install Home Assistant

Make sure you already have Home Assistant up and running. You can follow this wiki for a step-by-step guide on installing Home Assistant on an ODYSSEY-X86 SBC or this link for a detailed instruction use Home Assistant with a Seeed Mini Router.

Install ESPHome on Home Assistant

ESPHome is available as a Home Assistant Add-On and can simply be installed via the add-on store.

  • Step 1. To quickly setup ESPHome on Home Asssistant, click the below button

  • Step 2. Once you see the following pop-up, click OPEN LINK

  • Step 3. Click INSTALL

  • Step 4. Enable all the options and click START

  • Step 5. Click OPEN WEB UI or ESPHOME from the side-panel

You will see the following window if ESPHome is successfully loaded

Add Seeed Studio XIAO ESP32S3 (Sense) to ESPHome

  • Step 1. Click + NEW DEVICE

  • Step 2. Click CONTINUE

  • Step 3. Enter a Name for the device and enter WiFi credentials such as Network name and Password. Then click NEXT

  • Step 4. Select ESP32-S3 and click

  • Step 5. Click SKIP because we will configure this board manually

  • Step 6. Click EDIT under the newly created board

  • Step 7. This will open a YAML file and this file will be used to set all the board configurations. Edit the content under esp32 as follows

Note: Here we are using the latest version of Arduino core for ESP32 and ESP32 support for PlatformIO

  • Step 8. Click SAVE and then click INSTALL

  • Step 9. Connect one end of a USB Type-C cable to Seeed Studio XIAO ESP32S3 and the other end to one of the USB ports on the reRouter CM4 1432

esphome:
  name: esp32s3
  platformio_options:
    build_flags: -DBOARD_HAS_PSRAM
    board_build.arduino.memory_type: qio_opi
    board_build.f_flash: 80000000L
    board_build.flash_mode: qio 

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

wifi:
  ssid: "UMASS fried chicken"
  password: "Zacharyloveschicken"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Xiao-Esp32s3 Fallback Hotspot"
    password: "MoLTqZUvHwWI"

  • Step 10. Click Plug into the computer running ESPHome Dashboard

  • Step 11. Select the connected port. It is likely to be /dev/ttyACM1 because /dev/ttyACM0 is connected to the reRouter CM4 1432

Now it will download all the necessary board packages and flash the ESPHome firmware into the XIAO ESP32S3. If the flashing is successful, you will see the following output. If you see something error, try to restart your xiao esp32S3 or enter bootloader mode by holding on the BOOT BUTTON and connect XIAO ESP32S3.

  • Step 12. The above window displays the real-time logs from the connected board. Close it by clicking STOP

  • Step 13. If you see the board status as ONLINE, that means the board is successful connected to WiFi

Now you can disconnect the XIAO ESP32S3 from the reRouter CM4 1432 and just power it via a USB cable. This is because from now on, if you want to flash firmware to the XIAO ESP32S3, you can simply do it OTA without connecting to the X86 board via a USB cable.

  • Step 14. Click the three dots and click Install

  • Step 15. Select Wirelessly and it will push the changes to the board wirelessly

  • Step 16. Go to Settings and select Devices & Services

  • Step 17. You will see ESPHome as a discovered integration. Click CONFIGURE

  • Step 18. Click SUBMIT

  • Step 19. Click FINISH

Grove Modules with ESPHome and Home Assistant

Now we will connect Grove modules to Seeed Studio XIAO ESP32S3 (sense) so that we can display sensor data or control the devices using Home Assistant!

Connect Grove Modules to XIAO ESP32S3 (sense)

In order to use Grove modules with Seeed Studio XIAO ESP32S3, we will use a Seeed Studio Expansion Base for XIAO and connect XIAO ESP32S3 on it.

After that, the Grove connectors on the board can be used to connect Grove modules

Pin Definitions

You can find more details by clicking here.

Grove Compatibility List with ESPHome

Currently the following Grove modules are supported by ESPHome

Check here

Now we will select 6 Grove modules from the above table and explain how they can be connected with ESPHome and Home Assistant.

Grove - Temperature and Humidity Sensor (BME680)

Setup Configuration

  • Step 1. Connect Grove - Temperature, Humidity, Pressure and Gas Sensor (BME680) to one of the I2C connectors on the Seeed Studio Expansion Base for XIAO
  • Step 2. Inside the xiao-esp32s3-bme680.yaml file that we created before, change the file and push it OTA to XIAO ESP32S3
# Configuration for ESPHome
esphome:
  # Name of the ESP32-S3 device
  name: esp32s3
  
  # PlatformIO build options
  platformio_options:
    build_flags: -DBOARD_HAS_PSRAM
    board_build.arduino.memory_type: qio_opi
    board_build.f_flash: 80000000L
    board_build.flash_mode: qio 

# Configuration for ESP32
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Over-the-Air update configuration
ota:

# Wi-Fi configuration
wifi:
  ssid: "UMASS fried chicken"
  password: "Zacharyloveschicken"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Xiao-Esp32s3 Fallback Hotspot"
    password: "MoLTqZUvHwWI"

# Captive portal configuration
captive_portal:

# I2C configuration for BME680 sensor
i2c:
  sda: GPIO6
  scl: GPIO7

# BME680 sensor configuration
sensor:
  - platform: bme680
    temperature:
      name: "BME680 Temperature"
      oversampling: 16x
    pressure:
      name: "BME680 Pressure"
    humidity:
      name: "BME680 Humidity"
    gas_resistance:
      name: "BME680 Gas Resistance"
    address: 0x76
    update_interval: 60s

Note: You can learn more about the BME680 component here. It allows you to use BME280, BME680, BMP085, BMP280, AHT10, AHT20 and AHT21 based sensors. Here we add the I²C Bus component because AHT20 communicates using I2C protocol.

Visualize on Dashboard

  • Step 1. On the Overview page of Home Assistant, click the 3 dots and click Edit Dashboard

  • Step 2. Click + ADD CARD

  • Step 3. Select By ENTITY, type temperature and select the check box next to Temperature

  • Step 4. Repeat the same for Humidity, Gas Resitance and Pressure

  • Step 5. Click CONTINUE

  • Step 6. Click ADD TO DASHBOARD

Now your Home Assistant dashboard will look like below

  • Step 7. You can also visualize sensor data as gauges. Click Gauge under BY CARD

  • Step 8. Select Temperature from the drop-down menu

  • Step 9. Click SAVE

  • Step 10. Repeat the same for Humidity, Gas Resitance and Pressure

  • Now your dashboard will look like below

Grove -Smart Air Quality Sensor (SGP41)

  • Step 2. Inside the xiao-esp32S3.yaml file that we created before, change the file and push it OTA to XIAO ESP32C3
# Configuration for ESPHome
esphome:
  # Name of the ESP32-S3 device
  name: esp32s3
  
  # PlatformIO build options
  platformio_options:
    build_flags: -DBOARD_HAS_PSRAM
    board_build.arduino.memory_type: qio_opi
    board_build.f_flash: 80000000L
    board_build.flash_mode: qio 

# Configuration for ESP32
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Over-the-Air update configuration
ota:

# Wi-Fi configuration
wifi:
  ssid: "UMASS fried chicken"
  password: "Zacharyloveschicken"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Xiao-Esp32s3 Fallback Hotspot"
    password: "MoLTqZUvHwWI"

# Captive portal configuration
captive_portal:

# SPI configuration
spi:
  clk_pin: GPIO8
  mosi_pin: GPIO10
  miso_pin: GPIO9

# I2C configuration for BME680 sensor
i2c:
  sda: GPIO6
  scl: GPIO7
  scan: True
  id: bus_a
  frequency: 1MHz

# Sensor configuration for SGP4X
sensor:
  - platform: sgp4x
    voc:
      id: sgp41_voc
      name: "VOC Index"
    nox:
      id: sgp41_nox
      name: "NOx Index"
  • Step 3. Example With Compensation compensation (Optional): The block containing sensors used for compensation. If not set defaults will be used. We will use the Temperature and Humidity Sensor (BME680) compensate for Smart Air Quality Sensor (SGP41). Here is the updated xiao-esp32S3.yaml file:
# Configuration for ESPHome
esphome:
  # Name of the ESP32-S3 device
  name: esp32s3
  
  # PlatformIO build options
  platformio_options:
    build_flags: -DBOARD_HAS_PSRAM
    board_build.arduino.memory_type: qio_opi
    board_build.f_flash: 80000000L
    board_build.flash_mode: qio 

# Configuration for ESP32
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Over-the-Air update configuration
ota:

# Wi-Fi configuration
wifi:
  ssid: "UMASS fried chicken"
  password: "Zacharyloveschicken"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Xiao-Esp32s3 Fallback Hotspot"
    password: "MoLTqZUvHwWI"

# Captive portal configuration
captive_portal:

# SPI configuration
spi:
  clk_pin: GPIO8
  mosi_pin: GPIO10
  miso_pin: GPIO9

# I2C configuration for BME680 sensor
i2c:
  sda: GPIO6
  scl: GPIO7
  scan: True
  id: bus_a
  frequency: 1MHz

# BME680 sensor configuration
sensor:
  - platform: bme680
    temperature:
      id: bme680_temp
      name: "BME680 Temperature"
      oversampling: 16x
    pressure:
      name: "BME680 Pressure"
    humidity:
      id: bme680_hum
      name: "BME680 Humidity"
    gas_resistance:
      name: "BME680 Gas Resistance"
    address: 0x76

# SGP4X sensor configuration
  - platform: sgp4x
    voc:
      name: "VOC Index"
    nox:
      name: "NOx Index"
    compensation:
      humidity_source: bme680_hum
      temperature_source: bme680_temp

Note: This sensor will cost 90 circles for collecting enough data samples and warning cannot be avoided so far.

Visualize on Dashboard

The Same as before.

OV2640 camera (XIAO ESP32S3 Sense)

Setup Configuration

  • Step 1. Connect OV2640 Camera external board to the xiao esp32s3 sense

  • Step 2. Inside the xiao-esp32s3-camera.yaml file that we created before, change the file and push it OTA to XIAO ESP32S3 sense

# Configuration for ESPHome
esphome:
  # Name of the ESP32-S3 device
  name: esp32s3
  
  # PlatformIO build options
  platformio_options:
    build_flags: -DBOARD_HAS_PSRAM
    board_build.arduino.memory_type: qio_opi
    board_build.f_flash: 80000000L
    board_build.flash_mode: qio 

# Configuration for ESP32
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Over-the-Air update configuration
ota:

# Wi-Fi configuration
wifi:
  ssid: "UMASS fried chicken"
  password: "Zacharyloveschicken"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Xiao-Esp32s3 Fallback Hotspot"
    password: "MoLTqZUvHwWI"

# Captive portal configuration
captive_portal:

# Configuration for the ESP32 Camera
esp32_camera:
  id: espcam
  name: My Camera
  external_clock:
    pin: GPIO10
    frequency: 20MHz
  i2c_pins:
    sda: GPIO40
    scl: GPIO39
  data_pins: [GPIO15, GPIO17, GPIO18, GPIO16, GPIO14, GPIO12, GPIO11, GPIO48]
  vsync_pin: GPIO38
  href_pin: GPIO47
  pixel_clock_pin: GPIO13
  resolution: 800x600
  
# Configuration for the ESP32 Camera Web Server
esp32_camera_web_server:
  - port: 8080
    mode: stream
  - port: 8081
    mode: snapshot

Note: For more information, please read here.

Visualize on Dashboard

  • Step 1. On the Overview page of Home Assistant, click the 3 dots and click Edit Dashboard

  • Step 2. Click + ADD CARD

  • Step 3. Select By ENTITY, type Camera and select the My Camera

  • Step 4. Click Add to Dashboard

  • Step 5. When viewing the web stream on the dashboard, it is in idle mode, refreshing only a few frames per minute. It transitions to active mode when we click on the card, typically with a refresh rate ranging from one to ten frames per second. In this tutorial, the refresh rate is approximately four frames per second.

PDM microphone for Voice Assistant

Setup Configuration

  • Step 1. Inside the xiao-esp32s3-microphone.yaml file that we created before, change the file and push it OTA to XIAO ESP32S3 sense
# Configuration for ESPHome
esphome:
  name: esp32s3
  platformio_options:
    build_flags: -DBOARD_HAS_PSRAM
    board_build.arduino.memory_type: qio_opi
    board_build.f_flash: 80000000L
    board_build.flash_mode: qio 

# Configuration for ESP32
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Over-the-Air update configuration
ota:

# Wi-Fi configuration
wifi:
  ssid: "UMASS fried chicken"
  password: "Zacharyloveschicken"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Xiao-Esp32s3 Fallback Hotspot"
    password: "MoLTqZUvHwWI"

# Captive portal configuration
captive_portal:

# Configuration for the status LED light
light:
  - platform: status_led
    id: light0
    name: "Voice Assistant State"
    pin:
      number: GPIO21
      inverted: true

# Configuration for I2S audio
i2s_audio:
  i2s_lrclk_pin: GPIO46 # Note: labeled as "useless"
  i2s_bclk_pin: GPIO42

# Configuration for the microphone using I2S audio
microphone:
  - platform: i2s_audio
    id: echo_microphone
    i2s_din_pin: GPIO41
    adc_type: external
    pdm: true

# Configuration for the Voice Assistant
voice_assistant:
  microphone: echo_microphone

# Configuration for the binary sensor (Boot Switch)
binary_sensor:    
  - platform: gpio
    pin: 
      number: GPIO2
      mode:
        input: true
        pullup: true
    name: Boot Switch
    internal: true
    on_press:
      - voice_assistant.start:
      - light.turn_off: light0
    on_release:
      - voice_assistant.stop:
      - light.turn_on: light0

Note: For more information, please read here.

Visualize on Dashboard

  • Step 1. On the Overview page of Home Assistant, click the 3 dots and click Edit Dashboard

  • Step 2. Click + ADD CARD

  • Step 3. Select By ENTITY, then select the Esp32S3 Assist in progress,Esp32S3 Assist in progress, Esp32S3 Finished speaking detection, Status and voice assistant state

  • Step 4. Click Add to Dashboard

  • Step 5. When you press the Button(D1) on the Seeed Studio Expansion Base for XIAO, the user defined led (GPIO2) will be on on the esp32s3 and you can talk to esphome through voice assitant.

Note: For more information, please read it.

About

This GITHUB will walkthrough step-by-step on how to connect Seeed Studio XIAO ESP32S3 with ESPHome running on Home Assistant and send the sensor data/ control devices after connecting Grove modules to XIAO ESP32S3. So, let's get started!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published