[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AN7DWM3CP4VD14P311VD02":3,"skill-same:01M7AN7DWM3CP4VD14P311VD02":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7AN7DWM3CP4VD14P311VD02","embedded-industrial-control-connectivity-and-cloud",null,"Use when working on OT\u002Findustrial control or connected-device systems: the PLC scan cycle, IEC 61131-3 languages, fieldbus and industrial protocols (Modbus, PROFINET, EtherCAT), OPC UA vs MQTT\u002FSparkplug and the unified namespace, Purdue\u002FISA-95 and the IT\u002FOT boundary, TSN; PID done correctly, beyond PID, and motor control; choosing a radio, BLE, Thread and Matter, LoRaWAN, cellular, the application protocols (MQTT, CoAP), edge computing and TinyML; and the cloud, fleet, and lifecycle layer — the platform landscape, identity and provisioning, OTA update, and fleet observability.","the-vibey-project\u002Fvibey","the-vibey-project","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F329298758?v=4","01M7AJHGZ9722CTJ4JNQZVRH0Q","the vibey project","01M7AJHGZVMG2K7TGXQ6XFHVG3",5,"MIT","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fembedded-iot-controls\u002Fskills\u002Fembedded-industrial-control-connectivity-and-cloud\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: embedded-industrial-control-connectivity-and-cloud\ndescription: \"Use when working on OT\u002Findustrial control or connected-device systems: the PLC scan cycle, IEC 61131-3 languages, fieldbus and industrial protocols (Modbus, PROFINET, EtherCAT), OPC UA vs MQTT\u002FSparkplug and the unified namespace, Purdue\u002FISA-95 and the IT\u002FOT boundary, TSN; PID done correctly, beyond PID, and motor control; choosing a radio, BLE, Thread and Matter, LoRaWAN, cellular, the application protocols (MQTT, CoAP), edge computing and TinyML; and the cloud, fleet, and lifecycle layer — the platform landscape, identity and provisioning, OTA update, and fleet observability.\"\n---\n\n# Embedded & IoT: Industrial Control, Control Theory, Connectivity, and Fleet Lifecycle\n\n> **Part 3 of 5** of the *Embedded Systems & IoT Controls — Deep Technical Reference* reference (plugin `embedded-iot-controls`), covering §6–§9. Sibling skills: `embedded-silicon-and-firmware-models` (§0–§2), `embedded-languages-realtime-and-patterns` (§3–§5), `embedded-security-safety-and-testing` (§10–§13), `embedded-reference` (§14–§19). Section numbers are shared across the set; a reference written as §N → `skill` points into that sibling skill.\n>\n> **Currency:** Verified August 2026. See §17 → `embedded-reference` for the currency snapshot and what goes stale first.\n\n> **How to read this.** This is a reference, not a tutorial. Sections are independent.\n> Three markers appear throughout:\n> - **[UNIVERSAL]** — physics, math, or architecture. True regardless of vendor. Trust it.\n> - **[VENDOR]** — specific to a chip, SDK, or toolchain. Verify against the datasheet\u002Ferrata.\n> - **[CONTESTED]** — competent engineers disagree. Both cases are presented. Do not pick a side on the reader's behalf.\n>\n> **⚠️ GOTCHA** boxes mark the failure modes that actually burn people. They are the\n> highest-value content in this document.\n\n---\n\n## §6. Industrial Control and OT\n\n### 6.1 The PLC scan cycle [UNIVERSAL]\n\n```\n┌──> 1. INPUT SCAN     — snapshot ALL physical inputs into the input image table\n│    2. PROGRAM EXEC   — logic runs against the SNAPSHOT, writes to output image\n│    3. OUTPUT SCAN    — write output image to physical outputs, atomically\n│    4. HOUSEKEEPING   — comms, diagnostics, watchdog\n└────┘  repeat; scan time typically 1–50 ms\n```\n**Why the image tables matter**: within one scan, an input cannot change. This gives\ndeterministic, race-free logic and is the reason ladder logic is safely writable by people\nwho are not software engineers. It also means **your effective input latency is up to 2\nscan times**, and that a fast physical event shorter than one scan is *invisible* unless\nyou use a high-speed counter or interrupt-driven I\u002FO module.\n\n**Scan-time discipline**: the scan watchdog trips if a scan exceeds its limit. Long `FOR`\nloops, blocking communications, and unbounded string operations in Structured Text are the\nusual culprits.\n\n### 6.2 IEC 61131-3 languages\n\n| Language | Form | Best for | Notes |\n|---|---|---|---|\n| **LD** Ladder Diagram | Relay-logic rungs | Discrete\u002Finterlock logic, plant-maintainable | Universal in North America |\n| **FBD** Function Block Diagram | Wired blocks | Signal flow, process control, analog chains | Dominant in process industry |\n| **ST** Structured Text | Pascal-like text | Math, algorithms, loops, string handling | Where real software engineering happens |\n| **SFC** Sequential Function Chart | Steps + transitions | Batch, sequence, start\u002Fstop procedures | Maps to Grafcet; great for sequences |\n| **IL** Instruction List | Assembly-like | — | **Deprecated in IEC 61131-3 3rd edition** |\n\n**IEC 61499** is the distributed-control successor (event-driven function blocks across\ndevices), academically influential, commercially niche. **PLCopen** publishes the\nmotion-control function block standard (`MC_MoveAbsolute`, `MC_Power`, …) and the safety\nfunction block set — these matter because they make motion code portable across vendors.\n\n**Structured Text idioms worth knowing:**\n```pascal\n(* Edge detection — R_TRIG\u002FF_TRIG are standard function blocks *)\nVAR\n    rStart   : R_TRIG;\n    tonDelay : TON;\nEND_VAR\n\nrStart(CLK := xStartButton);\nIF rStart.Q THEN                      (* rising edge only, once per press *)\n    eState := STARTING;\nEND_IF\n\n(* Timers are function block INSTANCES with state — never re-declare inside a loop *)\ntonDelay(IN := (eState = STARTING), PT := T#3S);\nIF tonDelay.Q THEN\n    eState := RUNNING;\nEND_IF\n```\n> **⚠️ GOTCHA — retentive vs non-retentive variables.** `VAR RETAIN` survives a warm\n> restart; `VAR PERSISTENT` survives a cold restart\u002Fdownload (vendor semantics vary!).\n> Getting this wrong means a machine restarts mid-cycle in an unsafe state after a power\n> blip. It is one of the most consequential and least-documented distinctions in PLC work.\n\n### 6.3 Fieldbus and industrial protocols\n\n| Protocol | Layer | Determinism | Typical cycle | Notes |\n|---|---|---|---|---|\n| **Modbus RTU** | RS-485 serial | poll-only | 10–100 ms | Trivial, ubiquitous, no security, no timestamps |\n| **Modbus TCP** | Ethernet | poll-only | 5–50 ms | Same data model over TCP\u002F502 |\n| **PROFIBUS DP** | RS-485 | token\u002Fmaster-slave | 1–10 ms | Legacy but enormous installed base |\n| **PROFINET RT \u002F IRT** | Ethernet | RT: soft; IRT: hard (µs) | 1–10 ms \u002F \u003C1 ms | Siemens-dominant |\n| **EtherNet\u002FIP (CIP)** | Ethernet | implicit I\u002FO w\u002F RPI | 1–10 ms | Rockwell-dominant |\n| **EtherCAT** | Ethernet (special) | **hard, \u003C100 µs, jitter \u003C1 µs** | 50 µs–1 ms | Frame processed **on the fly** by each slave; distributed clocks |\n| **CANopen** | CAN | event + sync | 1–10 ms | Object dictionary, PDO\u002FSDO, NMT state machine |\n| **IO-Link** | Point-to-point 3-wire | ~2.3 ms cycle | — | Sensor-level; carries parameters + diagnostics, not just a signal |\n| **BACnet** | IP\u002FMSTP | none | seconds | Building automation |\n| **DNP3 \u002F IEC 61850** | IP\u002Fserial | GOOSE: \u003C4 ms | — | Utilities\u002Fsubstation; 61850 GOOSE is multicast, safety-relevant |\n| **OPC UA** | TCP\u002FHTTPS\u002FMQTT | not RT (except over TSN) | 50 ms+ | **Information model**, security, discovery |\n\n**EtherCAT's trick, because it explains why it's fast**: the master sends one frame that\ntravels the ring; each slave reads its output data and writes its input data **into the\npassing frame in hardware** as it goes by, with ~1 µs of propagation delay per node. There\nis no per-node packet, no switching latency, and no software stack in the loop.\nDistributed Clocks then synchronize all nodes to \u003C1 µs, which is what makes coordinated\nmulti-axis motion possible.\n\n**Modbus register model — the endianness trap [VENDOR chaos, UNIVERSAL pain]:**\n```\nData model (all 16-bit addressed, 0-based on the wire, 1-based in docs — the classic\noff-by-one):\n  Coils              (FC 01 read \u002F 05,15 write)   1-bit  R\u002FW   4x0001-style: 0xxxx\n  Discrete Inputs    (FC 02 read)                 1-bit  R     1xxxx\n  Input Registers    (FC 04 read)                16-bit  R     3xxxx\n  Holding Registers  (FC 03 read \u002F 06,16 write)  16-bit  R\u002FW   4xxxx\n\nA 32-bit float spans TWO registers. There is NO standard for the order. In the wild:\n  ABCD  big-endian           (most common, \"big-endian word, big-endian byte\")\n  CDAB  big-endian byte swap (\"word-swapped\" — extremely common on legacy drives)\n  BADC  little-endian byte swap\n  DCBA  little-endian\n```\n**⚠️ GOTCHA:** if a value reads as a plausible-but-wrong number (e.g. 3.6e-38 instead of\n25.4), you have a word-order mismatch. Always make word order a *configuration* item in\nyour Modbus client, never a hard-coded assumption. Document your device's choice in the\nregister map and publish it — the vendors who don't are the reason integrators hate them.\n\n**A register map convention that saves integrators' lives:**\n```\n| Addr | Type | Fmt   | Access | Scale | Unit  | Name              | Notes                |\n|------|------|-------|--------|-------|-------|-------------------|----------------------|\n| 4001 | u16  | -     | R      | 1     | -     | device_id         | 0x1234 constant      |\n| 4002 | u16  | -     | R      | 1     | -     | fw_version        | BCD major.minor      |\n| 4010 | i32  | ABCD  | R      | 0.001 | °C    | temperature       | -40..125             |\n| 4012 | f32  | ABCD  | R      | 1     | kPa   | pressure          | NaN = sensor fault   |\n| 4100 | u16  | bits  | R\u002FW    | 1     | -     | control_word      | b0=run, b1=reset     |\n| 4200 | u16  | -     | R      | 1     | -     | fault_code        | see appendix         |\n```\nPublish the scale, the unit, the invalid-value sentinel, and the word format for every\npoint. That table is the actual product for anyone integrating your device.\n\n### 6.4 OPC UA vs MQTT\u002FSparkplug — the live architectural debate\n\n**[CONTESTED]** and the most consequential IIoT architecture question right now.\n\n- **OPC UA** is an *information model* first: address space, typed nodes, methods,\n  historical access, alarms & conditions, built-in security (X.509, signing, encryption),\n  and **companion specifications** that standardize semantics per industry (machine tools,\n  robotics, pumps, packaging). Client\u002Fserver is the mature, widely-implemented mode.\n  **OPC UA PubSub (Part 14)** exists in the spec but adoption remains limited relative to\n  client\u002Fserver as of 2026; treat claims of ubiquitous PubSub with scepticism.\n- **MQTT** is a *transport*: publish\u002Fsubscribe, tiny, offline-tolerant, brokered, with no\n  opinion whatsoever about payload or topic structure. That freedom becomes topic-tree\n  chaos at scale.\n- **Sparkplug B** layers the missing OT semantics onto MQTT: a mandated topic namespace\n  `spBv1.0\u002F{group}\u002F{msg_type}\u002F{edge_node}\u002F{device}`, Protobuf payloads with typed metrics\n  and timestamps, and **birth\u002Fdeath certificates** (NBIRTH\u002FDBIRTH announce the full metric\n  set; NDEATH via MQTT Last Will marks a node offline) giving stateful,\n  report-by-exception operation without polling.\n- **The mainstream 2026 architecture** is not either\u002For: **OPC UA at the machine (the PLC\n  exposes companion-spec-modelled data) → edge gateway translates → MQTT\u002FSparkplug B to a\n  broker → Unified Namespace consumed by MES, historian, analytics, and cloud.** OPC UA\n  supplies meaning; MQTT supplies distribution.\n- **Sparkplug's real trade-off**: it deliberately forgoes MQTT retained messages and uses\n  QoS 0 for DDATA in favour of deterministic state via birth\u002Fdeath. That is a *feature*\n  for OT state management and a *limitation* if you need guaranteed delivery of every\n  sample. Know which you need.\n\n**Unified Namespace (UNS)** is the architectural idea that there should be exactly one\nreal-time, hierarchically-organized, event-driven source of truth for the whole\nenterprise's current state — typically an MQTT broker with an ISA-95-shaped topic tree\n(`enterprise\u002Fsite\u002Farea\u002Fline\u002Fcell\u002F...`) — that every system publishes to and subscribes\nfrom, replacing point-to-point integrations. It is genuinely transformative when done\nwell and a mess when the topic namespace isn't designed up front by one owner.\n\n### 6.5 Purdue model \u002F ISA-95 and the IT\u002FOT boundary\n\n```\nLevel 5  Enterprise (ERP)                        ─┐\nLevel 4  Site business planning (MES\u002FERP edge)    │ IT\n─────────────────────── DMZ ──────────────────────┤ ← the boundary that matters\nLevel 3  Site operations (historian, MES, OPC)   ─┤\nLevel 2  Supervisory (SCADA, HMI)                 │ OT\nLevel 1  Control (PLC, DCS, safety PLC)           │\nLevel 0  Process (sensors, actuators)            ─┘\n```\n**[UNIVERSAL] OT inverts the CIA triad.** IT prioritizes Confidentiality → Integrity →\nAvailability. OT prioritizes **Safety → Availability → Integrity → Confidentiality**. A\ncontrol that \"fails secure\" by locking out an operator during a process upset can turn a\ndeviation into an incident. This single inversion explains most IT\u002FOT friction.\n\n**Practical boundary controls**: an industrial DMZ with no direct L3→L4 protocol\ntraversal, replicated historians rather than direct database access, **unidirectional\ngateways \u002F data diodes** where the risk justifies it, and jump hosts with session\nrecording for vendor access. Colonial Pipeline is the reference lesson on why the *billing\nside* being compromised can stop the *operational* side (§16 → `embedded-reference`).\n\n### 6.6 Time-Sensitive Networking (TSN)\n\nStandard Ethernet is non-deterministic (queuing, bursts). TSN is a set of IEEE 802.1\namendments that make it deterministic while keeping standard hardware:\n- **802.1AS** — generalized PTP time synchronization (sub-µs across the network).\n- **802.1Qbv** — time-aware shaper: gated transmission windows per traffic class. This is\n  the core scheduling mechanism.\n- **802.1Qbu \u002F 802.3br** — frame preemption: a high-priority frame interrupts a\n  best-effort frame mid-transmission.\n- **802.1Qci** — per-stream filtering and policing (protects against a babbling node).\n- **802.1CB** — frame replication and elimination for reliability (seamless redundancy).\n\n**OPC UA over TSN** is the \"converged network\" vision: one Ethernet infrastructure\ncarrying deterministic control traffic and IT traffic. Real, deployed in automotive and\nsome machine builders; still expensive and integration-heavy for general industry.\n\n---\n\n## §7. Control Theory as Practiced in Firmware\n\n### 7.1 PID done correctly\n\nTextbook PID is three lines. Production PID is thirty, and the extra twenty-seven are\nwhere the engineering lives.\n\n```c\ntypedef struct {\n    float kp, ki, kd;\n    float dt;              \u002F* FIXED sample period, seconds — see note below *\u002F\n    float integral;\n    float prev_meas;       \u002F* derivative on MEASUREMENT, not error *\u002F\n    float d_filt;          \u002F* filtered derivative state *\u002F\n    float tau;             \u002F* derivative low-pass time constant, seconds *\u002F\n    float out_min, out_max;\n    bool  first_run;\n} pid_t;\n\nfloat pid_update(pid_t *p, float setpoint, float meas) {\n    float error = setpoint - meas;\n\n    \u002F* ---- Proportional ---- *\u002F\n    float P = p->kp * error;\n\n    \u002F* ---- Derivative on measurement (kills SETPOINT KICK) ----\n       d\u002Fdt(error) spikes to infinity on a setpoint step. d\u002Fdt(measurement) does not.\n       Sign flips because d(sp - meas)\u002Fdt = -d(meas)\u002Fdt for constant sp.            *\u002F\n    if (p->first_run) { p->prev_meas = meas; p->d_filt = 0.0f; p->first_run = false; }\n    float raw_d = -(meas - p->prev_meas) \u002F p->dt;\n    p->prev_meas = meas;\n\n    \u002F* ---- Filter the derivative (MANDATORY on any real sensor) ----\n       Unfiltered D amplifies sensor noise by kd\u002Fdt. First-order LPF: *\u002F\n    float alpha = p->dt \u002F (p->tau + p->dt);\n    p->d_filt  += alpha * (raw_d - p->d_filt);\n    float D = p->kd * p->d_filt;\n\n    \u002F* ---- Integral with CONDITIONAL INTEGRATION anti-windup ----\n       Compute the unsaturated output first; only integrate if we are not saturated\n       in the direction that would make saturation worse.                          *\u002F\n    float I_candidate = p->integral + p->ki * error * p->dt;\n    float u_unsat     = P + I_candidate + D;\n\n    bool saturating_high = (u_unsat > p->out_max) && (error > 0.0f);\n    bool saturating_low  = (u_unsat \u003C p->out_min) && (error \u003C 0.0f);\n    if (!saturating_high && !saturating_low) {\n        p->integral = I_candidate;             \u002F* only then commit *\u002F\n    }\n\n    float u = P + p->integral + D;\n\n    \u002F* ---- Saturate ---- *\u002F\n    if (u > p->out_max) u = p->out_max;\n    if (u \u003C p->out_min) u = p->out_min;\n    return u;\n}\n\n\u002F* Bumpless transfer: when switching manual→auto, back-calculate the integral so the\n   output does not jump. *\u002F\nvoid pid_set_auto(pid_t *p, float current_output, float setpoint, float meas) {\n    p->integral  = current_output - p->kp * (setpoint - meas);\n    p->prev_meas = meas;\n    p->d_filt    = 0.0f;\n    p->first_run = false;\n}\n```\n\n**The five PID mistakes that cause ~90% of field problems:**\n1. **No anti-windup** — integrator charges while the actuator is saturated; the system\n   massively overshoots when it comes off the limit. This is the #1 issue.\n2. **Derivative on error** — setpoint changes produce a huge output spike (\"derivative\n   kick\").\n3. **Unfiltered derivative** — sensor noise × kd\u002Fdt drives the actuator into chatter.\n4. **Variable `dt`** — computing `dt` from a timestamp each call means gain varies with\n   jitter. Run the loop from a **hardware timer interrupt at a fixed rate** and treat `dt`\n   as a constant. If you must handle variable dt, the math still works but tuning becomes\n   unreliable.\n5. **Sample rate too slow** — rule of thumb: sample at **10–20× the closed-loop bandwidth**\n   you want. A 1 Hz process needs ≥10 Hz sampling; a current loop at 1 kHz bandwidth needs\n   10–20 kHz.\n\n**Tuning methods, ranked by practicality:**\n- **Lambda \u002F IMC tuning** — pick a desired closed-loop time constant λ; compute gains from\n  a first-order-plus-dead-time (FOPDT) model. Predictable, conservative, the process\n  industry default.\n- **Relay autotuning (Åström–Hägglund)** — drive the process with a relay, measure the\n  resulting limit cycle to find the ultimate gain and period, then apply tuning rules. The\n  basis of most \"autotune\" buttons.\n- **Cohen–Coon** — better than Ziegler–Nichols for dead-time-dominant processes.\n- **Ziegler–Nichols** — historically important, **aggressively underdamped** (~25%\n  overshoot by design). Use as a starting point, then detune. Don't ship Z-N gains.\n- **Manual**: increase Kp until sustained oscillation, back off to ~half; add Ki to remove\n  steady-state error; add Kd last and only if you have a clean sensor.\n\n**Fixed-point vs float**: on any Cortex-M4F\u002FM7\u002FM33 with an FPU, use `float`. Single-\nprecision add\u002Fmul is 1–3 cycles. On M0\u002FM0+ without an FPU, software float is 50–100+\ncycles and Q15\u002FQ31 fixed-point (with CMSIS-DSP) is the right answer — but watch overflow\nand be explicit about your scaling.\n\n### 7.2 Beyond PID\n\n- **Cascade control**: inner fast loop (e.g. motor current, 10 kHz) inside an outer slow\n  loop (position, 1 kHz) inside an outer-outer (temperature, 1 Hz). Each loop should be\n  **5–10× faster** than the one enclosing it. This is how nearly all real motion and\n  process control is structured, and it solves problems that no amount of single-loop\n  tuning will.\n- **Feedforward**: if you know the disturbance or the required steady-state effort, add it\n  directly. Feedback then only corrects the error. In motion control, velocity and\n  acceleration feedforward reduce following error by an order of magnitude.\n- **Dead time \u002F transport delay**: PID degrades badly when dead time approaches the\n  process time constant. **Smith predictor** uses a process model to control against a\n  delay-free prediction. Fragile to model error; use with care.\n- **State-space + observers**: for MIMO or when states aren't directly measurable. A\n  **Luenberger observer** estimates unmeasured states; a **Kalman filter** does it\n  optimally under Gaussian noise assumptions.\n- **Complementary filter**: the poor man's Kalman for IMU fusion, and often the right\n  choice on an M0: `angle = a*(angle + gyro*dt) + (1-a)*accel_angle`. Two lines, no matrix\n  math, and it captures the essential idea (trust the gyro short-term, the accelerometer\n  long-term).\n- **MPC at the edge**: real on Cortex-M7\u002FM33-class hardware for small problems (embedded\n  QP solvers like OSQP\u002FqpOASES). Worth it when constraints matter (thermal limits,\n  actuator limits) and a model exists.\n\n### 7.3 Motor control\n\n**Commutation methods** in order of complexity:\n1. **Six-step \u002F trapezoidal** (BLDC): switch phases based on Hall sensors. Simple, torque\n   ripple at commutation, adequate for fans\u002Fpumps.\n2. **Sinusoidal**: smoother, still no current regulation in the rotating frame.\n3. **FOC (Field-Oriented Control)**: the standard for anything requiring precision.\n\n**FOC in one paragraph**: measure two phase currents → **Clarke transform** (3-phase abc →\n2-axis stationary αβ) → **Park transform** (αβ → rotating dq frame, using rotor angle) →\nnow torque-producing current `iq` and flux-producing current `id` are **DC quantities**,\nso two simple PI loops regulate them → **inverse Park** → **Space Vector Modulation**\n(SVPWM, ~15% better DC bus utilization than sinusoidal PWM) → three PWM duty cycles.\n\n**Timing is everything**: the current loop runs at the PWM frequency (typically 10–20 kHz)\nand must complete within one PWM period. ADC sampling must be synchronized to the PWM —\nsample at the **centre of the PWM period** (when the low-side FETs are on and the current\nis at its average), triggered by the timer, not by software.\n\n**Rotor angle sources**: Hall sensors (60° resolution, cheap), incremental encoder\n(needs indexing), absolute encoder\u002Fresolver (expensive, no homing), or **sensorless**\n(back-EMF observer or high-frequency injection) — sensorless is free in BOM and expensive\nin engineering, and has a low-speed blind spot.\n\n> **⚠️ GOTCHA — dead time and its compensation.** Hardware dead time prevents\n> shoot-through, but it distorts the output voltage (the actual volt-seconds don't match\n> the commanded duty), producing torque ripple and current distortion at low speed. Dead-\n> time compensation (adding a sign-of-current-dependent correction to the duty) is standard\n> practice in production FOC and absent from most tutorials.\n\n---\n\n## §8. Connectivity\n\n### 8.1 Choosing a radio — the decision table\n\n| Tech | Range | Data rate | Power | Topology | Infra needed | Best for |\n|---|---|---|---|---|---|---|\n| **BLE** | 10–100 m | 0.125–2 Mbps | very low | star \u002F mesh | phone or gateway | Wearables, sensors, commissioning, local UI |\n| **Thread** | 10–30 m\u002Fhop, mesh | 250 kbps | low | **mesh, IPv6** | border router | Home\u002Fbuilding sensors; Matter's preferred transport |\n| **Zigbee** | similar | 250 kbps | low | mesh | coordinator | Legacy lighting\u002Fbuilding; Zigbee 4.0 recently released |\n| **Wi-Fi (2.4\u002F5)** | 30–100 m | 10s–100s Mbps | **high** | star | AP | Mains-powered, high bandwidth, camera |\n| **Wi-Fi HaLow (802.11ah)** | ~1 km | 150 kbps–8 Mbps | medium | star | AP | Sub-GHz IP, long range, moderate rate |\n| **LoRaWAN** | 2–15 km | 0.3–50 kbps | **very low** | star-of-stars | gateway + network server | Utility metering, agriculture, private LPWAN |\n| **NB-IoT** | cellular | ~30–100 kbps | very low | cellular | carrier | Deep-indoor static meters — **but check carrier support** |\n| **LTE-M (Cat-M1)** | cellular | ~300 kbps–1 Mbps | low | cellular | carrier | Mobile assets, voice-capable, best roaming |\n| **LTE Cat-1 \u002F Cat-1bis** | cellular | ~10 Mbps | medium | cellular | carrier | The safe global default in 2026 |\n| **5G RedCap \u002F eRedCap** | cellular | 10s Mbps | medium | cellular (SA) | carrier | Mid-tier 5G; ~30 operators in 21 countries as of early 2026 |\n| **UWB** | 10–50 m | — | medium | — | anchors | Centimetre ranging, secure access |\n| **Satellite NTN** | global | very low | medium | — | constellation | Remote assets; store-and-forward with small constellations |\n\n**Cellular reality check for 2026:**\n- **2G and 3G are sunset in most markets**; devices still on them need a migration path.\n- **NB-IoT has been a commercial underperformer outside China** and carrier support is\n  uneven — **AT&T shut down its NB-IoT network**; T-Mobile and Verizon have continued to\n  support theirs. Do not design a US product around NB-IoT without written carrier\n  confirmation.\n- **LTE-M leads on roaming**, which matters for anything that moves across borders.\n- **5G RedCap** module pricing and SA network coverage are still the gating factors;\n  broader availability is expected through 2027–28.\n- **eSIM\u002FeUICC, and specifically SGP.32** (the IoT-focused remote SIM provisioning spec\n  finalized in 2024), is now the default expectation for any fleet with a >5-year life or\n  multi-country deployment. Design it in; retrofitting carrier flexibility is impossible.\n\n**[UNIVERSAL] Battery-life reality**: the radio dominates. A BLE sensor advertising every\n1 s versus every 10 s is roughly a 10× difference in battery life, and no amount of MCU\nsleep optimization compensates for a badly chosen connection interval.\n\n### 8.2 BLE — the concepts you actually need\n\n- **GAP** = discovery and connection roles (Peripheral\u002FCentral, Broadcaster\u002FObserver).\n- **GATT** = the data model: Services contain Characteristics contain Values +\n  Descriptors, all addressed by 16-bit (SIG-assigned) or 128-bit (custom) UUIDs.\n- **Advertising interval** (20 ms–10.24 s) drives discovery latency and advertiser power.\n- **Connection interval** (7.5 ms–4 s, in 1.25 ms units) drives throughput and connected\n  power. **Slave latency** lets a peripheral skip N connection events when it has nothing\n  to say — this is the single most important BLE power parameter.\n- **PHYs**: 1M (default), 2M (double rate, shorter range), Coded S=2\u002FS=8 (long range, 4×\n  the airtime).\n- **MTU negotiation**: default ATT MTU is 23 bytes (20 bytes of payload). Negotiate up\n  (247 is common) or your throughput will be terrible for reasons that look like a bug.\n- **Notifications** (no ack, fast) vs **Indications** (acked, one outstanding, slow). Use\n  notifications for streaming.\n\n**Bluetooth Core versions [current as of 2026]**: 6.0 (Sept 2024) introduced **Channel\nSounding** — phase-based ranging + round-trip time giving decimetre-level secure ranging,\nusing 72×1 MHz channels, with ambiguity-free operation to ~150 m. 6.1 (May 2025) added\nrandomized RPA for privacy. 6.2 (Nov 2025) cut the minimum connection interval from\n**7.5 ms to 375 µs** (a big deal for HID and latency-sensitive sensors) and added\namplitude-attack resilience for Channel Sounding. **6.3 was released 6 May 2026**;\nthe SIG is on a twice-yearly cadence.\n\n### 8.3 Thread and Matter\n\n**Thread**: IPv6 mesh over 802.15.4, with Routers, End Devices, and Sleepy End Devices; a\n**Border Router** bridges to the local IP network. Self-healing, no single point of\nfailure, ~250 kbps.\n\n**Matter**: an *application layer* over IP (Thread, Wi-Fi, or Ethernet) with a Data Model\nof Endpoints → Clusters → Attributes\u002FCommands, commissioning via BLE, and a **Fabric**\nsecurity model with per-fabric operational certificates (a device can be on several\necosystems' fabrics simultaneously).\n\n**Current spec state**: **Matter 1.5** (Nov 2025) was the big functional expansion —\n**cameras** (WebRTC live A\u002FV, PTZ, detection\u002Fprivacy zones, STUN\u002FTURN remote access),\n**closures**, **soil sensors**, and expanded energy management; **1.5.1** (Mar 2026)\nrefined cameras\u002Fdoorbells; **1.6 is reported as the current release as of mid-2026**.\n1.4.1\u002F1.4.2 were quality\u002Ftooling releases.\n\n**[CONTESTED] Matter's real-world state.** The specification consistently runs ahead of\nshipping product and ecosystem app support — a device type can be in the spec for a year\nbefore Apple Home \u002F Google Home \u002F SmartThings expose it usefully. Plan for the\necosystem-support matrix, not the spec version, and expect commissioning UX to be the\nhardest part of your product.\n\n### 8.4 LoRaWAN\n\n- **Classes**: A (uplink-initiated, two short RX windows — lowest power, the default),\n  B (scheduled ping slots via beacons — bounded downlink latency), C (continuous RX —\n  mains-powered only).\n- **Spreading factor** SF7–SF12: higher SF = longer range, exponentially longer airtime,\n  lower rate. SF12 packets can be >1 s on air.\n- **Duty cycle limits are legal, not advisory** — in EU868, typically 1% per sub-band.\n  This *hard-caps* how often you can transmit and how much downlink the network can send.\n  Design your telemetry budget around it or your device will be silently throttled.\n- **ADR (Adaptive Data Rate)**: the network server tunes SF\u002Fpower for static devices. Do\n  not enable ADR on mobile devices.\n- **Join**: **OTAA** (over-the-air activation, derives session keys, supports rejoin —\n  always use this) vs **ABP** (hard-coded session keys — a security and frame-counter\n  liability; avoid).\n- Stack: device → gateway (packet forwarder) → **network server** (ChirpStack, TTN\u002FTTS)\n  → application server. Running your own ChirpStack is very achievable and gives you\n  data sovereignty.\n\n### 8.5 Application protocols\n\n| Protocol | Transport | Payload | Best for | Watch out for |\n|---|---|---|---|---|\n| **MQTT 3.1.1 \u002F 5.0** | TCP + TLS | any | Cloud telemetry, UNS, fleet | Broker is a single point of failure; topic design is forever |\n| **MQTT-SN** | UDP | any | Sensor networks without TCP | Needs a gateway |\n| **CoAP** | UDP + DTLS | CBOR | Very constrained, REST-like | NAT traversal; use Observe for pub\u002Fsub-ish |\n| **LwM2M** | CoAP | TLV\u002FCBOR\u002FSenML | **Standardized device management** | Fewer cloud integrations than MQTT |\n| **HTTP\u002FREST** | TCP + TLS | JSON | Simple, firewall-friendly | Header overhead brutal on cellular\u002FLPWAN |\n| **AMQP** | TCP + TLS | any | Enterprise messaging, Azure IoT Hub | Heavy for MCUs |\n| **DDS \u002F ROS 2** | UDP multicast | CDR | Robotics, rich QoS policies | Complex; micro-ROS for MCUs |\n| **Sparkplug B** | MQTT | Protobuf | Industrial UNS | QoS 0 for DDATA; no retained messages by design |\n\n**MQTT 5 features worth adopting** (and now reachable on MCUs — FreeRTOS's coreMQTT\ngained v5 support in the 202604 LTS): **topic aliases** (send the long topic once, then a\n2-byte alias — a real win on cellular), **request\u002Fresponse** with correlation data,\n**session expiry** and **message expiry intervals**, **shared subscriptions** (load-balance\nconsumers across a group), and **reason codes** on every ack (so failures are diagnosable\ninstead of just \"disconnected\").\n\n**MQTT design rules that prevent regret:**\n1. **Design the topic hierarchy once, with one owner.** `{env}\u002F{site}\u002F{area}\u002F{line}\u002F{device}\u002F{signal}`.\n   Never put changing values in topics.\n2. Use **Last Will and Testament** on every device so \"offline\" is a first-class state.\n3. Publish **retained** messages for state (the current setpoint), non-retained for events.\n4. **QoS 1 is almost always right.** QoS 2 costs four round-trips and is rarely justified;\n   design your consumers to be idempotent and use QoS 1.\n5. Set a **keepalive** appropriate to your network (cellular NAT timeouts often force\n   ≤ 240 s) and implement reconnect with **exponential backoff plus jitter** — otherwise\n   a broker restart triggers a synchronized thundering herd from your whole fleet.\n\n**Payload encoding on constrained links:**\n\n| Format | Size (typical sensor msg) | Self-describing | Schema needed | Notes |\n|---|---|---|---|---|\n| JSON | 120 B | yes | no | Debuggable; wasteful |\n| **CBOR** (RFC 8949) | ~45 B | yes | no | JSON's data model, binary. Default for CoAP\u002FSUIT |\n| MessagePack | ~45 B | yes | no | Similar to CBOR, less standardized |\n| **Protobuf** | ~25 B | no | yes | Sparkplug's choice; nanopb for MCUs |\n| FlatBuffers | ~30 B | no | yes | Zero-copy read; good for large structures |\n| Custom packed struct | ~12 B | no | implicit | Smallest; brittle — version it explicitly |\n\n**[UNIVERSAL] If you roll your own binary format, put a version byte first, and never\nreuse a field's meaning.** Field-deployed devices will be on old firmware for years and\nyour parser must handle every version you ever shipped.\n\n### 8.6 Edge computing and TinyML\n\n**Gateway responsibilities** in a real deployment: protocol translation (Modbus\u002FOPC UA →\nMQTT), **store-and-forward** during upstream outage (this is non-negotiable — buffer to\nflash with a bounded ring), local rule evaluation for latency-critical reactions,\naggregation\u002Fdownsampling to control cloud cost, and being the security boundary.\n\n**On-device ML in 2026:**\n- **LiteRT for Microcontrollers** (formerly TensorFlow Lite Micro) remains the most\n  widely used MCU runtime — the core runtime fits in ~16 KB on a Cortex-M3.\n- **ExecuTorch** is the PyTorch-native path, growing fast, strongest where an NPU exists.\n- **Arm Ethos-U** micro-NPUs (U55, U65, **U85**) sit beside Cortex-M cores; the **Vela**\n  compiler converts LiteRT models to NPU form. U85 adds **transformer operator support**\n  and native TOSA, which is what makes small language models on MCU-class hardware\n  plausible rather than a stunt.\n- **Vendor SDKs**: STM32Cube.AI, NXP eIQ, Renesas e-AI — best per-family performance and\n  IDE integration, at the cost of portability.\n- **Edge Impulse** and similar: excellent end-to-end tooling for data collection →\n  training → deployment; the right choice for prototyping and for teams without ML\n  engineers; constraining when you need custom architectures.\n- The ecosystem has converged on **ONNX as the interchange format and INT8 quantization\n  as the default precision.**\n- **The metric that matters is energy per inference**, not inference latency, for anything\n  battery-powered. Benchmark with **MLPerf Tiny**, which includes energy measurement.\n\n**Practical TinyML advice**: quantization-aware training beats post-training quantization\nwhen accuracy is marginal; the model is rarely the bottleneck — **feature extraction (FFT,\nMFCC, windowing) often dominates both compute and RAM**; and always compute peak RAM as\n`max over layers of (input tensor + output tensor + workspace)`, because that number, not\nmodel size, is what fails to fit.\n\n---\n\n## §9. Cloud, Fleet, and Lifecycle\n\n### 9.1 Platform landscape (2026)\n\n- **AWS IoT Core** — MQTT broker + device registry, **Device Shadow** (desired\u002Freported\n  state), **Jobs** (fleet operations), **Fleet Provisioning**, **Device Defender**\n  (behaviour anomaly detection), **SiteWise** (industrial asset models), **Greengrass v2**\n  (edge runtime with components). **⚠️ Greengrass V1 support ends 7 October 2026** —\n  migrate to V2.\n- **Azure IoT** — **IoT Hub** for device-to-cloud at scale (MQTT\u002FAMQP\u002FHTTPS), **DPS** for\n  zero-touch provisioning, **Azure Digital Twins**, and **Azure IoT Operations** as the\n  newer Arc-enabled, Kubernetes-native edge platform for industrial\u002FOT: an edge-native\n  MQTT broker, OPC UA \u002F ONVIF \u002F media \u002F REST \u002F MQTT connectors, dataflows into Event\n  Hubs \u002F Event Grid \u002F Microsoft Fabric, and up to **72 hours of offline operation**.\n  Recent releases (2510, 2603) added MQTT data persistence, X.509 auth via Device\n  Registry, no-code dataflow graphs, cloud-to-edge management actions, and unified health\n  reporting. **Note on IoT Central**: a February 2024 console message announcing\n  retirement on 31 March 2027 was **retracted by Microsoft as erroneous**; the current\n  Azure IoT portfolio is documented as IoT Hub + IoT Operations. Verify status directly\n  before making a platform bet.\n- **Google Cloud IoT Core is gone** (retired 16 August 2023). There is no managed device\n  connectivity service on GCP; users moved to partners (ClearBlade, Litmus) or to AWS\u002FAzure.\n  This is the industry's standing reminder that **your device-side protocol should be\n  standard MQTT\u002FTLS so the broker is replaceable.**\n- **Self-hosted \u002F independent**: **EMQX**, **HiveMQ**, **Mosquitto** (brokers);\n  **ThingsBoard** (full platform); **ChirpStack** (LoRaWAN); **Balena** (fleet + container\n  OS); **Golioth**, **Memfault** (device management\u002Fobservability, MCU-focused);\n  **Particle** (vertically integrated); **Home Assistant \u002F ESPHome** (prosumer).\n\n**[UNIVERSAL, learned the hard way] Architect so the cloud is replaceable.** Standard MQTT\nover TLS with X.509, a documented topic schema, and a payload format you own. Every\nproprietary device-side SDK you adopt is a migration cost you're pre-paying.\n\n### 9.2 Identity and provisioning\n\n**The chain of trust:**\n```\nSilicon root of trust (immutable ROM \u002F fuses)\n  └─ verifies bootloader signature (MCUboot, ESP secure boot, TF-M)\n       └─ verifies application signature\n            └─ application uses a device identity key that NEVER leaves the secure element\n                 └─ TLS mutual auth to the cloud presents a device certificate\n```\n\n**Where the private key lives** determines your whole security posture:\n- **Secure element** (ATECC608, NXP SE050, Infineon OPTIGA): key generated on-chip, never\n  extractable, hardware ECDSA. ~$0.50–1.50 BOM. **The right answer for most products.**\n- **TrustZone-M + Trusted Firmware-M (TF-M)**: key in the secure partition, PSA Crypto API\n  from the non-secure app. No extra BOM; requires an M33\u002FM23-class part and real\n  engineering effort.\n- **Flash with readout protection**: cheapest, weakest. RDP levels are bypassable with\n  fault injection on many parts. Acceptable only when the threat model genuinely tolerates\n  a cloned device.\n- **PSA Certified** (Level 1\u002F2\u002F3) and **SESIP** are the certification schemes that let you\n  make a defensible claim about which of the above you did.\n\n**Provisioning patterns:**\n- **Factory-injected certificate**: device gets a unique cert at manufacture from your PKI.\n  Most control; requires a secure manufacturing process and an HSM-backed CA.\n- **Just-in-time registration \u002F provisioning (JITR\u002FJITP)**: device presents a cert signed\n  by your CA; the cloud auto-registers it on first connect. Scales well.\n- **Claim-based \u002F fleet provisioning**: device ships with a *shared* bootstrap credential,\n  exchanges it for a unique one on first connect. Convenient; the shared credential is the\n  weak link — rotate it and bound its privileges hard.\n- **DICE** (Device Identifier Composition Engine): derives a layered identity from an\n  immutable UDS and the measurement of each boot stage, so identity is cryptographically\n  bound to the firmware actually running.\n\n> **⚠️ GOTCHA — RNG entropy.** Key generation and TLS both need a real TRNG. Many MCUs'\n> \"RNG\" is a PRNG seeded from something weak, and some vendor implementations have shipped\n> with broken entropy. If keys are generated on-device, use the hardware TRNG, verify it\n> exists (not all part variants have it), and run at least a smoke test (NIST SP 800-90B\n> health tests) at boot. Duplicate keys across a fleet is a catastrophic, unrecoverable,\n> and historically common failure.\n\n### 9.3 OTA update\n\n**[UNIVERSAL] Non-negotiable properties of a firmware update system:**\n1. **Authenticated** — signature verified before execution, key in immutable storage.\n2. **Atomic** — the device is never left in a half-updated, unbootable state.\n3. **Rollback-capable** — automatic revert if the new image fails to confirm health.\n4. **Anti-rollback** — a monotonic security counter prevents an attacker re-flashing an\n   old, vulnerable-but-validly-signed image.\n5. **Power-fail-safe** — losing power at any instant leaves a bootable device.\n6. **Staged** — canary → percentage rollout → full fleet, with automatic halt on error-rate\n   regression.\n\n**Mechanisms:**\n- **A\u002FB (dual bank)**: two full slots; write inactive, swap the boot pointer, confirm.\n  Needs 2× flash. Simplest to reason about. **MCUboot** implements swap, overwrite-only,\n  and **DirectXIP** (execute from either slot, no copy) modes.\n- **Delta \u002F differential**: ship only the binary diff. 10–50× smaller, essential on LPWAN\n  and cellular-metered links. Costs the device RAM\u002FCPU for patching and requires exact\n  knowledge of the currently-installed version.\n- **Bootloader OTA**: updating the bootloader itself is the riskiest operation you can\n  perform. Some silicon now provides ROM-level recovery — **ESP-IDF v6.0 added recovery\n  bootloader support on ESP32-C5\u002FC61**, where the ROM falls back to a recovery partition\n  if the primary bootloader fails to load. Without such a fallback, bootloader OTA has no\n  safety net; treat it accordingly.\n\n**Standards**: **RFC 9019** (SUIT firmware update architecture for IoT) and **RFC 9124**\n(information model) define a CBOR-based manifest approach; **Uptane** is the\nautomotive-grade framework (derived from TUF) designed to survive a compromised update\nserver.\n\n**Post-quantum firmware signing — start planning now.** Firmware signed today may need to\nbe verified by a device in 2040. **NIST SP 800-208** standardizes the stateful hash-based\nsignature schemes **LMS** (RFC 8554) and **XMSS** (RFC 8391); NSA's **CNSA 2.0** names\n**software\u002Ffirmware signing as the highest-priority post-quantum transition**, advising\nadoption preferentially by 2025 and exclusively by 2030. Note the operational catch:\nstateful HBS schemes **must never reuse a one-time key**, so SP 800-208 requires key\ngeneration and signing inside a FIPS 140 Level 3 HSM that cannot export the private key —\nmeaning \"restore the signing key from backup\" is a security incident, not a recovery\nprocedure. **SLH-DSA (FIPS 205)** is the stateless alternative; **ML-DSA (FIPS 204)** is\nthe general-purpose lattice signature. RFC 9019 itself recommends post-quantum signatures\nfor immutable ROM bootloader code.\n\n### 9.4 Fleet observability\n\n**[UNIVERSAL] You cannot debug what you cannot see, and you cannot reproduce field\nconditions on your desk.** The four things every shipped device should report:\n1. **Reset reason** on every boot (§1.3 → `embedded-silicon-and-firmware-models`) — the earliest regression signal you have.\n2. **Crash captures**: the fault registers and stacked frame from §5.8 → `embedded-languages-realtime-and-patterns`, plus ideally a\n   coredump, symbolicated server-side against the exact build's ELF.\n3. **Heartbeat metrics**: uptime, free heap \u002F stack high-water marks, RSSI, battery,\n   error counters, task deadline misses.\n4. **Structured events**, not free-text logs — a numeric event ID plus binary arguments,\n   decoded server-side (the `defmt` \u002F Memfault \u002F trace-recorder approach). This is 10–50×\n   cheaper in flash, bandwidth, and CPU than `printf` strings.\n\n**Metrics to alert on**: crash-free-hours per device, watchdog reset rate, OTA success\nrate by cohort, connection churn, and battery depletion slope. A firmware regression shows\nup in crash-free-hours long before it shows up in support tickets.\n\n**Digital twin \u002F shadow pattern**: cloud holds `desired` and `reported` state; the device\nreconciles toward `desired` and publishes `reported`. This makes configuration\neventually-consistent and survivable across offline periods, which naive command-push does\nnot. Implement it even if you're not on a platform that gives it to you.\n","# Embedded & IoT: Industrial Control, Control Theory, Connectivity, and Fleet Lifecycle\n\n> **Part 3 of 5** of the *Embedded Systems & IoT Controls — Deep Technical Reference* reference (plugin `embedded-iot-controls`), covering §6–§9. Sibling skills: `embedded-silicon-and-firmware-models` (§0–§2), `embedded-languages-realtime-and-patterns` (§3–§5), `embedded-security-safety-and-testing` (§10–§13), `embedded-reference` (§14–§19). Section numbers are shared across the set; a reference written as §N → `skill` points into that sibling skill.\n>\n> **Currency:** Verified August 2026. See §17 → `embedded-reference` for the currency snapshot and what goes stale first.\n\n> **How to read this.** This is a reference, not a tutorial. Sections are independent.\n> Three markers appear throughout:\n> - **[UNIVERSAL]** — physics, math, or architecture. True regardless of vendor. Trust it.\n> - **[VENDOR]** — specific to a chip, SDK, or toolchain. Verify against the datasheet\u002Ferrata.\n> - **[CONTESTED]** — competent engineers disagree. Both cases are presented. Do not pick a side on the reader's behalf.\n>\n> **⚠️ GOTCHA** boxes mark the failure modes that actually burn people. They are the\n> highest-value content in this document.\n\n---\n\n## §6. Industrial Control and OT\n\n### 6.1 The PLC scan cycle [UNIVERSAL]\n\n```\n┌──> 1. INPUT SCAN     — snapshot ALL physical inputs into the input image table\n│    2. PROGRAM EXEC   — logic runs against the SNAPSHOT, writes to output image\n│    3. OUTPUT SCAN    — write output image to physical outputs, atomically\n│    4. HOUSEKEEPING   — comms, diagnostics, watchdog\n└────┘  repeat; scan time typically 1–50 ms\n```\n**Why the image tables matter**: within one scan, an input cannot change. This gives\ndeterministic, race-free logic and is the reason ladder logic is safely writable by people\nwho are not software engineers. It also means **your effective input latency is up to 2\nscan times**, and that a fast physical event shorter than one scan is *invisible* unless\nyou use a high-speed counter or interrupt-driven I\u002FO module.\n\n**Scan-time discipline**: the scan watchdog trips if a scan exceeds its limit. Long `FOR`\nloops, blocking communications, and unbounded string operations in Structured Text are the\nusual culprits.\n\n### 6.2 IEC 61131-3 languages\n\n| Language | Form | Best for | Notes |\n|---|---|---|---|\n| **LD** Ladder Diagram | Relay-logic rungs | Discrete\u002Finterlock logic, plant-maintainable | Universal in North America |\n| **FBD** Function Block Diagram | Wired blocks | Signal flow, process control, analog chains | Dominant in process industry |\n| **ST** Structured Text | Pascal-like text | Math, algorithms, loops, string handling | Where real software engineering happens |\n| **SFC** Sequential Function Chart | Steps + transitions | Batch, sequence, start\u002Fstop procedures | Maps to Grafcet; great for sequences |\n| **IL** Instruction List | Assembly-like | — | **Deprecated in IEC 61131-3 3rd edition** |\n\n**IEC 61499** is the distributed-control successor (event-driven function blocks across\ndevices), academically influential, commercially niche. **PLCopen** publishes the\nmotion-control function block standard (`MC_MoveAbsolute`, `MC_Power`, …) and the safety\nfunction block set — these matter because they make motion code portable across vendors.\n\n**Structured Text idioms worth knowing:**\n```pascal\n(* Edge detection — R_TRIG\u002FF_TRIG are standard function blocks *)\nVAR\n    rStart   : R_TRIG;\n    tonDelay : TON;\nEND_VAR\n\nrStart(CLK := xStartButton);\nIF rStart.Q THEN                      (* rising edge only, once per press *)\n    eState := STARTING;\nEND_IF\n\n(* Timers are function block INSTANCES with state — never re-declare inside a loop *)\ntonDelay(IN := (eState = STARTING), PT := T#3S);\nIF tonDelay.Q THEN\n    eState := RUNNING;\nEND_IF\n```\n> **⚠️ GOTCHA — retentive vs non-retentive variables.** `VAR RETAIN` survives a warm\n> restart; `VAR PERSISTENT` survives a cold restart\u002Fdownload (vendor semantics vary!).\n> Getting this wrong means a machine restarts mid-cycle in an unsafe state after a power\n> blip. It is one of the most consequential and least-documented distinctions in PLC work.\n\n### 6.3 Fieldbus and industrial protocols\n\n| Protocol | Layer | Determinism | Typical cycle | Notes |\n|---|---|---|---|---|\n| **Modbus RTU** | RS-485 serial | poll-only | 10–100 ms | Trivial, ubiquitous, no security, no timestamps |\n| **Modbus TCP** | Ethernet | poll-only | 5–50 ms | Same data model over TCP\u002F502 |\n| **PROFIBUS DP** | RS-485 | token\u002Fmaster-slave | 1–10 ms | Legacy but enormous installed base |\n| **PROFINET RT \u002F IRT** | Ethernet | RT: soft; IRT: hard (µs) | 1–10 ms \u002F \u003C1 ms | Siemens-dominant |\n| **EtherNet\u002FIP (CIP)** | Ethernet | implicit I\u002FO w\u002F RPI | 1–10 ms | Rockwell-dominant |\n| **EtherCAT** | Ethernet (special) | **hard, \u003C100 µs, jitter \u003C1 µs** | 50 µs–1 ms | Frame processed **on the fly** by each slave; distributed clocks |\n| **CANopen** | CAN | event + sync | 1–10 ms | Object dictionary, PDO\u002FSDO, NMT state machine |\n| **IO-Link** | Point-to-point 3-wire | ~2.3 ms cycle | — | Sensor-level; carries parameters + diagnostics, not just a signal |\n| **BACnet** | IP\u002FMSTP | none | seconds | Building automation |\n| **DNP3 \u002F IEC 61850** | IP\u002Fserial | GOOSE: \u003C4 ms | — | Utilities\u002Fsubstation; 61850 GOOSE is multicast, safety-relevant |\n| **OPC UA** | TCP\u002FHTTPS\u002FMQTT | not RT (except over TSN) | 50 ms+ | **Information model**, security, discovery |\n\n**EtherCAT's trick, because it explains why it's fast**: the master sends one frame that\ntravels the ring; each slave reads its output data and writes its input data **into the\npassing frame in hardware** as it goes by, with ~1 µs of propagation delay per node. There\nis no per-node packet, no switching latency, and no software stack in the loop.\nDistributed Clocks then synchronize all nodes to \u003C1 µs, which is what makes coordinated\nmulti-axis motion possible.\n\n**Modbus register model — the endianness trap [VENDOR chaos, UNIVERSAL pain]:**\n```\nData model (all 16-bit addressed, 0-based on the wire, 1-based in docs — the classic\noff-by-one):\n  Coils              (FC 01 read \u002F 05,15 write)   1-bit  R\u002FW   4x0001-style: 0xxxx\n  Discrete Inputs    (FC 02 read)                 1-bit  R     1xxxx\n  Input Registers    (FC 04 read)                16-bit  R     3xxxx\n  Holding Registers  (FC 03 read \u002F 06,16 write)  16-bit  R\u002FW   4xxxx\n\nA 32-bit float spans TWO registers. There is NO standard for the order. In the wild:\n  ABCD  big-endian           (most common, \"big-endian word, big-endian byte\")\n  CDAB  big-endian byte swap (\"word-swapped\" — extremely common on legacy drives)\n  BADC  little-endian byte swap\n  DCBA  little-endian\n```\n**⚠️ GOTCHA:** if a value reads as a plausible-but-wrong number (e.g. 3.6e-38 instead of\n25.4), you have a word-order mismatch. Always make word order a *configuration* item in\nyour Modbus client, never a hard-coded assumption. Document your device's choice in the\nregister map and publish it — the vendors who don't are the reason integrators hate them.\n\n**A register map convention that saves integrators' lives:**\n```\n| Addr | Type | Fmt   | Access | Scale | Unit  | Name              | Notes                |\n|------|------|-------|--------|-------|-------|-------------------|----------------------|\n| 4001 | u16  | -     | R      | 1     | -     | device_id         | 0x1234 constant      |\n| 4002 | u16  | -     | R      | 1     | -     | fw_version        | BCD major.minor      |\n| 4010 | i32  | ABCD  | R      | 0.001 | °C    | temperature       | -40..125             |\n| 4012 | f32  | ABCD  | R      | 1     | kPa   | pressure          | NaN = sensor fault   |\n| 4100 | u16  | bits  | R\u002FW    | 1     | -     | control_word      | b0=run, b1=reset     |\n| 4200 | u16  | -     | R      | 1     | -     | fault_code        | see appendix         |\n```\nPublish the scale, the unit, the invalid-value sentinel, and the word format for every\npoint. That table is the actual product for anyone integrating your device.\n\n### 6.4 OPC UA vs MQTT\u002FSparkplug — the live architectural debate\n\n**[CONTESTED]** and the most consequential IIoT architecture question right now.\n\n- **OPC UA** is an *information model* first: address space, typed nodes, methods,\n  historical access, alarms & conditions, built-in security (X.509, signing, encryption),\n  and **companion specifications** that standardize semantics per industry (machine tools,\n  robotics, pumps, packaging). Client\u002Fserver is the mature, widely-implemented mode.\n  **OPC UA PubSub (Part 14)** exists in the spec but adoption remains limited relative to\n  client\u002Fserver as of 2026; treat claims of ubiquitous PubSub with scepticism.\n- **MQTT** is a *transport*: publish\u002Fsubscribe, tiny, offline-tolerant, brokered, with no\n  opinion whatsoever about payload or topic structure. That freedom becomes topic-tree\n  chaos at scale.\n- **Sparkplug B** layers the missing OT semantics onto MQTT: a mandated topic namespace\n  `spBv1.0\u002F{group}\u002F{msg_type}\u002F{edge_node}\u002F{device}`, Protobuf payloads with typed metrics\n  and timestamps, and **birth\u002Fdeath certificates** (NBIRTH\u002FDBIRTH announce the full metric\n  set; NDEATH via MQTT Last Will marks a node offline) giving stateful,\n  report-by-exception operation without polling.\n- **The mainstream 2026 architecture** is not either\u002For: **OPC UA at the machine (the PLC\n  exposes companion-spec-modelled data) → edge gateway translates → MQTT\u002FSparkplug B to a\n  broker → Unified Namespace consumed by MES, historian, analytics, and cloud.** OPC UA\n  supplies meaning; MQTT supplies distribution.\n- **Sparkplug's real trade-off**: it deliberately forgoes MQTT retained messages and uses\n  QoS 0 for DDATA in favour of deterministic state via birth\u002Fdeath. That is a *feature*\n  for OT state management and a *limitation* if you need guaranteed delivery of every\n  sample. Know which you need.\n\n**Unified Namespace (UNS)** is the architectural idea that there should be exactly one\nreal-time, hierarchically-organized, event-driven source of truth for the whole\nenterprise's current state — typically an MQTT broker with an ISA-95-shaped topic tree\n(`enterprise\u002Fsite\u002Farea\u002Fline\u002Fcell\u002F...`) — that every system publishes to and subscribes\nfrom, replacing point-to-point integrations. It is genuinely transformative when done\nwell and a mess when the topic namespace isn't designed up front by one owner.\n\n### 6.5 Purdue model \u002F ISA-95 and the IT\u002FOT boundary\n\n```\nLevel 5  Enterprise (ERP)                        ─┐\nLevel 4  Site business planning (MES\u002FERP edge)    │ IT\n─────────────────────── DMZ ──────────────────────┤ ← the boundary that matters\nLevel 3  Site operations (historian, MES, OPC)   ─┤\nLevel 2  Supervisory (SCADA, HMI)                 │ OT\nLevel 1  Control (PLC, DCS, safety PLC)           │\nLevel 0  Process (sensors, actuators)            ─┘\n```\n**[UNIVERSAL] OT inverts the CIA triad.** IT prioritizes Confidentiality → Integrity →\nAvailability. OT prioritizes **Safety → Availability → Integrity → Confidentiality**. A\ncontrol that \"fails secure\" by locking out an operator during a process upset can turn a\ndeviation into an incident. This single inversion explains most IT\u002FOT friction.\n\n**Practical boundary controls**: an industrial DMZ with no direct L3→L4 protocol\ntraversal, replicated historians rather than direct database access, **unidirectional\ngateways \u002F data diodes** where the risk justifies it, and jump hosts with session\nrecording for vendor access. Colonial Pipeline is the reference lesson on why the *billing\nside* being compromised can stop the *operational* side (§16 → `embedded-reference`).\n\n### 6.6 Time-Sensitive Networking (TSN)\n\nStandard Ethernet is non-deterministic (queuing, bursts). TSN is a set of IEEE 802.1\namendments that make it deterministic while keeping standard hardware:\n- **802.1AS** — generalized PTP time synchronization (sub-µs across the network).\n- **802.1Qbv** — time-aware shaper: gated transmission windows per traffic class. This is\n  the core scheduling mechanism.\n- **802.1Qbu \u002F 802.3br** — frame preemption: a high-priority frame interrupts a\n  best-effort frame mid-transmission.\n- **802.1Qci** — per-stream filtering and policing (protects against a babbling node).\n- **802.1CB** — frame replication and elimination for reliability (seamless redundancy).\n\n**OPC UA over TSN** is the \"converged network\" vision: one Ethernet infrastructure\ncarrying deterministic control traffic and IT traffic. Real, deployed in automotive and\nsome machine builders; still expensive and integration-heavy for general industry.\n\n---\n\n## §7. Control Theory as Practiced in Firmware\n\n### 7.1 PID done correctly\n\nTextbook PID is three lines. Production PID is thirty, and the extra twenty-seven are\nwhere the engineering lives.\n\n```c\ntypedef struct {\n    float kp, ki, kd;\n    float dt;              \u002F* FIXED sample period, seconds — see note below *\u002F\n    float integral;\n    float prev_meas;       \u002F* derivative on MEASUREMENT, not error *\u002F\n    float d_filt;          \u002F* filtered derivative state *\u002F\n    float tau;             \u002F* derivative low-pass time constant, seconds *\u002F\n    float out_min, out_max;\n    bool  first_run;\n} pid_t;\n\nfloat pid_update(pid_t *p, float setpoint, float meas) {\n    float error = setpoint - meas;\n\n    \u002F* ---- Proportional ---- *\u002F\n    float P = p->kp * error;\n\n    \u002F* ---- Derivative on measurement (kills SETPOINT KICK) ----\n       d\u002Fdt(error) spikes to infinity on a setpoint step. d\u002Fdt(measurement) does not.\n       Sign flips because d(sp - meas)\u002Fdt = -d(meas)\u002Fdt for constant sp.            *\u002F\n    if (p->first_run) { p->prev_meas = meas; p->d_filt = 0.0f; p->first_run = false; }\n    float raw_d = -(meas - p->prev_meas) \u002F p->dt;\n    p->prev_meas = meas;\n\n    \u002F* ---- Filter the derivative (MANDATORY on any real sensor) ----\n       Unfiltered D amplifies sensor noise by kd\u002Fdt. First-order LPF: *\u002F\n    float alpha = p->dt \u002F (p->tau + p->dt);\n    p->d_filt  += alpha * (raw_d - p->d_filt);\n    float D = p->kd * p->d_filt;\n\n    \u002F* ---- Integral with CONDITIONAL INTEGRATION anti-windup ----\n       Compute the unsaturated output first; only integrate if we are not saturated\n       in the direction that would make saturation worse.                          *\u002F\n    float I_candidate = p->integral + p->ki * error * p->dt;\n    float u_unsat     = P + I_candidate + D;\n\n    bool saturating_high = (u_unsat > p->out_max) && (error > 0.0f);\n    bool saturating_low  = (u_unsat \u003C p->out_min) && (error \u003C 0.0f);\n    if (!saturating_high && !saturating_low) {\n        p->integral = I_candidate;             \u002F* only then commit *\u002F\n    }\n\n    float u = P + p->integral + D;\n\n    \u002F* ---- Saturate ---- *\u002F\n    if (u > p->out_max) u = p->out_max;\n    if (u \u003C p->out_min) u = p->out_min;\n    return u;\n}\n\n\u002F* Bumpless transfer: when switching manual→auto, back-calculate the integral so the\n   output does not jump. *\u002F\nvoid pid_set_auto(pid_t *p, float current_output, float setpoint, float meas) {\n    p->integral  = current_output - p->kp * (setpoint - meas);\n    p->prev_meas = meas;\n    p->d_filt    = 0.0f;\n    p->first_run = false;\n}\n```\n\n**The five PID mistakes that cause ~90% of field problems:**\n1. **No anti-windup** — integrator charges while the actuator is saturated; the system\n   massively overshoots when it comes off the limit. This is the #1 issue.\n2. **Derivative on error** — setpoint changes produce a huge output spike (\"derivative\n   kick\").\n3. **Unfiltered derivative** — sensor noise × kd\u002Fdt drives the actuator into chatter.\n4. **Variable `dt`** — computing `dt` from a timestamp each call means gain varies with\n   jitter. Run the loop from a **hardware timer interrupt at a fixed rate** and treat `dt`\n   as a constant. If you must handle variable dt, the math still works but tuning becomes\n   unreliable.\n5. **Sample rate too slow** — rule of thumb: sample at **10–20× the closed-loop bandwidth**\n   you want. A 1 Hz process needs ≥10 Hz sampling; a current loop at 1 kHz bandwidth needs\n   10–20 kHz.\n\n**Tuning methods, ranked by practicality:**\n- **Lambda \u002F IMC tuning** — pick a desired closed-loop time constant λ; compute gains from\n  a first-order-plus-dead-time (FOPDT) model. Predictable, conservative, the process\n  industry default.\n- **Relay autotuning (Åström–Hägglund)** — drive the process with a relay, measure the\n  resulting limit cycle to find the ultimate gain and period, then apply tuning rules. The\n  basis of most \"autotune\" buttons.\n- **Cohen–Coon** — better than Ziegler–Nichols for dead-time-dominant processes.\n- **Ziegler–Nichols** — historically important, **aggressively underdamped** (~25%\n  overshoot by design). Use as a starting point, then detune. Don't ship Z-N gains.\n- **Manual**: increase Kp until sustained oscillation, back off to ~half; add Ki to remove\n  steady-state error; add Kd last and only if you have a clean sensor.\n\n**Fixed-point vs float**: on any Cortex-M4F\u002FM7\u002FM33 with an FPU, use `float`. Single-\nprecision add\u002Fmul is 1–3 cycles. On M0\u002FM0+ without an FPU, software float is 50–100+\ncycles and Q15\u002FQ31 fixed-point (with CMSIS-DSP) is the right answer — but watch overflow\nand be explicit about your scaling.\n\n### 7.2 Beyond PID\n\n- **Cascade control**: inner fast loop (e.g. motor current, 10 kHz) inside an outer slow\n  loop (position, 1 kHz) inside an outer-outer (temperature, 1 Hz). Each loop should be\n  **5–10× faster** than the one enclosing it. This is how nearly all real motion and\n  process control is structured, and it solves problems that no amount of single-loop\n  tuning will.\n- **Feedforward**: if you know the disturbance or the required steady-state effort, add it\n  directly. Feedback then only corrects the error. In motion control, velocity and\n  acceleration feedforward reduce following error by an order of magnitude.\n- **Dead time \u002F transport delay**: PID degrades badly when dead time approaches the\n  process time constant. **Smith predictor** uses a process model to control against a\n  delay-free prediction. Fragile to model error; use with care.\n- **State-space + observers**: for MIMO or when states aren't directly measurable. A\n  **Luenberger observer** estimates unmeasured states; a **Kalman filter** does it\n  optimally under Gaussian noise assumptions.\n- **Complementary filter**: the poor man's Kalman for IMU fusion, and often the right\n  choice on an M0: `angle = a*(angle + gyro*dt) + (1-a)*accel_angle`. Two lines, no matrix\n  math, and it captures the essential idea (trust the gyro short-term, the accelerometer\n  long-term).\n- **MPC at the edge**: real on Cortex-M7\u002FM33-class hardware for small problems (embedded\n  QP solvers like OSQP\u002FqpOASES). Worth it when constraints matter (thermal limits,\n  actuator limits) and a model exists.\n\n### 7.3 Motor control\n\n**Commutation methods** in order of complexity:\n1. **Six-step \u002F trapezoidal** (BLDC): switch phases based on Hall sensors. Simple, torque\n   ripple at commutation, adequate for fans\u002Fpumps.\n2. **Sinusoidal**: smoother, still no current regulation in the rotating frame.\n3. **FOC (Field-Oriented Control)**: the standard for anything requiring precision.\n\n**FOC in one paragraph**: measure two phase currents → **Clarke transform** (3-phase abc →\n2-axis stationary αβ) → **Park transform** (αβ → rotating dq frame, using rotor angle) →\nnow torque-producing current `iq` and flux-producing current `id` are **DC quantities**,\nso two simple PI loops regulate them → **inverse Park** → **Space Vector Modulation**\n(SVPWM, ~15% better DC bus utilization than sinusoidal PWM) → three PWM duty cycles.\n\n**Timing is everything**: the current loop runs at the PWM frequency (typically 10–20 kHz)\nand must complete within one PWM period. ADC sampling must be synchronized to the PWM —\nsample at the **centre of the PWM period** (when the low-side FETs are on and the current\nis at its average), triggered by the timer, not by software.\n\n**Rotor angle sources**: Hall sensors (60° resolution, cheap), incremental encoder\n(needs indexing), absolute encoder\u002Fresolver (expensive, no homing), or **sensorless**\n(back-EMF observer or high-frequency injection) — sensorless is free in BOM and expensive\nin engineering, and has a low-speed blind spot.\n\n> **⚠️ GOTCHA — dead time and its compensation.** Hardware dead time prevents\n> shoot-through, but it distorts the output voltage (the actual volt-seconds don't match\n> the commanded duty), producing torque ripple and current distortion at low speed. Dead-\n> time compensation (adding a sign-of-current-dependent correction to the duty) is standard\n> practice in production FOC and absent from most tutorials.\n\n---\n\n## §8. Connectivity\n\n### 8.1 Choosing a radio — the decision table\n\n| Tech | Range | Data rate | Power | Topology | Infra needed | Best for |\n|---|---|---|---|---|---|---|\n| **BLE** | 10–100 m | 0.125–2 Mbps | very low | star \u002F mesh | phone or gateway | Wearables, sensors, commissioning, local UI |\n| **Thread** | 10–30 m\u002Fhop, mesh | 250 kbps | low | **mesh, IPv6** | border router | Home\u002Fbuilding sensors; Matter's preferred transport |\n| **Zigbee** | similar | 250 kbps | low | mesh | coordinator | Legacy lighting\u002Fbuilding; Zigbee 4.0 recently released |\n| **Wi-Fi (2.4\u002F5)** | 30–100 m | 10s–100s Mbps | **high** | star | AP | Mains-powered, high bandwidth, camera |\n| **Wi-Fi HaLow (802.11ah)** | ~1 km | 150 kbps–8 Mbps | medium | star | AP | Sub-GHz IP, long range, moderate rate |\n| **LoRaWAN** | 2–15 km | 0.3–50 kbps | **very low** | star-of-stars | gateway + network server | Utility metering, agriculture, private LPWAN |\n| **NB-IoT** | cellular | ~30–100 kbps | very low | cellular | carrier | Deep-indoor static meters — **but check carrier support** |\n| **LTE-M (Cat-M1)** | cellular | ~300 kbps–1 Mbps | low | cellular | carrier | Mobile assets, voice-capable, best roaming |\n| **LTE Cat-1 \u002F Cat-1bis** | cellular | ~10 Mbps | medium | cellular | carrier | The safe global default in 2026 |\n| **5G RedCap \u002F eRedCap** | cellular | 10s Mbps | medium | cellular (SA) | carrier | Mid-tier 5G; ~30 operators in 21 countries as of early 2026 |\n| **UWB** | 10–50 m | — | medium | — | anchors | Centimetre ranging, secure access |\n| **Satellite NTN** | global | very low | medium | — | constellation | Remote assets; store-and-forward with small constellations |\n\n**Cellular reality check for 2026:**\n- **2G and 3G are sunset in most markets**; devices still on them need a migration path.\n- **NB-IoT has been a commercial underperformer outside China** and carrier support is\n  uneven — **AT&T shut down its NB-IoT network**; T-Mobile and Verizon have continued to\n  support theirs. Do not design a US product around NB-IoT without written carrier\n  confirmation.\n- **LTE-M leads on roaming**, which matters for anything that moves across borders.\n- **5G RedCap** module pricing and SA network coverage are still the gating factors;\n  broader availability is expected through 2027–28.\n- **eSIM\u002FeUICC, and specifically SGP.32** (the IoT-focused remote SIM provisioning spec\n  finalized in 2024), is now the default expectation for any fleet with a >5-year life or\n  multi-country deployment. Design it in; retrofitting carrier flexibility is impossible.\n\n**[UNIVERSAL] Battery-life reality**: the radio dominates. A BLE sensor advertising every\n1 s versus every 10 s is roughly a 10× difference in battery life, and no amount of MCU\nsleep optimization compensates for a badly chosen connection interval.\n\n### 8.2 BLE — the concepts you actually need\n\n- **GAP** = discovery and connection roles (Peripheral\u002FCentral, Broadcaster\u002FObserver).\n- **GATT** = the data model: Services contain Characteristics contain Values +\n  Descriptors, all addressed by 16-bit (SIG-assigned) or 128-bit (custom) UUIDs.\n- **Advertising interval** (20 ms–10.24 s) drives discovery latency and advertiser power.\n- **Connection interval** (7.5 ms–4 s, in 1.25 ms units) drives throughput and connected\n  power. **Slave latency** lets a peripheral skip N connection events when it has nothing\n  to say — this is the single most important BLE power parameter.\n- **PHYs**: 1M (default), 2M (double rate, shorter range), Coded S=2\u002FS=8 (long range, 4×\n  the airtime).\n- **MTU negotiation**: default ATT MTU is 23 bytes (20 bytes of payload). Negotiate up\n  (247 is common) or your throughput will be terrible for reasons that look like a bug.\n- **Notifications** (no ack, fast) vs **Indications** (acked, one outstanding, slow). Use\n  notifications for streaming.\n\n**Bluetooth Core versions [current as of 2026]**: 6.0 (Sept 2024) introduced **Channel\nSounding** — phase-based ranging + round-trip time giving decimetre-level secure ranging,\nusing 72×1 MHz channels, with ambiguity-free operation to ~150 m. 6.1 (May 2025) added\nrandomized RPA for privacy. 6.2 (Nov 2025) cut the minimum connection interval from\n**7.5 ms to 375 µs** (a big deal for HID and latency-sensitive sensors) and added\namplitude-attack resilience for Channel Sounding. **6.3 was released 6 May 2026**;\nthe SIG is on a twice-yearly cadence.\n\n### 8.3 Thread and Matter\n\n**Thread**: IPv6 mesh over 802.15.4, with Routers, End Devices, and Sleepy End Devices; a\n**Border Router** bridges to the local IP network. Self-healing, no single point of\nfailure, ~250 kbps.\n\n**Matter**: an *application layer* over IP (Thread, Wi-Fi, or Ethernet) with a Data Model\nof Endpoints → Clusters → Attributes\u002FCommands, commissioning via BLE, and a **Fabric**\nsecurity model with per-fabric operational certificates (a device can be on several\necosystems' fabrics simultaneously).\n\n**Current spec state**: **Matter 1.5** (Nov 2025) was the big functional expansion —\n**cameras** (WebRTC live A\u002FV, PTZ, detection\u002Fprivacy zones, STUN\u002FTURN remote access),\n**closures**, **soil sensors**, and expanded energy management; **1.5.1** (Mar 2026)\nrefined cameras\u002Fdoorbells; **1.6 is reported as the current release as of mid-2026**.\n1.4.1\u002F1.4.2 were quality\u002Ftooling releases.\n\n**[CONTESTED] Matter's real-world state.** The specification consistently runs ahead of\nshipping product and ecosystem app support — a device type can be in the spec for a year\nbefore Apple Home \u002F Google Home \u002F SmartThings expose it usefully. Plan for the\necosystem-support matrix, not the spec version, and expect commissioning UX to be the\nhardest part of your product.\n\n### 8.4 LoRaWAN\n\n- **Classes**: A (uplink-initiated, two short RX windows — lowest power, the default),\n  B (scheduled ping slots via beacons — bounded downlink latency), C (continuous RX —\n  mains-powered only).\n- **Spreading factor** SF7–SF12: higher SF = longer range, exponentially longer airtime,\n  lower rate. SF12 packets can be >1 s on air.\n- **Duty cycle limits are legal, not advisory** — in EU868, typically 1% per sub-band.\n  This *hard-caps* how often you can transmit and how much downlink the network can send.\n  Design your telemetry budget around it or your device will be silently throttled.\n- **ADR (Adaptive Data Rate)**: the network server tunes SF\u002Fpower for static devices. Do\n  not enable ADR on mobile devices.\n- **Join**: **OTAA** (over-the-air activation, derives session keys, supports rejoin —\n  always use this) vs **ABP** (hard-coded session keys — a security and frame-counter\n  liability; avoid).\n- Stack: device → gateway (packet forwarder) → **network server** (ChirpStack, TTN\u002FTTS)\n  → application server. Running your own ChirpStack is very achievable and gives you\n  data sovereignty.\n\n### 8.5 Application protocols\n\n| Protocol | Transport | Payload | Best for | Watch out for |\n|---|---|---|---|---|\n| **MQTT 3.1.1 \u002F 5.0** | TCP + TLS | any | Cloud telemetry, UNS, fleet | Broker is a single point of failure; topic design is forever |\n| **MQTT-SN** | UDP | any | Sensor networks without TCP | Needs a gateway |\n| **CoAP** | UDP + DTLS | CBOR | Very constrained, REST-like | NAT traversal; use Observe for pub\u002Fsub-ish |\n| **LwM2M** | CoAP | TLV\u002FCBOR\u002FSenML | **Standardized device management** | Fewer cloud integrations than MQTT |\n| **HTTP\u002FREST** | TCP + TLS | JSON | Simple, firewall-friendly | Header overhead brutal on cellular\u002FLPWAN |\n| **AMQP** | TCP + TLS | any | Enterprise messaging, Azure IoT Hub | Heavy for MCUs |\n| **DDS \u002F ROS 2** | UDP multicast | CDR | Robotics, rich QoS policies | Complex; micro-ROS for MCUs |\n| **Sparkplug B** | MQTT | Protobuf | Industrial UNS | QoS 0 for DDATA; no retained messages by design |\n\n**MQTT 5 features worth adopting** (and now reachable on MCUs — FreeRTOS's coreMQTT\ngained v5 support in the 202604 LTS): **topic aliases** (send the long topic once, then a\n2-byte alias — a real win on cellular), **request\u002Fresponse** with correlation data,\n**session expiry** and **message expiry intervals**, **shared subscriptions** (load-balance\nconsumers across a group), and **reason codes** on every ack (so failures are diagnosable\ninstead of just \"disconnected\").\n\n**MQTT design rules that prevent regret:**\n1. **Design the topic hierarchy once, with one owner.** `{env}\u002F{site}\u002F{area}\u002F{line}\u002F{device}\u002F{signal}`.\n   Never put changing values in topics.\n2. Use **Last Will and Testament** on every device so \"offline\" is a first-class state.\n3. Publish **retained** messages for state (the current setpoint), non-retained for events.\n4. **QoS 1 is almost always right.** QoS 2 costs four round-trips and is rarely justified;\n   design your consumers to be idempotent and use QoS 1.\n5. Set a **keepalive** appropriate to your network (cellular NAT timeouts often force\n   ≤ 240 s) and implement reconnect with **exponential backoff plus jitter** — otherwise\n   a broker restart triggers a synchronized thundering herd from your whole fleet.\n\n**Payload encoding on constrained links:**\n\n| Format | Size (typical sensor msg) | Self-describing | Schema needed | Notes |\n|---|---|---|---|---|\n| JSON | 120 B | yes | no | Debuggable; wasteful |\n| **CBOR** (RFC 8949) | ~45 B | yes | no | JSON's data model, binary. Default for CoAP\u002FSUIT |\n| MessagePack | ~45 B | yes | no | Similar to CBOR, less standardized |\n| **Protobuf** | ~25 B | no | yes | Sparkplug's choice; nanopb for MCUs |\n| FlatBuffers | ~30 B | no | yes | Zero-copy read; good for large structures |\n| Custom packed struct | ~12 B | no | implicit | Smallest; brittle — version it explicitly |\n\n**[UNIVERSAL] If you roll your own binary format, put a version byte first, and never\nreuse a field's meaning.** Field-deployed devices will be on old firmware for years and\nyour parser must handle every version you ever shipped.\n\n### 8.6 Edge computing and TinyML\n\n**Gateway responsibilities** in a real deployment: protocol translation (Modbus\u002FOPC UA →\nMQTT), **store-and-forward** during upstream outage (this is non-negotiable — buffer to\nflash with a bounded ring), local rule evaluation for latency-critical reactions,\naggregation\u002Fdownsampling to control cloud cost, and being the security boundary.\n\n**On-device ML in 2026:**\n- **LiteRT for Microcontrollers** (formerly TensorFlow Lite Micro) remains the most\n  widely used MCU runtime — the core runtime fits in ~16 KB on a Cortex-M3.\n- **ExecuTorch** is the PyTorch-native path, growing fast, strongest where an NPU exists.\n- **Arm Ethos-U** micro-NPUs (U55, U65, **U85**) sit beside Cortex-M cores; the **Vela**\n  compiler converts LiteRT models to NPU form. U85 adds **transformer operator support**\n  and native TOSA, which is what makes small language models on MCU-class hardware\n  plausible rather than a stunt.\n- **Vendor SDKs**: STM32Cube.AI, NXP eIQ, Renesas e-AI — best per-family performance and\n  IDE integration, at the cost of portability.\n- **Edge Impulse** and similar: excellent end-to-end tooling for data collection →\n  training → deployment; the right choice for prototyping and for teams without ML\n  engineers; constraining when you need custom architectures.\n- The ecosystem has converged on **ONNX as the interchange format and INT8 quantization\n  as the default precision.**\n- **The metric that matters is energy per inference**, not inference latency, for anything\n  battery-powered. Benchmark with **MLPerf Tiny**, which includes energy measurement.\n\n**Practical TinyML advice**: quantization-aware training beats post-training quantization\nwhen accuracy is marginal; the model is rarely the bottleneck — **feature extraction (FFT,\nMFCC, windowing) often dominates both compute and RAM**; and always compute peak RAM as\n`max over layers of (input tensor + output tensor + workspace)`, because that number, not\nmodel size, is what fails to fit.\n\n---\n\n## §9. Cloud, Fleet, and Lifecycle\n\n### 9.1 Platform landscape (2026)\n\n- **AWS IoT Core** — MQTT broker + device registry, **Device Shadow** (desired\u002Freported\n  state), **Jobs** (fleet operations), **Fleet Provisioning**, **Device Defender**\n  (behaviour anomaly detection), **SiteWise** (industrial asset models), **Greengrass v2**\n  (edge runtime with components). **⚠️ Greengrass V1 support ends 7 October 2026** —\n  migrate to V2.\n- **Azure IoT** — **IoT Hub** for device-to-cloud at scale (MQTT\u002FAMQP\u002FHTTPS), **DPS** for\n  zero-touch provisioning, **Azure Digital Twins**, and **Azure IoT Operations** as the\n  newer Arc-enabled, Kubernetes-native edge platform for industrial\u002FOT: an edge-native\n  MQTT broker, OPC UA \u002F ONVIF \u002F media \u002F REST \u002F MQTT connectors, dataflows into Event\n  Hubs \u002F Event Grid \u002F Microsoft Fabric, and up to **72 hours of offline operation**.\n  Recent releases (2510, 2603) added MQTT data persistence, X.509 auth via Device\n  Registry, no-code dataflow graphs, cloud-to-edge management actions, and unified health\n  reporting. **Note on IoT Central**: a February 2024 console message announcing\n  retirement on 31 March 2027 was **retracted by Microsoft as erroneous**; the current\n  Azure IoT portfolio is documented as IoT Hub + IoT Operations. Verify status directly\n  before making a platform bet.\n- **Google Cloud IoT Core is gone** (retired 16 August 2023). There is no managed device\n  connectivity service on GCP; users moved to partners (ClearBlade, Litmus) or to AWS\u002FAzure.\n  This is the industry's standing reminder that **your device-side protocol should be\n  standard MQTT\u002FTLS so the broker is replaceable.**\n- **Self-hosted \u002F independent**: **EMQX**, **HiveMQ**, **Mosquitto** (brokers);\n  **ThingsBoard** (full platform); **ChirpStack** (LoRaWAN); **Balena** (fleet + container\n  OS); **Golioth**, **Memfault** (device management\u002Fobservability, MCU-focused);\n  **Particle** (vertically integrated); **Home Assistant \u002F ESPHome** (prosumer).\n\n**[UNIVERSAL, learned the hard way] Architect so the cloud is replaceable.** Standard MQTT\nover TLS with X.509, a documented topic schema, and a payload format you own. Every\nproprietary device-side SDK you adopt is a migration cost you're pre-paying.\n\n### 9.2 Identity and provisioning\n\n**The chain of trust:**\n```\nSilicon root of trust (immutable ROM \u002F fuses)\n  └─ verifies bootloader signature (MCUboot, ESP secure boot, TF-M)\n       └─ verifies application signature\n            └─ application uses a device identity key that NEVER leaves the secure element\n                 └─ TLS mutual auth to the cloud presents a device certificate\n```\n\n**Where the private key lives** determines your whole security posture:\n- **Secure element** (ATECC608, NXP SE050, Infineon OPTIGA): key generated on-chip, never\n  extractable, hardware ECDSA. ~$0.50–1.50 BOM. **The right answer for most products.**\n- **TrustZone-M + Trusted Firmware-M (TF-M)**: key in the secure partition, PSA Crypto API\n  from the non-secure app. No extra BOM; requires an M33\u002FM23-class part and real\n  engineering effort.\n- **Flash with readout protection**: cheapest, weakest. RDP levels are bypassable with\n  fault injection on many parts. Acceptable only when the threat model genuinely tolerates\n  a cloned device.\n- **PSA Certified** (Level 1\u002F2\u002F3) and **SESIP** are the certification schemes that let you\n  make a defensible claim about which of the above you did.\n\n**Provisioning patterns:**\n- **Factory-injected certificate**: device gets a unique cert at manufacture from your PKI.\n  Most control; requires a secure manufacturing process and an HSM-backed CA.\n- **Just-in-time registration \u002F provisioning (JITR\u002FJITP)**: device presents a cert signed\n  by your CA; the cloud auto-registers it on first connect. Scales well.\n- **Claim-based \u002F fleet provisioning**: device ships with a *shared* bootstrap credential,\n  exchanges it for a unique one on first connect. Convenient; the shared credential is the\n  weak link — rotate it and bound its privileges hard.\n- **DICE** (Device Identifier Composition Engine): derives a layered identity from an\n  immutable UDS and the measurement of each boot stage, so identity is cryptographically\n  bound to the firmware actually running.\n\n> **⚠️ GOTCHA — RNG entropy.** Key generation and TLS both need a real TRNG. Many MCUs'\n> \"RNG\" is a PRNG seeded from something weak, and some vendor implementations have shipped\n> with broken entropy. If keys are generated on-device, use the hardware TRNG, verify it\n> exists (not all part variants have it), and run at least a smoke test (NIST SP 800-90B\n> health tests) at boot. Duplicate keys across a fleet is a catastrophic, unrecoverable,\n> and historically common failure.\n\n### 9.3 OTA update\n\n**[UNIVERSAL] Non-negotiable properties of a firmware update system:**\n1. **Authenticated** — signature verified before execution, key in immutable storage.\n2. **Atomic** — the device is never left in a half-updated, unbootable state.\n3. **Rollback-capable** — automatic revert if the new image fails to confirm health.\n4. **Anti-rollback** — a monotonic security counter prevents an attacker re-flashing an\n   old, vulnerable-but-validly-signed image.\n5. **Power-fail-safe** — losing power at any instant leaves a bootable device.\n6. **Staged** — canary → percentage rollout → full fleet, with automatic halt on error-rate\n   regression.\n\n**Mechanisms:**\n- **A\u002FB (dual bank)**: two full slots; write inactive, swap the boot pointer, confirm.\n  Needs 2× flash. Simplest to reason about. **MCUboot** implements swap, overwrite-only,\n  and **DirectXIP** (execute from either slot, no copy) modes.\n- **Delta \u002F differential**: ship only the binary diff. 10–50× smaller, essential on LPWAN\n  and cellular-metered links. Costs the device RAM\u002FCPU for patching and requires exact\n  knowledge of the currently-installed version.\n- **Bootloader OTA**: updating the bootloader itself is the riskiest operation you can\n  perform. Some silicon now provides ROM-level recovery — **ESP-IDF v6.0 added recovery\n  bootloader support on ESP32-C5\u002FC61**, where the ROM falls back to a recovery partition\n  if the primary bootloader fails to load. Without such a fallback, bootloader OTA has no\n  safety net; treat it accordingly.\n\n**Standards**: **RFC 9019** (SUIT firmware update architecture for IoT) and **RFC 9124**\n(information model) define a CBOR-based manifest approach; **Uptane** is the\nautomotive-grade framework (derived from TUF) designed to survive a compromised update\nserver.\n\n**Post-quantum firmware signing — start planning now.** Firmware signed today may need to\nbe verified by a device in 2040. **NIST SP 800-208** standardizes the stateful hash-based\nsignature schemes **LMS** (RFC 8554) and **XMSS** (RFC 8391); NSA's **CNSA 2.0** names\n**software\u002Ffirmware signing as the highest-priority post-quantum transition**, advising\nadoption preferentially by 2025 and exclusively by 2030. Note the operational catch:\nstateful HBS schemes **must never reuse a one-time key**, so SP 800-208 requires key\ngeneration and signing inside a FIPS 140 Level 3 HSM that cannot export the private key —\nmeaning \"restore the signing key from backup\" is a security incident, not a recovery\nprocedure. **SLH-DSA (FIPS 205)** is the stateless alternative; **ML-DSA (FIPS 204)** is\nthe general-purpose lattice signature. RFC 9019 itself recommends post-quantum signatures\nfor immutable ROM bootloader code.\n\n### 9.4 Fleet observability\n\n**[UNIVERSAL] You cannot debug what you cannot see, and you cannot reproduce field\nconditions on your desk.** The four things every shipped device should report:\n1. **Reset reason** on every boot (§1.3 → `embedded-silicon-and-firmware-models`) — the earliest regression signal you have.\n2. **Crash captures**: the fault registers and stacked frame from §5.8 → `embedded-languages-realtime-and-patterns`, plus ideally a\n   coredump, symbolicated server-side against the exact build's ELF.\n3. **Heartbeat metrics**: uptime, free heap \u002F stack high-water marks, RSSI, battery,\n   error counters, task deadline misses.\n4. **Structured events**, not free-text logs — a numeric event ID plus binary arguments,\n   decoded server-side (the `defmt` \u002F Memfault \u002F trace-recorder approach). This is 10–50×\n   cheaper in flash, bandwidth, and CPU than `printf` strings.\n\n**Metrics to alert on**: crash-free-hours per device, watchdog reset rate, OTA success\nrate by cohort, connection churn, and battery depletion slope. A firmware regression shows\nup in crash-free-hours long before it shows up in support tickets.\n\n**Digital twin \u002F shadow pattern**: cloud holds `desired` and `reported` state; the device\nreconciles toward `desired` and publishes `reported`. This makes configuration\neventually-consistent and survivable across offline periods, which naive command-push does\nnot. Implement it even if you're not on a platform that gives it to you.\n",{"name":5,"description":7},"develop","ae32736a1aabddabca5d2c96d665aa0ebc7d8700","src\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fembedded-iot-controls\u002Fskills\u002Fembedded-industrial-control-connectivity-and-cloud",3,"https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey","https:\u002F\u002Fthe-vibey-project.github.io\u002Fvibey\u002F","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project","https:\u002F\u002Fvibewithadam.matthewsteinberger.com","freedom for software engineers","2026-11-15 05:47:42",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add the-vibey-project\u002Fvibey --skill embedded-industrial-control-connectivity-and-cloud",{"tool":40,"command":41},"bunx","bunx skills add the-vibey-project\u002Fvibey --skill embedded-industrial-control-connectivity-and-cloud",{"tool":43,"command":44},"pnpm","pnpm dlx skills add the-vibey-project\u002Fvibey --skill embedded-industrial-control-connectivity-and-cloud","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fembedded-iot-controls\u002Fskills\u002Fembedded-industrial-control-connectivity-and-cloud\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7AT1FQJAE1FQYAMDTF490Y4","white-paper-writing","Use when writing white papers, technical reports, policy documents, thought leadership pieces, or any long-form authoritative document. Triggers on requests to write, structure, outline, or review white papers, technical reports, position papers, policy briefs, or evidence-driven arguments. Also use for B2B content marketing strategy, technical documentation requiring authority, academic-style reports, or any document that must educate while persuading. Use when someone asks \"how should I structure this\" for a long-form document.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fwhite-paper-writing\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7AT16BJRJJKK2MASXRZS76G","prose-technical-mechanics","Use when editing or writing prose at a technical\u002Fmechanical level: choosing between Anglo-Saxon and Latinate diction, placing information in topic vs stress positions, writing periodic vs cumulative sentences, handling sentence rhythm, punctuation as logic, transitions, paragraph structure, or phonesthetics. Use when someone wants to understand WHY prose works or doesn't, not just surface-level style advice. Triggers on word choice, sentence structure, emphasis, rhythm, diction, or any deep writing mechanics question.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-technical-mechanics\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7AT0W9HT0ZZ9Y287NW99MR3","prose-mechanics","Use when writing, editing, or analyzing prose style; when trying to avoid generic AI-sounding writing; when applying specific prose styles such as journalistic, academic, narrative, KJV biblical, Hemingway plain, Latinate\u002FJamesian, Orwellian, Augustan, Victorian, Early Modern (Bacon, Browne, Milton), or free indirect discourse; or when coaching someone on writing voice and mechanics. Triggers on any request to improve, analyze, or write in a specific prose style, to fix \"AI-sounding\" writing, to make prose more vivid or concrete, to vary sentence rhythm, or to understand how a particular writer achieves their effects.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-mechanics\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7AT0KR635JX66X2X6F3E2CP","narrative-structure","Use when structuring stories, pitches, presentations, white papers, or any persuasive narrative; analyzing the hero's journey in fiction or non-fiction; applying StoryBrand for business communication; designing narrative arcs for thought leadership; or understanding Vogler, Snyder, Propp, or Campbell frameworks. Triggers on any narrative structure, storytelling, pitch structure, StoryBrand, hero's journey, three-act structure, Freytag, Save the Cat, narrative arc, or \"how should I structure this story\u002Fpitch\u002Fpresentation\" request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fnarrative-structure\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7AT0AKGW09NKKZDYBT8VRDE","legal-brief-writing","Use when writing legal briefs, motions, or any court filing; when analyzing judicial cognition and persuasion; when applying elite brief-writing techniques from Roberts, Clement, Kagan, Garner; or when structuring legal arguments for maximum persuasion. Also use for autistic\u002Fneurodivergent advocates who need to understand how their natural communication style maps to elite legal advocacy. Triggers on any legal writing, brief drafting, motion preparation, or legal argument structuring request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Flegal-brief-writing\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7AT00VWPS4Q8B5VEMXX9NQT","journal-publishability-criteria","Use whenever a research paper, article or preprint is being written, revised, reviewed or published, and specifically before every publication of docs\u002Fpaper.md. Covers what legitimate journals actually gate on, in order of gating — the editor's desk screen (scope, novelty, package problems), what reviewers judge (methodological soundness, claims the evidence can carry, statistical and qualitative reporting), EQUATOR reporting guidelines, the ICMJE authorship criteria, COPE's view of text recycling, the near-universal generative-AI policy (no AI author, disclosure, author responsibility), TOP 2025 transparency standards, how to verify a journal is legitimate, submitting without an institution, and a pre-submission checklist. Triggers on requests to evaluate, review, prepare or submit a paper, to judge publishability, to write a declarations or data-availability section, to disclose AI use, or to check a journal.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fjournal-publishability-criteria\u002FSKILL.md",[],[]]