Thread 边界路由器
| 技术方案 | Classic |
|---|---|
| 应用场景 | 家电与控制 |
本示例演示了如何构建集成 ESP RainMaker 的 Thread 边界路由器,使 Thread Mesh 网络能够接入 Wi-Fi 和互联网,并通过 RainMaker 提供云端的设备管理功能。边界路由器充当 Thread 设备与 IP 网络之间的桥梁。
概览
| 处理器 | ESP32-S3 + ESP32-H2 |
|---|---|
| 连接方式 | Wi-Fi + Thread + BLE |
| 供电电压 | 3.3V |
| IDF 版本 | ESP-IDF v5.x 及以上版本 |
可体验的功能
- Thread 网络管理: 管理 Thread Mesh 网络的组建、Thread 设备的配网,以及 Thread 网络与 IP 网络之间的路由。
- Wi-Fi 与 Thread 桥接: 在 Thread Mesh 网络与 Wi-Fi/互联网之间建立连接桥梁,支持从外部访问 Thread 设备。
- ESP RainMaker 云端集成: 集成 ESP RainMaker 云端,支持对边界路由器进行远程监控、配置和 OTA 升级。
- Thread 网络配网: 支持 Thread 网络配网协议,可将 Thread 设备安全接入 Mesh 网络。
- IPv6 路由: 处理 Thread Mesh 网络与外部 IP 网络之间的 IPv6 路由,维持网络连接与地址分配。
在真实开发板上体验
从乐鑫或其授权分销商购买官方开发板,然后直接在本页烧录此示例。 选购乐鑫开发板
烧录并体验
选择部署
公共部署
由乐鑫托管,供评估使用。免费,无需任何部署。
设备设置说明
1. 准备工作
- Linux、macOS 或 Windows 电脑。
- ESP Thread 边界路由器开发板。
- USB Type-C 数据线。
2. 连接设备
- 使用 USB 数据线将设备连接到电脑,然后点击终端上方左上角的
连接按钮。 - 选择正确的串口,然后点击
连接。 - 连接成功后,即可开始烧录设备。
3. 烧录设备
- 点击终端上方的
烧录设备,选择 擦除并烧录。等待erase_flash擦除过程完成后,再写入固件。 - 等待固件烧录完成。
- 点击
复位按钮复位设备。 - 看到 Thread 边界路由器初始化日志,即表示烧录成功。
4. 配置网络和 RainMaker
- 点击此处下载最新版 ESP RainMaker 手机 App。
- 使用 ESP RainMaker App 为边界路由器配网,将其接入 Wi-Fi 网络。
- 通过 RainMaker 界面配置 Thread 网络参数。
私有部署
您自己的 ESP RainMaker Classic 部署。请通过 Admin CLI 注册节点,而非 Dashboard。
- Register: With the ESP RainMaker Admin CLI, generate device certificates and register them with node_certs.csv.
- Load credentials: Zip the CLI batch folder (Mfg-…) or pick one node's .bin from its bin/ folder, and drop it into Device credentials.
- Flash: Write the firmware and the credentials in one pass. The board resets when done.
- 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
- A private ESP RainMaker Classic deployment (you need its deployment base URL and super-admin email from setup).
- The ESP RainMaker Admin CLI installed on your computer (esp-rainmaker-admin-cli).
- An ESP32-family DevKit that matches this example, a USB data cable, and Chrome or Edge.
2. Generate and register device certificates
- 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>
- 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>
- 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
- Save the
request_idfrom the register command and check status when needed:python rainmaker_admin_cli.py certs devicecert getcertstatus --requestid <request_id>
- The output holds private keys. Keep it out of chats and repositories, and delete it when you are done.
3. Load the device credentials
- From the Admin CLI output folder, zip the
Mfg-<no>batch folder, or pick onebin/node-….binfile. - Drop that ZIP or
.binonto Device credentials above the console. It is read in your browser and never uploaded. - 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.
- The credentials are flashed at
0x3FA000, where this example keeps itsfctrypartition.
4. Connect and flash
- Connect the board over USB, click
Connectabove the console and pick its port. - Click
Flash Deviceand choose Erase, then flash firmware + credentials. The firmware image goes to0x0and the credentials to0x3FA000in one pass, so the erase cannot wipe them. - The board resets when flashing is done. Type
get-node-idin the console when the firmware supports it: it prints the node you picked. - 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.
- To reflash only the firmware, choose Flash only. The credentials on the board are kept.
5. Sign in on your deployment
- 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).
- You can also use the ESP RainMaker phone app (iOS / Android); point it at the same deployment if your build supports a custom endpoint.
- 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
- Tap
+, choose I do not have a QR code, then Bluetooth. - In Chrome's Bluetooth window, pick the device whose name matches the one in the console, for example
PROV_ff7bf2. - Enter the PoP when asked. It is the
"pop"value in theQRCODE:line of the console, for example{"ver":"v1","name":"PROV_xxxxxx","pop":"xxxxxxxx","transport":"ble"}. - Pick your Wi-Fi network, enter its password and wait for provisioning to finish. The device then appears under My Devices.
- Control the device from the app.
连接遇到问题?
- 确保设备已通过 USB 正确连接
- 检查是否已安装正确的驱动程序
- 尝试更换 USB 端口或数据线
- 确认设备已进入烧录模式
- 点击此处获取最新版 ESP RainMaker 手机 App