-
Notifications
You must be signed in to change notification settings - Fork 26
feat(xiao-esp32-s3-sense): Add XIAO ESP32 S3 Sense BSP component, example streams audio/video using RTSP component #634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1d239c6
feat(xiao-esp32-s3-sense): Add XIAO ESP32 S3 Sense BSP component, exa…
finger563 ff7a6be
update ci
finger563 1c9440f
Merge branch 'main' into feat/xiao-esp32-s3-sense
finger563 ca7f555
address comments and sa
finger563 ab5cbc5
update xiao esp32s3 sense to have support for micro SD card
finger563 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # XIAO ESP32S3 Sense Board Support Package (BSP) Component | ||
|
|
||
| [](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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
51
components/xiao-esp32s3-sense/example/main/Kconfig.projbuild
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
24
components/xiao-esp32s3-sense/example/main/idf_component.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: ../.. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.