Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ jobs:
target: esp32s3
- path: 'components/ws-s3-touch/example'
target: esp32s3
- path: 'components/xiao-esp32s3-sense/example'
target: esp32s3

steps:
- name: Checkout repo
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/upload_components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:
components/ws-s3-geek
components/ws-s3-lcd-1-47
components/ws-s3-touch
components/xiao-esp32s3-sense
namespace: "espp"
# use old version if this isn't a release for testing
version: ${{ github.event.release && github.event.release.tag_name || 'v0.20.2' }}
Expand Down
6 changes: 6 additions & 0 deletions components/xiao-esp32s3-sense/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
idf_component_register(
INCLUDE_DIRS "include"
SRC_DIRS "src"
REQUIRES base_component driver esp_driver_gpio esp_driver_i2s fatfs led math task
REQUIRED_IDF_TARGETS "esp32s3"
Comment thread
finger563 marked this conversation as resolved.
)
38 changes: 38 additions & 0 deletions components/xiao-esp32s3-sense/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# XIAO ESP32S3 Sense Board Support Package (BSP) Component

[![Badge](https://components.espressif.com/components/espp/xiao-esp32s3-sense/badge.svg)](https://components.espressif.com/components/espp/xiao-esp32s3-sense)

The Seeed Studio XIAO ESP32S3 Sense combines the XIAO ESP32S3 module with the
Sense expansion board, which adds an OV2640 camera, a PDM microphone, and a
microSD card slot.

The `espp::XiaoEsp32S3Sense` component provides a singleton hardware abstraction
for the board's documented camera, microphone, user-LED, and microSD pin
mappings.

It also provides helper methods for creating default ESP-IDF PDM RX I2S
configuration structures for the onboard microphone, TimerCam-style user LED
control helpers including Gaussian breathing, and a T-Deck / T-Dongle-S3 style
microSD mount helper.

Published helpers include:

- `camera_pins()`
- `microphone_pins()`
- `sd_card_pins()`
- `initialize_sdcard()`
- `sdcard()`
- `user_led_pin()`
- `initialize_led()`
- `start_led_breathing()`
- `set_led_breathing_period()`
- `set_led_brightness()`
- `gaussian()`

## Example

The [example](./example) shows how to use the `espp::XiaoEsp32S3Sense`
component in a streamer-style application that serves OV2640 MJPEG video and
PDM-microphone PCM audio over RTSP while driving the onboard user LED with the
same breathing behavior used by the ESP32 Timer-Cam example, and performing a
simple microSD mount/write/read smoke test when a card is present.
30 changes: 30 additions & 0 deletions components/xiao-esp32s3-sense/example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.20)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

# add the component directories that we want to use
set(EXTRA_COMPONENT_DIRS
"../../../components/base_component"
"../../../components/cli"
"../../../components/format"
"../../../components/logger"
"../../../components/monitor"
"../../../components/rtsp"
"../../../components/socket"
"../../../components/task"
"../../../components/wifi"
"../../../components/xiao-esp32s3-sense"
)

set(
COMPONENTS
"main esptool_py cli esp32-camera mdns monitor rtsp task wifi xiao-esp32s3-sense"
CACHE STRING
"List of components to include"
)

project(xiao_esp32s3_sense_example)

set(CMAKE_CXX_STANDARD 20)
62 changes: 62 additions & 0 deletions components/xiao-esp32s3-sense/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# XIAO ESP32S3 Sense Example

This example turns the Seeed Studio XIAO ESP32S3 Sense into a small RTSP
camera streamer.

It mirrors the newer ESP32-TimerCam streamer-style example:

- connects to Wi-Fi
- breathes the onboard user LED quickly while disconnected, then more slowly once connected
- starts an RTSP server and advertises it over mDNS
- captures MJPEG video from the onboard OV2640 camera
- captures 16 kHz mono PCM audio from the onboard PDM microphone
- mounts the onboard microSD card and performs a simple file write/read smoke test when present
- serves both tracks from a single RTSP session
- exposes a simple serial CLI with Wi-Fi and memory-monitor commands

## How to use example

### Hardware Required

This example is designed to run on the Seeed Studio XIAO ESP32S3 Sense.

### Configuration

Set the Wi-Fi credentials and RTSP port in `menuconfig`:

```bash
idf.py menuconfig
```

Open **Camera Streamer Configuration** and set:

- **WiFi SSID**
- **WiFi Password**
- **RTSP Server Port**
- **RTSP accept/session/control task stack sizes** as needed for your target

The defaults are tuned for the XIAO ESP32S3 Sense, including a larger RTSP
control-task stack to avoid stack overflows in tasks named like
`RtspSession <id>`.

### Build and Flash

Build the project and flash it to the board, then run monitor tool to view
serial output:

```bash
idf.py -p PORT flash monitor
```

(Replace PORT with the name of the serial port to use.)

(To exit the serial monitor, type `Ctrl-]`.)

After the board joins Wi-Fi it advertises an `_rtsp._tcp` mDNS service and
starts streaming at:

```text
rtsp://<board-ip>:<port>/mjpeg/1
```

Track 0 is MJPEG video and track 1 is L16/16000 mono audio.
4 changes: 4 additions & 0 deletions components/xiao-esp32s3-sense/example/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
idf_component_register(SRC_DIRS "."
INCLUDE_DIRS "."
REQUIRES cli esp32-camera esp_driver_i2s mdns monitor rtsp task wifi
xiao-esp32s3-sense)
51 changes: 51 additions & 0 deletions components/xiao-esp32s3-sense/example/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
menu "Camera Streamer Configuration"

config RTSP_SERVER_PORT
int "RTSP Server Port"
default 8554
help
The port number of the RTSP server.

config RTSP_ACCEPT_TASK_STACK_SIZE
int "RTSP accept task stack size (bytes)"
range 2048 32768
default 4096
help
Stack size for the RTSP server accept task.

config RTSP_SESSION_TASK_STACK_SIZE
int "RTSP session task stack size (bytes)"
range 2048 32768
default 4096
help
Stack size for the RTSP server session-dispatch task.

config RTSP_CONTROL_TASK_STACK_SIZE
int "RTSP control task stack size (bytes)"
range 2048 32768
default 8192
help
Stack size for each per-client RTSP control task. Increase this if
the board reports a stack overflow in a task named like
"RtspSession <id>".

config ESP_WIFI_SSID
string "WiFi SSID"
default ""
help
SSID (network name) for the camera streamer to connect to.

config ESP_WIFI_PASSWORD
string "WiFi Password"
default ""
help
WiFi password (WPA or WPA2) for the camera streamer to use.

config ESP_MAXIMUM_RETRY
int "Maximum retry"
default 5
help
Set the Maximum retry to avoid station reconnecting to the AP unlimited when the AP is
really inexistent.

endmenu
24 changes: 24 additions & 0 deletions components/xiao-esp32s3-sense/example/main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## IDF Component Manager Manifest File
dependencies:
idf:
version: '>=5.0'
espressif/mdns: '>=1.8'
espressif/esp32-camera: '>=2.0'
espp/cli:
version: '*'
override_path: ../../../cli
espp/monitor:
version: '*'
override_path: ../../../monitor
espp/rtsp:
version: '*'
override_path: ../../../rtsp
espp/task:
version: '*'
override_path: ../../../task
espp/wifi:
version: '*'
override_path: ../../../wifi
espp/xiao-esp32s3-sense:
version: '*'
override_path: ../..
Loading
Loading