$npx -y skills add github/awesome-copilot --skill arduino-azure-iot-edge-integrationDesign and implement Arduino integration with Azure IoT Hub and IoT Edge, including secure provisioning, resilient telemetry, command handling, and production guardrails.
| 1 | # Arduino Azure IoT Edge Integration |
| 2 | |
| 3 | 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). |
| 4 | |
| 5 | ## When to use it |
| 6 | |
| 7 | Use this skill for requests such as: |
| 8 | |
| 9 | - "I want to connect Arduino sensors to Azure" |
| 10 | - "How do I send MQTT telemetry to IoT Hub?" |
| 11 | - "I need an edge gateway for field devices" |
| 12 | - "I want cloud-to-device commands and OTA configuration updates" |
| 13 | |
| 14 | ## Mandatory documentation review |
| 15 | |
| 16 | Before recommending an IoT Edge topology or runtime behavior, review: |
| 17 | |
| 18 | - https://learn.microsoft.com/azure/iot-edge/ |
| 19 | |
| 20 | If documentation cannot be consulted, proceed with explicit assumptions and highlight them in a dedicated section. |
| 21 | |
| 22 | ## Official Arduino references and best practices (required) |
| 23 | |
| 24 | Before proposing firmware, wiring, or communication implementation details, consult official Arduino sources first: |
| 25 | |
| 26 | - https://www.arduino.cc/en/Guide |
| 27 | - https://docs.arduino.cc/ |
| 28 | - https://docs.arduino.cc/language-reference/ |
| 29 | - references/arduino-official-best-practices.md |
| 30 | |
| 31 | When choosing between implementation alternatives, prioritize official Arduino guidance over community snippets unless there is a clear technical reason to deviate. |
| 32 | |
| 33 | ## Objectives |
| 34 | |
| 35 | - Produce a secure end-to-end reference path from the Arduino device to cloud insights. |
| 36 | - Handle unstable links (store-and-forward, retries, idempotency). |
| 37 | - Define an actionable device and cloud backlog. |
| 38 | |
| 39 | ## Integration patterns |
| 40 | |
| 41 | ### Pattern A: Arduino direct to IoT Hub |
| 42 | |
| 43 | Use when connectivity is stable and cloud latency is acceptable. |
| 44 | |
| 45 | - Protocol: MQTT over TLS. |
| 46 | - Identity: per-device credentials (SAS or X.509). |
| 47 | - Telemetry payload: compact JSON with timestamp, device ID, metrics, and optional quality flags. |
| 48 | |
| 49 | ### Pattern B: Arduino to local gateway, then IoT Edge |
| 50 | |
| 51 | Use when links are constrained, local control is required, or batching improves cost/reliability. |
| 52 | |
| 53 | - Arduino communicates with a local gateway (serial, BLE, local MQTT, RS-485, Modbus bridge). |
| 54 | - The gateway publishes upstream through the IoT Edge runtime and routes data to IoT Hub. |
| 55 | - Local modules can filter, aggregate, and trigger actions even during cloud outages. |
| 56 | |
| 57 | ## Design flow |
| 58 | |
| 59 | ### 1) Device contract |
| 60 | |
| 61 | Define: |
| 62 | |
| 63 | - Sensor catalog and units. |
| 64 | - Sampling frequency and expected throughput. |
| 65 | - Message schema versioning strategy. |
| 66 | - Desired/reported device twin properties to control runtime behavior. |
| 67 | |
| 68 | ### 2) Security baseline |
| 69 | |
| 70 | Require: |
| 71 | |
| 72 | - Unique identity per device. |
| 73 | - No hardcoded secrets in source code or firmware artifacts. |
| 74 | - Credential rotation strategy. |
| 75 | - Signed firmware and a controlled update process when possible. |
| 76 | |
| 77 | ### 3) Reliability and offline behavior |
| 78 | |
| 79 | Plan and document: |
| 80 | |
| 81 | - Backoff with jitter. |
| 82 | - Local queue/buffer strategy with bounded size. |
| 83 | - Duplicate suppression or downstream idempotent processing. |
| 84 | - Fallback to last-known-good configuration. |
| 85 | |
| 86 | ### 4) Cloud and edge routing |
| 87 | |
| 88 | Define routes for: |
| 89 | |
| 90 | - Raw telemetry to cold storage. |
| 91 | - Curated telemetry to hot analytics. |
| 92 | - Alerts to operations channels. |
| 93 | - Commands and configuration back to edge/device. |
| 94 | |
| 95 | ### 5) Observability |
| 96 | |
| 97 | Specify minimum operations telemetry: |
| 98 | |
| 99 | - Device heartbeat and firmware version. |
| 100 | - Connectivity state transitions. |
| 101 | - Message send success/error counters. |
| 102 | - Gateway module health and restart reasons. |
| 103 | |
| 104 | ## Reuse other skills |
| 105 | |
| 106 | When relevant, combine with: |
| 107 | |
| 108 | - `azure-smart-city-iot-solution-builder` for city-wide architecture and phased rollout. |
| 109 | - `azure-resource-visualizer` for relationship diagrams. |
| 110 | - `appinsights-instrumentation` for app and service telemetry patterns. |
| 111 | |
| 112 | Also use `references/arduino-official-best-practices.md` as a quality baseline for firmware and hardware recommendations. |
| 113 | |
| 114 | ## Required output |
| 115 | |
| 116 | Always provide: |
| 117 | |
| 118 | 1. Chosen connectivity pattern and rationale. |
| 119 | 2. Message contract (fields, units, sample payload). |
| 120 | 3. Security checklist for identity/credentials/updates. |
| 121 | 4. Reliability plan (retry, buffering, dedupe). |
| 122 | 5. Implementation backlog (firmware, gateway, cloud). |
| 123 | |
| 124 | ## Output template |
| 125 | |
| 126 | 1. Scenario and assumptions |
| 127 | 2. Recommended architecture |
| 128 | 3. Device and gateway contract |
| 129 | 4. Security and reliability controls |
| 130 | 5. Deployment plan and validation tests |
| 131 | |
| 132 | ## Guidelines |
| 133 | |
| 134 | - Do not propose production deployments with shared credentials across devices. |
| 135 | - Do not assume always-on connectivity in field deployments. |
| 136 | - Do not omit command authorization and auditing in actuator scenarios. |