arduino-azure-iot-edge-integration

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Arduino Azure IoT Edge Integration

Arduino与Azure IoT Edge集成

Use this skill when the user needs to connect Arduino-class devices to Azure IoT, especially in edge-heavy scenarios (gateways, intermittent networks, offline buffering, and local actuation).
当用户需要将Arduino类设备连接到Azure IoT时,尤其是在边缘密集型场景(网关、间歇性网络、离线缓冲和本地驱动)下,可使用此技能。

When to use it

适用场景

Use this skill for requests such as:
  • "I want to connect Arduino sensors to Azure"
  • "How do I send MQTT telemetry to IoT Hub?"
  • "I need an edge gateway for field devices"
  • "I want cloud-to-device commands and OTA configuration updates"
此技能适用于以下需求:
  • "我想将Arduino传感器连接到Azure"
  • "如何向IoT Hub发送MQTT遥测数据?"
  • "我需要为现场设备搭建边缘网关"
  • "我想要实现云到设备的命令及OTA配置更新"

Mandatory documentation review

必看文档审查

Before recommending an IoT Edge topology or runtime behavior, review:
If documentation cannot be consulted, proceed with explicit assumptions and highlight them in a dedicated section.
在推荐IoT Edge拓扑结构或运行时行为之前,请先查阅:
若无法查阅文档,请基于明确假设推进工作,并在专门章节中突出说明这些假设。

Official Arduino references and best practices (required)

官方Arduino参考资料与最佳实践(必填)

Before proposing firmware, wiring, or communication implementation details, consult official Arduino sources first:
When choosing between implementation alternatives, prioritize official Arduino guidance over community snippets unless there is a clear technical reason to deviate.
在提出固件、接线或通信实现细节之前,请优先查阅官方Arduino资源:
在选择实现方案时,除非有明确的技术理由,否则优先遵循官方Arduino指南,而非社区代码片段。

Objectives

目标

  • Produce a secure end-to-end reference path from the Arduino device to cloud insights.
  • Handle unstable links (store-and-forward, retries, idempotency).
  • Define an actionable device and cloud backlog.
  • 构建从Arduino设备到云端分析的端到端安全参考路径。
  • 处理不稳定连接(存储转发、重试、幂等性)。
  • 定义可落地的设备与云端待办事项。

Integration patterns

集成模式

Pattern A: Arduino direct to IoT Hub

模式A:Arduino直接连接IoT Hub

Use when connectivity is stable and cloud latency is acceptable.
  • Protocol: MQTT over TLS.
  • Identity: per-device credentials (SAS or X.509).
  • Telemetry payload: compact JSON with timestamp, device ID, metrics, and optional quality flags.
适用于连接稳定且云延迟可接受的场景。
  • 协议:基于TLS的MQTT。
  • 身份认证:每设备独立凭证(SAS或X.509)。
  • 遥测负载:包含时间戳、设备ID、指标及可选质量标记的紧凑JSON。

Pattern B: Arduino to local gateway, then IoT Edge

模式B:Arduino连接本地网关,再接入IoT Edge

Use when links are constrained, local control is required, or batching improves cost/reliability.
  • Arduino communicates with a local gateway (serial, BLE, local MQTT, RS-485, Modbus bridge).
  • The gateway publishes upstream through the IoT Edge runtime and routes data to IoT Hub.
  • Local modules can filter, aggregate, and trigger actions even during cloud outages.
适用于连接受限、需要本地控制,或批量处理可提升成本/可靠性的场景。
  • Arduino通过串行、BLE、本地MQTT、RS-485、Modbus桥接与本地网关通信。
  • 网关通过IoT Edge运行时向上游发送数据,并将路由至IoT Hub。
  • 本地模块可在云中断时仍进行过滤、聚合并触发操作。

Design flow

设计流程

1) Device contract

1) 设备契约

Define:
  • Sensor catalog and units.
  • Sampling frequency and expected throughput.
  • Message schema versioning strategy.
  • Desired/reported device twin properties to control runtime behavior.
