摄像头

技术方案Classic
应用场景家电与控制

本示例将 ESP32-S3-EYE 打造成一台智能摄像头:视频通过 Amazon Kinesis Video Streams 以 WebRTC 实时传输,ESP RainMaker 负责设备认领、Wi-Fi 配网和设备管理。使用 ESP RainMaker Home App 为摄像头配网后,即可在 App 中打开设备观看实时画面。

产品应用场景: 基于 ESP RainMaker 的婴儿监护器:推流开启时,在 ESP RainMaker Home App 中通过 WebRTC 实时查看婴儿房画面。

概览

处理器ESP32-S3(ESP32-S3-EYE)
连接方式Wi-Fi + BLE
供电电压5V(USB)
IDF 版本ESP-IDF v5.5.x

准备物品

可体验的功能

在真实开发板上体验

从乐鑫或其授权分销商购买官方开发板,然后直接在本页烧录此示例。 选购乐鑫开发板

烧录并体验

选择部署

公共部署

由乐鑫托管,供评估使用。免费,无需任何部署。

  1. 连接: 通过 USB 连接开发板,并选择对应的串口。
  2. 烧录: 写入预编译固件,等待擦除和烧录完成。
  3. 复位: 重启开发板,控制台中将显示二维码。
  4. 配对并观看: 在 Home App 中点击 +,通过蓝牙连接,输入控制台中显示的 PoP,然后打开摄像头开始观看视频流。

详细说明

1. 准备工作

  1. 一台 Linux、macOS 或 Windows 电脑。
  2. 一块 ESP32-S3-EYE 开发板。
  3. USB 数据线。

2. 连接设备

  1. 使用 USB 数据线将 ESP32-S3-EYE 连接到电脑,然后点击终端上方左上角的 连接 按钮。
  2. 选择正确的串口,然后点击 连接。
  3. 连接成功后,即可开始烧录设备。

3. 烧录设备

  1. 点击终端上方的 烧录设备,选择 擦除并烧录。等待 erase_flash 擦除过程完成后,再写入固件。
  2. 等待固件烧录完成。
  3. 点击 复位 按钮复位设备。
  4. 终端中出现二维码,即表示烧录成功。

4. 在 Home App 中为设备配网

  1. 在控制台旁的 Home App 面板中,保持 ESP RainMaker Classic 部署,然后登录。也可以使用 ESP RainMaker 手机 App(点击此处获取)。
  2. 点击 +,选择 I do not have a QR code,再选择 Bluetooth。
  3. 在 Chrome 的蓝牙窗口中,选择与控制台中名称一致的设备,例如 PROV_ff7bf2。
  4. 按提示输入 PoP。PoP 即控制台 QRCODE: 行中的 "pop" 值,例如 {"ver":"v1","name":"PROV_xxxxxx","pop":"xxxxxxxx","transport":"ble"}。
  5. 选择 Wi-Fi 网络,输入密码,等待配网完成。设备随后会出现在 My Devices 中。
  6. 在 App 中控制设备。

5. 观看实时视频

  1. 在 Home App 的 My Devices 中打开摄像头。
  2. 在设备详情页面开始串流,即可观看摄像头画面。

私有部署

您自己的 ESP RainMaker Classic 部署。请通过 Admin CLI 注册节点,而非 Dashboard。

  1. Register: With the ESP RainMaker Admin CLI, generate device certificates and register them with node_certs.csv.
  2. Load credentials: Zip the CLI batch folder (Mfg-…) or pick one node's .bin from its bin/ folder, and drop it into Device credentials.
  3. Flash: Write the firmware and the credentials in one pass. The board resets when done.
  4. Pair: Sign in to your private Classic deployment in the Home App, then add the device with the PoP from the console.

详细说明

1. Before you start

  1. A private ESP RainMaker Classic deployment (you need its deployment base URL and super-admin email from setup).
  2. The ESP RainMaker Admin CLI installed on your computer (esp-rainmaker-admin-cli).
  3. An ESP32-family DevKit that matches this example, a USB data cable, and Chrome or Edge.

2. Generate and register device certificates

  1. Follow the Admin CLI user guide. Set your deployment endpoint and log in:
    python rainmaker_admin_cli.py account serverconfig --endpoint <your-deployment-base-url>
    python rainmaker_admin_cli.py account login --email <super-admin-email>
  2. Generate certificates for your boards (factory NVS images land under bin/ in the output folder):
    python rainmaker_admin_cli.py certs devicecert generate --count <n> --prov ble --outdir <outdir>
  3. Register them with the cloud using the batch's common/node_certs.csv:
    python rainmaker_admin_cli.py certs devicecert register --inputfile <outdir>/<date>/Mfg-<no>/common/node_certs.csv
  4. Save the request_id from the register command and check status when needed:
    python rainmaker_admin_cli.py certs devicecert getcertstatus --requestid <request_id>
  5. The output holds private keys. Keep it out of chats and repositories, and delete it when you are done.

3. Load the device credentials

  1. From the Admin CLI output folder, zip the Mfg-<no> batch folder, or pick one bin/node-….bin file.
  2. Drop that ZIP or .bin onto Device credentials above the console. It is read in your browser and never uploaded.
  3. With the ZIP, pick the node for this board. Every board needs its own node: two boards with the same one connect as the same device.
  4. The credentials are flashed at 0x3FA000, where this example keeps its fctry partition.

4. Connect and flash

  1. Connect the board over USB, click Connect above the console and pick its port.
  2. Click Flash Device and choose Erase, then flash firmware + credentials. The firmware image goes to 0x0 and the credentials to 0x3FA000 in one pass, so the erase cannot wipe them.
  3. The board resets when flashing is done. Type get-node-id in the console when the firmware supports it: it prints the node you picked.
  4. To give a board another node later, or restore one after a full erase, load the credentials and choose Credentials only. The firmware on the board is kept.
  5. To reflash only the firmware, choose Flash only. The credentials on the board are kept.

5. Sign in on your deployment

  1. In the Home App panel next to the console, sign in to your private ESP RainMaker Classic deployment (the base URL from your deployment setup).
  2. You can also use the ESP RainMaker phone app (iOS / Android); point it at the same deployment if your build supports a custom endpoint.
  3. Use a regular user account for day-to-day testing, not the super-admin account used with the Admin CLI.

6. Provision the device in the Home App

  1. Tap +, choose I do not have a QR code, then Bluetooth.
  2. In Chrome's Bluetooth window, pick the device whose name matches the one in the console, for example PROV_ff7bf2.
  3. Enter the PoP when asked. It is the "pop" value in the QRCODE: line of the console, for example {"ver":"v1","name":"PROV_xxxxxx","pop":"xxxxxxxx","transport":"ble"}.
  4. Pick your Wi-Fi network, enter its password and wait for provisioning to finish. The device then appears under My Devices.
  5. Control the device from the app.

连接遇到问题?