Skip to content

4.5 Engineering Case Study: Unified Access through a Multi-Protocol Gateway ​

4.5.1 Case Scenario: Smart Streetlights Mixing NB-IoT and LoRaWAN ​

A smart-city retrofit plans to deploy roughly two thousand streetlights across parks, arterial roads, and side streets. Based on operator coverage, gateway placement, downlink responsiveness, terminal power consumption, and lifecycle cost, the design uses two access paths: some controllers use NB-IoT, while others use LoRaWAN. This choice is a case assumption, not a substitute for spectrum compliance, a site survey, or capacity planning.

Both streetlight types must provide remote switching, brightness control, and fault alarms. The upper-layer application should reuse one set of business semantics, but “unified” does not mean erasing link constraints. The application still needs to know when a state was sampled, whether the data is fresh, whether the device is currently reachable for downlink, and whether a command has merely been accepted, has been delivered, or has actually taken effect.

Table 4-2 Engineering differences between the two smart-streetlight access paths

DimensionNB-IoT streetlightLoRaWAN streetlight
Network boundaryThe terminal joins an operator cellular network; the platform commonly also traverses an operator or vendor platformThe terminal reaches a LoRaWAN Network Server through one or more gateways, and the platform integrates through its API or messaging interface
Application protocolDetermined by the module, firmware, and operator solution; it may carry UDP, CoAP/LwM2M, MQTT, or a vendor protocolThe terminal sends LoRaWAN frames; application payloads are decoded after the Network Server, and the terminal is usually not an IP endpoint directly reachable by the platform
Identity and keysCellular attachment identity is not the same as application identity; application credentials still require a separate designOTAA or ABP and their root and session keys must be managed for the selected LoRaWAN version and regional parameters
Uplink and downlink reachabilityAffected by firmware, network state, and power-saving settings such as PSM/eDRXAffected by Class A/B/C, regional parameters, duty-cycle limits, and gateway scheduling
Coverage and capacityDepend on operator coverage, frequency band, site conditions, load, and tariff planDepend on frequency band, spreading factor, gateway density, interference, terrain, and regulatory limits
Power and latencyMust be measured under the real reporting interval, retransmission behavior, and signal qualityMust be measured under the device class, time on air, retransmission behavior, and downlink policy

The key conclusion from Table 4-2 is not that one path is inherently “better.” A radio technology alone does not determine the application protocol, coverage radius, power consumption, or latency. The project must lock the terminal firmware, operator interface, LoRaWAN version, and regional parameters, then use site-test records as design inputs.

In IoT DC3, the two device classes can be connected through project-built or otherwise validated Driver adapters. The NB-IoT-side adapter targets the application protocol actually used by the terminal or the vendor-platform interface; the LoRaWAN-side adapter usually targets the Network Server's northbound interface. A Driver maps raw payloads to consistent point-value and command contracts. Manager maintains business metadata such as Drivers, devices, Profiles, and points, while Data accepts commands and routes them through the message broker to the appropriate Driver. The radio technology alone does not mean that the repository already contains a dedicated, production-ready Driver for this project.

Unified semantics can expose fields such as switch, brightness, and faultCode through one API, but the model must also preserve sourceTime, receive time, quality code, staleness threshold, and link type. If the project needs desired-versus-reported state comparison, it can add a state-projection service around the platform. That is an explicit architecture choice, not a universal Device Shadow inherently supplied by IoT DC3's core services.

The control path likewise cannot be reduced to “application—Driver—device.” A business request first passes authentication, authorization, parameter validation, policy constraints, and any required human confirmation before it becomes a command with an idempotency key, expiry, and correlation identifier. A Driver's send receipt proves only that a particular transport stage completed; only a device acknowledgment or subsequent state readback can support the conclusion that the device executed the action. Cross-streetlight compensation must also pass through a governed rule or agent action boundary rather than allowing a model or alarm event to connect unconditionally to devices.

Scale arithmetic provides only a test starting point. Two thousand lights reporting once every 15 minutes produce an average offered load of about 2000 ÷ 900 ≈ 2.2 messages per second. Planning two thousand commands over one minute produces an offered command rate of about 2000 ÷ 60 ≈ 33.3 messages per second. Neither number proves single-instance capacity: retries, duplicates, synchronized bursts, persistence, consumer pauses, and wireless downlink windows can amplify peaks and backlog. Before launch, sustained-load, burst-load, and fault-injection tests must verify throughput, tail latency, queue watermarks, recovery time, and command-completion rate, and the results must drive sharding, rate-limiting, and scaling decisions.

Figure 4-11 Smart Streetlight System TopologyThe unified semantic layer converges two heterogeneous links while preserving time, quality, reachability, and the governed-action boundary.Figure 4-11 Smart Streetlight System TopologyThe unified semantic layer converges two heterogeneous links while preserving time, quality, reachability, and the governed-action boundary.Unified Access DomainNB-IoT PathLoRaWAN PathGoverned Commands ↓ · State/Receipts ↑Application LayerUnified API / Action GovernanceSemantic & State ProjectionPoint Values / Time / QualityCellular Protocol AdapterActual Protocol / Platform APILoRaWAN AdapterNetwork Server APIOperator / Vendor PlatformCellular NetworkNB-IoT Streetlights×1200LoRaWAN NSLoRaWAN GatewayLoRaWAN Streetlights×800Solid arrows: protocol paths; validate uplink and downlink semantics separatelyFigure 4-11 Overall smart-streetlight topology — unified semantics converge heterogeneous links, while time, quality, reachability, and action governance remain explicit.
Figure 4-11 Smart Streetlight System Topology

