xiao-webcam-ap

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

XIAO ESP32S3 camera web apps — AP (hotspot) mode

XIAO ESP32S3 摄像头Web应用 — AP(热点)模式

The board becomes its own WiFi hotspot. Clients join the board's SSID and the page is ALWAYS at http://192.168.4.1. No router, no internet needed. Best for classrooms: one board per student/team, isolated networks.
Read the
xiao-esp32s3
skill (same repo) first for base workflow and pitfalls (especially: PSRAM flag mandatory, DTR reset-stuck recovery, no serial reads while a demo must keep running).
开发板会成为自身的WiFi热点。客户端连接开发板的SSID后,即可访问**http://192.168.4.1**页面。无需路由器,无需互联网。 非常适合课堂场景:每位学生/每个团队配备一块开发板,网络相互隔离。
请先阅读
xiao-esp32s3
技能(同一仓库)了解基础工作流程和注意事项(尤其注意:PSRAM标记为必填项、DTR重置卡顿恢复方法、演示运行时无法进行串口读取)。

Step 1 — ALWAYS ask the user first

步骤1 — 务必先询问用户

Never invent credentials. Ask the user for:
  1. AP 이름(SSID) — e.g.
    XIAO_01
    . For classroom fleets suggest numbered names (
    XIAO_01
    ..
    XIAO_20
    ).
  2. AP 비밀번호 — 8+ chars (WPA2 minimum). If the user wants an open AP, confirm explicitly.
  3. 채널 (optional, default 1) — for MULTIPLE boards in one room, spread across 1 / 6 / 11 (board N → channel
    [1,6,11][N % 3]
    ); 20 boards all on channel 1 will jam each other.
  4. Which app: collector, inference viewer, or both.
请勿自行设定参数。请向用户确认以下信息:
  1. AP名称(SSID) — 例如
    XIAO_01
    。对于课堂批量部署,建议使用编号名称(
    XIAO_01
    ..
    XIAO_20
    )。
  2. AP密码 — 至少8个字符(WPA2最低要求)。如果用户需要开放AP,请明确确认。
  3. 信道(可选,默认值为1) — 若同一房间内有多块开发板,请将它们分散到信道1/6/11(第N块开发板对应信道
    [1,6,11][N % 3]
    );20块开发板都使用信道1会导致相互干扰。
  4. 需要部署的应用:数据集收集页、实时推理查看页,或两者都部署。

Step 2 — generate the sketch from the template

步骤2 — 从模板生成代码文件

Templates in
assets/
are verified working code — do not rewrite them:
  • assets/web_collect.ino.tpl
    — dataset collector (gallery + delete + ZIP download)
  • assets/web_infer.ino.tpl
    — live inference viewer (needs the
    <project>_inferencing
    Edge Impulse library installed in the sketchbook)
Copy the template to
<workspace>\<NN>_<name>\<NN>_<name>.ino
(folder = ino name), then replace the placeholders literally:
PlaceholderMeaningExample
__AP_SSID__
hotspot name
XIAO_01
__AP_PASS__
hotspot password (8+ chars)
class1234
__AP_CHANNEL__
WiFi channel (bare number, no quotes)
6
__EI_PROJECT__
inference app only — Edge Impulse project name, matching the installed
<name>_inferencing
library folder
clfc
assets/
目录下的模板为经过验证的可用代码 — 请勿重写:
  • assets/web_collect.ino.tpl
    — 数据集收集器(包含图库、删除、ZIP下载功能)
  • assets/web_infer.ino.tpl
    — 实时推理查看器(需要在代码库中安装
    <project>_inferencing
    Edge Impulse库)
将模板复制到
<workspace>\<NN>_<name>\<NN>_<name>.ino
(文件夹名称需与ino文件名一致),然后逐一替换占位符:
占位符含义示例
__AP_SSID__
热点名称
XIAO_01
__AP_PASS__
热点密码(至少8个字符)
class1234
__AP_CHANNEL__
WiFi信道(纯数字,无需引号)
6
__EI_PROJECT__
仅推理应用需填写 — Edge Impulse项目名称,需与已安装的
<name>_inferencing
库文件夹名称匹配
clfc

Step 3 — compile, upload

步骤3 — 编译、上传

powershell
arduino-cli compile --fqbn esp32:esp32:XIAO_ESP32S3 --board-options PSRAM=opi <SKETCH_DIR>
arduino-cli upload -p COM4 --fqbn esp32:esp32:XIAO_ESP32S3 --board-options PSRAM=opi <SKETCH_DIR>
PSRAM=opi
is mandatory (camera + model need PSRAM). The inference build needs
--clean
if the Edge Impulse library was just swapped.
powershell
arduino-cli compile --fqbn esp32:esp32:XIAO_ESP32S3 --board-options PSRAM=opi <SKETCH_DIR>
arduino-cli upload -p COM4 --fqbn esp32:esp32:XIAO_ESP32S3 --board-options PSRAM=opi <SKETCH_DIR>
PSRAM=opi
为必填项(摄像头和模型需要PSRAM支持)。如果刚更换了Edge Impulse库,编译推理应用时需添加
--clean
参数。