定义:
  • 传感器目录及单位。
  • 采样频率与预期吞吐量。
  • 消息架构版本化策略。
  • 用于控制运行时行为的期望/上报设备孪生属性。

2) Security baseline

2) 安全基线

Require:
  • Unique identity per device.
  • No hardcoded secrets in source code or firmware artifacts.
  • Credential rotation strategy.
  • Signed firmware and a controlled update process when possible.
要求:
  • 每设备唯一身份。
  • 源代码或固件工件中不得硬编码密钥。
  • 凭证轮换策略。
  • 尽可能采用签名固件及受控更新流程。

3) Reliability and offline behavior

3) 可靠性与离线行为

Plan and document:
  • Backoff with jitter.
  • Local queue/buffer strategy with bounded size.
  • Duplicate suppression or downstream idempotent processing.
  • Fallback to last-known-good configuration.
规划并记录:
  • 带抖动的退避机制。
  • 有限大小的本地队列/缓冲策略。
  • 重复数据抑制或下游幂等处理。
  • 回退至已知最优配置。

4) Cloud and edge routing

4) 云端与边缘路由

Define routes for:
  • Raw telemetry to cold storage.
  • Curated telemetry to hot analytics.
  • Alerts to operations channels.
  • Commands and configuration back to edge/device.
定义以下路由:
  • 原始遥测至冷存储。
  • 整理后的遥测至热分析系统。
  • 告警至运维渠道。
  • 命令与配置下发至边缘/设备。

5) Observability

5) 可观测性

Specify minimum operations telemetry:
  • Device heartbeat and firmware version.
  • Connectivity state transitions.
  • Message send success/error counters.
  • Gateway module health and restart reasons.
指定最低运维遥测要求:
  • 设备心跳与固件版本。
  • 连接状态转换。
  • 消息发送成功/错误计数器。
  • 网关模块健康状态与重启原因。

Reuse other skills

复用其他技能

When relevant, combine with:
  • azure-smart-city-iot-solution-builder
    for city-wide architecture and phased rollout.
  • azure-resource-visualizer
    for relationship diagrams.
  • appinsights-instrumentation
    for app and service telemetry patterns.
Also use
references/arduino-official-best-practices.md
as a quality baseline for firmware and hardware recommendations.
相关场景下,可结合使用:
  • azure-smart-city-iot-solution-builder
    :用于城市级架构设计与分阶段部署。
  • azure-resource-visualizer
    :用于生成关系图。
  • appinsights-instrumentation
    :用于应用与服务遥测模式。
同时,将
references/arduino-official-best-practices.md
作为固件与硬件推荐的质量基准。

Required output

必输输出内容

Always provide:
  1. Chosen connectivity pattern and rationale.
  2. Message contract (fields, units, sample payload).
  3. Security checklist for identity/credentials/updates.
  4. Reliability plan (retry, buffering, dedupe).
  5. Implementation backlog (firmware, gateway, cloud).
需始终提供:
  1. 所选连接模式及理由。
  2. 消息契约(字段、单位、示例负载)。
  3. 身份/凭证/更新的安全检查清单。
  4. 可靠性方案(重试、缓冲、去重)。
  5. 实现待办事项(固件、网关、云端)。

Output template

输出模板

  1. Scenario and assumptions
  2. Recommended architecture
  3. Device and gateway contract
  4. Security and reliability controls
  5. Deployment plan and validation tests
  1. 场景与假设
  2. 推荐架构
  3. 设备与网关契约
  4. 安全与可靠性控制措施
  5. 部署计划与验证测试

Guidelines

指南

  • Do not propose production deployments with shared credentials across devices.
  • Do not assume always-on connectivity in field deployments.
  • Do not omit command authorization and auditing in actuator scenarios.
  • 不得提出跨设备共享凭证的生产部署方案。
  • 现场部署场景下,不得假设始终在线连接。
  • 驱动场景下,不得省略命令授权与审计。