4.5.2 Reference Implementation and Acceptance of the Unified Access Layer ​

The following is a verifiable engineering path, not a promise about a particular version's console menus or “out-of-the-box” capabilities. Before production implementation, use the target version's code, deployment manifests, and interface contracts as the authority, and record the responsibility boundary of every custom adapter and external Network Server.

Use IoT DC3's Profile, device, and point configuration to establish comparable business semantics for the two streetlight classes. At minimum, specify:

  • separate lamp.switch.reported and lamp.switch.desired, so “command accepted” cannot be mistaken for “state changed”;
  • the unit, range, precision, read/write property, and out-of-range policy for brightness;
  • the enumeration, severity, clearing condition, and unknown-value handling for faultCode;
  • device source time, platform receive time, quality code, staleness threshold, and data origin;
  • each command's permission, preconditions, expiry, idempotency rule, acknowledgment method, and readback point.

Upper-layer business logic is reusable only when a new device satisfies this contract. If it introduces new semantics, precision, or control conditions, the Profile, storage, rules, API, or UI may still require coordinated changes.

Step 2: Implement Adapters against the Real Network Boundary ​

NB-IoT is an access technology. The team must first determine whether the terminal actually uses CoAP/LwM2M, MQTT, a private UDP payload, or an operator/vendor-platform API, and then implement and test a Driver for that real interface. A LoRaWAN device usually connects to a Network Server first. Its Driver integrates with that server's API, webhook, or message bus and handles application-payload encoding and decoding; the platform must not bypass the Network Server and assume a gateway protocol directly.

Each Driver must verify uplink parsing, downlink packaging, connection or subscription recovery, duplicates, reordering, timeouts, and error receipts. Drivers are deployed through the project's CI/CD and container orchestration. Image signing, health checks, canary rollout, rollback, and horizontal scaling exist only when the deployment system explicitly configures and verifies them; they are not automatic properties of a management console.

Step 3: Manage Identifiers, Credentials, and Connection Parameters Separately ​

IMSI, IMEI, DevEUI, and device numbers are primarily identifiers or addresses; they must not automatically be treated as application-authentication credentials. APNs, endpoints, Network Server tenant details, and device mappings are connection configuration. Application keys, LoRaWAN root keys, certificates, and tokens are secrets. Secrets must be referenced through a controlled key or secret-management system rather than written into manuscripts, ordinary YAML, images, or logs, and they require least privilege, rotation, revocation, and auditing.

Step 4: Accept the Complete Loop with Evidence ​

Acceptance must cover all four stages—Sense, Reason, Act, and Evolve—rather than merely checking that one data point appeared on a page:

  1. Sense: use known raw messages to verify decoding, unit conversion, timestamps, quality codes, and staleness decisions; add negative tests for loss, duplication, reordering, clock drift, and malformed payloads.
  2. Reason: verify that a rule or agent reads only evidence that satisfies freshness and quality requirements; missing data and cross-link latency differences must produce a degraded result rather than a falsely certain conclusion.
  3. Act: starting with an authorized request, trace Data, the message broker, the Driver, the Network Server/operator interface, and finally the device acknowledgment or state readback. Record acceptance, dispatch, device acknowledgment, and effect verification separately, and test idempotency, expiry, cancellation, and timeout behavior.
  4. Evolve: turn false positives, false negatives, human takeovers, command-completion rates, and rollback outcomes into an evaluation set. Changes to rules, prompts, models, or thresholds expand the delegation envelope only after offline evaluation, approval, controlled release, and rollback verification.

Acceptance also includes sustained and burst capacity tests plus fault injection for the Driver, broker, Network Server, operator interface, and offline devices. The report should retain the tested version, topology, load model, pass/fail/skip counts, P95/P99 latency, maximum queue watermark, recovery time, and unresolved risks. An average message rate cannot substitute for this evidence.

Pre-Launch Checklist ​

  1. □ Are the actual application protocols, firmware versions, LoRaWAN version, and regional parameters for both terminal classes frozen and traceable?
  2. □ Have the Profile, point mapping, quality codes, time semantics, and desired/reported state been reviewed by both business and device teams?
  3. □ Is every secret supplied through a controlled reference, with rotation, revocation, and log-redaction tests completed?
  4. □ Does every command pass authorization, policy, required confirmation, idempotency, and expiry checks, while distinguishing a send receipt from effect readback?
  5. □ Have radio coverage, interference, downlink windows, batch scheduling, and worst-signal conditions been validated on site?
  6. □ Have sustained, burst, and recovery tests met explicit SLOs, with a disposition for every failed or skipped item?
  7. □ Do Driver and configuration changes have a small-cohort rollout, observability, stop conditions, and a rehearsed rollback?

The value of a unified access layer is to contain protocol differences behind testable boundaries while preserving the real constraints of each wireless link. Only then can upper layers reason from trustworthy state, act safely through a governance boundary, and improve rules and delegation scope from operational evidence—completing the Sense, Reason, Act, and Evolve loop.

From Industrial Software to AI Agents · Building a multi-protocol, cloud-native, open-source industrial IoT platform ready to evolve toward AI agents