Step 4 — verify

步骤4 — 验证

powershell
undefined
powershell
undefined

the AP should appear in a WiFi scan within ~15 s of flashing

烧录完成后约15秒,AP应出现在WiFi扫描结果中

netsh wlan show networks | Select-String "<AP_SSID>"

(netsh caches scans — retry after 20 s before concluding failure.)

**This check needs a WiFi adapter on the PC, and many desktops do not have
one.** If `netsh wlan show interfaces` reports that the Wireless AutoConfig
service is not running, or `Get-NetAdapter` lists only Ethernet, no amount of
retrying will show the AP — the machine physically cannot scan. Do not read
that as a failed flash. Fall back to serial (below), or have the user check
from their phone.
netsh wlan show networks | Select-String "<AP_SSID>"

(netsh会缓存扫描结果 — 若未找到,请等待20秒后重试再判定失败。)

**此验证需要电脑配备WiFi适配器,很多台式机没有该硬件。** 如果`netsh wlan show interfaces`显示无线自动配置服务未运行,或`Get-NetAdapter`仅列出以太网,则无论重试多少次都无法扫描到AP — 该设备物理上不支持WiFi扫描。请勿将此判定为烧录失败。可改用串口验证(如下),或让用户用手机检查。

Watching the board over serial

通过串口监控开发板状态

In AP mode the PC usually cannot reach the board at all, so serial is often the only verification available to you. Use the
xiao-serial-monitor
skill.
powershell
mon                      # interactive, port auto-detected
.\scripts\mon.ps1 -Seconds 15    # bounded, for your own debugging
Expected on success:
AP started. Open http://192.168.4.1
Collector ready
Camera init failed
instead means the sketch halts before ever starting the AP — the board is a plain XIAO ESP32S3 without the Sense camera module, or the module is not seated. Scanning for the SSID forever will never reveal this; one serial read does.
Two things worth knowing rather than avoiding:
  • Opening the port resets the board via DTR, so the log restarts from boot. That is what you want here — these lines only print once at startup.
  • If a board ends up stuck showing only the ROM banner afterwards (pitfall 8 of
    xiao-esp32s3
    ), re-running
    arduino-cli upload
    clears it, and leaves the sketch running for the demo.
When the user wants to watch it themselves, hand them the command rather than launching the interactive monitor from a tool call — it never returns. In Claude Code the
!
prefix runs it in their session:
! <path>\mon.ps1
Full check: connect a device to the AP and open http://192.168.4.1 — tell the user connecting from THEIR phone/PC will drop that device's internet while connected; that is expected in AP mode.
在AP模式下,电脑通常无法直接连接开发板,因此串口往往是唯一可用的验证方式。请使用
xiao-serial-monitor
技能。
powershell
mon                      # 交互式监控,自动检测端口
.\scripts\mon.ps1 -Seconds 15    # 限时监控,用于调试
成功运行时的预期输出:
AP started. Open http://192.168.4.1
Collector ready
若输出为
Camera init failed
,则表示代码在启动AP前就已停止运行 — 该开发板是不带Sense摄像头模块的普通XIAO ESP32S3,或摄像头模块未安装到位。此时持续扫描SSID永远无法发现问题,而一次串口读取就能排查原因。
需要了解的两个关键点:
  • 打开串口会通过DTR重置开发板,因此日志会从开机重新开始。这正是我们需要的 — 上述信息仅在启动时打印一次。
  • 如果开发板之后一直显示ROM启动信息(
    xiao-esp32s3
    技能中的注意事项8),重新运行
    arduino-cli upload
    即可解决,并让代码保持运行状态用于演示。
当用户想要自行监控时,请将命令告知他们,而非直接启动交互式监控 — 该命令不会自动返回。在Claude Code中,前缀
!
可让命令在用户会话中运行:
! <path>\mon.ps1
完整验证步骤:将设备连接到AP并打开http://192.168.4.1 — 告知用户,连接该AP期间,其设备会断开原有网络连接;这是AP模式下的正常现象。

Notes

注意事项

  • Collector page: captures go to an in-browser gallery (label badges, per-shot delete, "전체 ZIP 다운로드" produces
    label.N.jpg
    files ready for Edge Impulse). Refreshing the page clears the gallery — download the ZIP first.
  • Inference page: whole-frame colored box + top label + per-class confidence bars (classification model — per-object location boxes need a FOMO model).
  • The camera renders rotated 90°; the inference template already compensates (CW feature rotation, verified empirically).
  • 数据集收集页:拍摄的图片会存入浏览器图库(带有标签标识,支持单张删除),点击“全部ZIP下载”可生成
    label.N.jpg
    格式的文件,直接用于Edge Impulse。刷新页面会清空图库 — 请先下载ZIP文件。
  • 推理查看页:显示全帧彩色框+顶部标签+各类别置信度条形图(适用于分类模型 — 若需目标位置框则需使用FOMO模型)。
  • 摄像头画面会旋转90°;推理模板已对此进行补偿(顺时针特征旋转,经验证有效)。