16  Building Cellular IoT Devices

cellular-iot
implementations

16.1 Start With the Story

Building a cellular device means turning a modem, firmware task, SIM profile, antenna, payload, and cloud endpoint into one reliable path. Most failures appear at the boundaries between those pieces.

Start simple: make one attach-send-sleep loop observable before adding retries, batching, diagnostics, or fleet policy.

16.2 Learning Objectives

After completing this chapter, you should be able to:

  • Translate a cellular IoT plan into hardware, firmware, SIM, and cloud implementation tasks.
  • Select a module capability class without depending on stale product or price claims.
  • Bring up a modem with a measured power rail, antenna path, SIM or eSIM profile, serial interface, and AT-command state machine.
  • Configure network registration, packet data context, APN, diagnostics, and payload delivery in a repeatable order.
  • Estimate data and energy budgets from the actual reporting pattern, retry behavior, and firmware-update plan.
  • Troubleshoot attach, signal, SIM, APN, payload, and sleep-mode failures using evidence instead of guesswork.
In 60 Seconds

Cellular IoT implementation is a disciplined bring-up process. Pick the radio capability class, build a stable power and antenna design, prove SIM and APN provisioning, then automate the modem state machine with clear timeouts and diagnostics. Do not rely on a vendor headline, sample sketch, or coverage map alone. The production answer is the combination of measured attach behavior, delivered payloads, current traces, data use, retry limits, firmware-update strategy, and support workflow.

Phoebe the physics guide

Phoebe’s Why

This chapter’s Antenna Caution box warns that “an unattached or mismatched antenna can make tests misleading and may violate the assumptions used for RF compliance or safe operation,” but it does not say why. The reason lives at the connector, before the wave ever leaves the board: a radio wave travelling down a feedline meets a sudden change in impedance wherever the antenna is not the connector’s expected load, and just like light hitting a change in refractive index, part of the wave reflects straight back toward the amplifier instead of radiating. An unattached antenna is the extreme case – an open circuit reflects essentially everything – which is exactly why hardware bring-up treats “transmit into an open connector” as a real risk to the power amplifier, not just a wasted test.

The Derivation

A load’s mismatch is summarized by its reflection coefficient, recovered from a measured voltage standing wave ratio (VSWR):

\[\Gamma = \frac{\mathrm{VSWR}-1}{\mathrm{VSWR}+1}\]

The fraction of forward power reflected, rather than radiated, follows directly:

\[P_{reflected}/P_{forward} = \Gamma^2\]

so the power actually delivered to the antenna is reduced by a mismatch loss of:

\[L_{mismatch}(\mathrm{dB}) = -10\log_{10}(1-\Gamma^2)\]

Worked Numbers: This Module’s 23 dBm Class

Using a catalog-typical 23 dBm (3GPP power class 3) module transmit level:

  • Well-matched, approved antenna, VSWR 1.5:1: \(\Gamma=0.5/2.5=0.200\), so \(L_{mismatch}=-10\log_{10}(1-0.04)=0.177\) dB – only about \(4\%\) of forward power reflected; effective radiated power stays near \(23.0-0.177\approx22.8\) dBm.
  • Detuned by an unapproved antenna or enclosure, VSWR 3:1: \(\Gamma=2/4=0.500\), so \(L_{mismatch}=-10\log_{10}(1-0.25)=1.25\) dB – a full \(25\%\) of forward power now reflects back toward the power amplifier instead of leaving the antenna, dropping effective radiated power to about \(21.8\) dBm.
  • Unattached connector (open circuit): \(\mathrm{VSWR}\to\infty\), \(\Gamma\to1\), so \(100\%\) of forward power reflects – \(0\%\) radiated, and the full transmit power the amplifier was driving returns to its own output stage instead of leaving the board.
  • Why this belongs in hardware bring-up, not just coverage review: the reflected fraction never shows up in a signal-strength reading at the far end – it shows up as reduced link margin the “Common Mistake: Optimizing Sleep Before Attach” warning above already worries about, and, at the open-circuit extreme, as a real thermal and safety risk to the amplifier the Antenna Caution box was written to prevent.
Key Concepts
  • Cellular module: The certified modem, RF front end, SIM or eSIM interface, firmware, and host interface used by the device.
  • Host interface: The UART, USB, SPI, or network-style interface between the application processor and the module.
  • AT commands: Text commands used to configure and query many cellular modules. Standard commands are often extended with vendor-specific commands.
  • APN (Access Point Name): The operator or connectivity-provider gateway name used when creating a packet data context.
  • Packet data context: The configured cellular data session that gives the device an IP path for payload delivery.
  • Registration: The modem state in which it is accepted by the cellular network for service.
  • URC (Unsolicited Result Code): An asynchronous modem message such as a registration change, socket event, or power-state notification.
  • Current trace: A measured profile of current draw during boot, attach, transmit, retry, idle, and sleep.

A cellular IoT device is not just a microcontroller with a radio attached. It is a small system with five moving parts:

  1. The host application collects sensor data and decides when to send it.
  2. The cellular module handles radio registration and data sessions.
  3. The SIM or eSIM profile identifies the device to the operator.
  4. The antenna and enclosure determine whether the radio can actually reach the network.
  5. The cloud endpoint and operations workflow receive data, monitor failures, and manage the fleet.

The early prototype proves that one device can send a payload. The production implementation proves that many devices can send payloads repeatedly, sleep correctly, recover from failures, update safely, and be supported after installation.

16.3 Implementation Standard

Use this chapter as a build checklist. A cellular implementation is ready for pilot only when each layer has evidence.

1. RequirementsPayload size, latency, mobility, battery target, installation sites, and update needs.
2. Module classNB-IoT, LTE-M, dual-mode, Cat 1/Cat 1 bis, broadband LTE, or 5G class.
3. HardwarePower rail, antenna, SIM interface, host interface, test points, and enclosure effects.
4. FirmwareAT state machine, timeouts, retries, URC handling, data budget, and sleep behavior.
5. OperationsProvisioning, monitoring, diagnostics, firmware update, replacement, and retirement.
Quality Gate

Do not treat a development board demo as a production design. The production device must be tested with the final or production-equivalent module, antenna, enclosure, SIM profile, firmware configuration, and installation orientation.

16.4 Module Capability Classes

Avoid choosing hardware from a single product name or a forum example. Start with the capability class, then shortlist modules that support the required bands, region, certifications, power modes, host interface, supply chain, and firmware maintenance plan.

NB-IoT focused

Fixed, tiny telemetry

Best for mostly stationary devices with small reports, long sleep periods, and difficult coverage locations when local operator support exists.

LTE-M focused

Mobile or reachable devices

Best when devices move between cells, need lower delay, may need voice features, or need richer diagnostics and firmware maintenance.

Dual-mode

Regional risk reduction

Useful when operator support differs by country or site, but only if firmware, SIM policy, tests, and power budgets cover both modes.

Cat 1 / Cat 1 bis

More data without broadband

Fits devices needing more frequent data, simpler LTE availability, or update headroom while still avoiding full broadband complexity.

Broadband LTE / 5G

High-throughput edge devices

Use for cameras, gateways, and edge appliances where power and data cost are secondary to throughput and low-latency service needs.

Selection Rule

Module selection is a lifecycle decision. Include firmware support, certification documents, antenna guidance, command documentation, regional band support, subscription model, and end-of-life risk in the shortlist.

16.5 Hardware Bring-Up

Cellular modules fail in prototypes for practical reasons: weak power rails, marginal antennas, missing SIM provisioning, serial timing mistakes, or an enclosure that changes the RF path.

Area
Hardware
Firmware
Operations
Power
Use a rail sized for transmit bursts, with local bulk capacitance and clean grounding per the module hardware guide.
Sequence power enable and reset pins predictably; log brownout and reset causes.
Measure current during boot, attach, transmit, retry, idle, and sleep before committing the battery model.
Antenna
Match the approved antenna type, connector, ground plane, cable length, and enclosure placement.
Record signal metrics after installation, not only on the bench.
Define when installers use internal antenna, external antenna, relocation, or redesign.
SIM or eSIM
Validate SIM voltage, physical holder, eSIM wiring, and profile requirements.
Check SIM readiness before registration and separate SIM faults from radio faults.
Plan activation, suspension, replacement, profile changes, and device retirement.
Host interface
Set UART or USB routing, level shifting, boot pins, flow control, and service access.
Parse responses and URCs without assuming a single blocking command-response sequence.
Keep field diagnostics available for support teams.
Antenna Caution

Follow the module vendor hardware guide for antenna connection, layout, and operating limits. An unattached or mismatched antenna can make tests misleading and may violate the assumptions used for RF compliance or safe operation.

16.6 AT Command Bring-Up Sequence

Command details vary by module, but the implementation pattern should be consistent. Build a state machine with explicit timeouts, retries, and logs. Do not let application code hide modem state inside a single blocking function.

1. Wake and talkOpen the host interface, confirm the modem responds to AT, and disable echo if needed.
2. Prove identityCheck SIM readiness, radio function state, and registration status before opening a data session.
3. Open dataConfigure the APN and packet data context, then activate the context and verify IP or socket readiness.
4. Send and recordSend a small payload, then log result, signal metrics, data use, retry count, and current trace.

Useful command families include:

  • AT and ATE0 for basic communication and echo control.
  • AT+CPIN? for SIM readiness.
  • AT+CEREG? or AT+CREG? for registration state, depending on radio access and module behavior.
  • AT+CGDCONT for packet data context and APN configuration.
  • AT+CGACT and AT+CGPADDR for context activation and IP address checks.
  • Module-specific socket, MQTT, HTTP, CoAP, TLS, PSM, eDRX, and firmware-update commands.
Implementation Pattern

Treat every AT step as a state transition:

  1. Send command.
  2. Wait for expected response or URC.
  3. Classify the result as success, retryable, configuration fault, SIM fault, network fault, or hardware fault.
  4. Record diagnostics before retrying or sleeping.

16.7 Payload and Protocol Choices

Many prototypes send whatever is easiest for the developer. Production firmware should choose payload and protocol behavior intentionally.

Payload format

Keep it small and versioned

Use compact JSON, CBOR, protobuf, or a documented binary format. Include schema version and device time context.

Transport

Match reliability to data value

MQTT, HTTPS, CoAP, UDP, and module-native clients each trade overhead, reliability, buffering, and security differently.

Security

Budget for credentials

TLS, DTLS, SIM-based identity, certificates, and key rotation affect memory, data use, update design, and support workflows.

Backoff

Protect the battery and network

Use bounded retries, jitter, local buffering, and clear discard rules for stale telemetry.

Data Budget Formula

Use measured payloads and overhead, then add retry and update allowances.

Monthly data estimate
devices x reports per day x days per month x bytes per report with overhead x retry multiplier, plus diagnostics and firmware-update allowance.

The same formula works for cost planning without baking a carrier price into the chapter. The price changes; the measurement method should not.

16.8 Power Budget Method

Battery life is not a module feature you can copy from a data sheet. It is the result of measured current, real network behavior, firmware timing, installation conditions, and the battery chemistry at the expected temperature range.

Measure

Capture the whole cycle

Measure boot, registration, payload delivery, retries, idle, PSM, eDRX, host sleep, and sensor activity.

Model

Use duty-cycle energy

Calculate energy per report and multiply by reporting frequency, retry behavior, health checks, and update windows.

Validate

Test weak-site behavior

Poor signal, long attach times, and repeated retries can dominate energy even when sleep current looks excellent.

Energy per cycle
boot energy + registration energy + payload energy + retry energy + idle energy + sleep energy between reports.
Common Mistake: Optimizing Sleep Before Attach

Low sleep current is useful, but it does not rescue a design that spends too long attaching or retrying. Measure the active radio states first, because weak coverage can turn an apparently efficient design into a battery drain.

16.9 Troubleshooting With Diagnostic Records

When a device fails to send data, do not jump straight to the application protocol. Work from physical diagnostics upward.

No modem response

Check power and host interface

Verify rail voltage under burst load, reset state, boot pins, serial level, baud rate, flow control, and terminal line endings.

SIM not ready

Check provisioning path

Confirm SIM/eSIM state, profile activation, PIN requirement, physical contact, and subscription status.

No registration

Check radio and operator fit

Check bands, technology mode, antenna placement, signal metrics, operator coverage, roaming policy, and barred states.

No data session

Check APN and context

Validate APN spelling, authentication requirements, packet context, IPv4/IPv6 behavior, firewall policy, and DNS.

Payload rejected

Check cloud contract

Confirm endpoint, port, TLS version, certificate date, device identity, payload schema, and server-side throttling.

Battery miss

Check retry and sleep states

Compare expected and measured current traces, attach duration, retry count, eDRX/PSM acceptance, host sleep, and sensor duty cycle.

Field Log Minimum

At minimum, store firmware version, module firmware version, SIM or profile identifier, radio mode, registration result, signal metrics, APN, IP/session result, payload outcome, retry count, reset reason, and a timestamp from the best available clock.

16.10 Pilot Diagnostic Record

Use one compact record for lab notebooks, pilot reports, and support tickets so failures can be compared across hardware, firmware, locations, and operators.

timestamp:
device_id:
board_revision:
host_firmware:
module_class:
module_firmware:
sim_or_profile_id:
profile_state:
test_location:
enclosure_state:
antenna_state:
radio_policy:
operator_policy:
registration_state:
serving_cell_metrics:
packet_context:
assigned_address:
security_handshake_result:
application_exchange_result:
power_state_after_test:
current_trace_id:
failure_summary:
next_action_owner:

The record is useful only if it climbs the diagnostic ladder in order: hardware alive, profile accepted, network visible, registered, packet context active, application session complete, and low-power recovery proven.

16.11 Production Readiness Checklist

Prototype success means one device worked once. Pilot readiness means the team can explain what happens when devices fail.

Gate
Hardware record
Firmware record
Operations record
Bench bring-up
Power, antenna, SIM, and host interface verified on production-equivalent hardware.
State machine sends a test payload and records structured diagnostics.
Provisioning steps are documented and repeatable.
Site pilot
Signal and current traces captured at representative installation points.
Retries, buffering, sleep behavior, and timeouts tested under weak coverage.
Install categories and support escalation rules are defined.
Fleet pilot
Manufacturing test, labeling, and service access validated across sample devices.
Data budget, firmware update path, and telemetry schema tested at fleet scale.
Activation, monitoring, suspension, replacement, and retirement workflows are ready.

16.12 Implementation Walkthrough

Use this sequence for a first production-oriented prototype.

16.12.1 1. Define the Contract

Write a one-page device contract before choosing a board:

  • Payload fields and maximum bytes per report.
  • Reporting interval and maximum acceptable delay.
  • Whether old data should be sent later or discarded.
  • Installation site categories and expected motion.
  • Firmware update size and frequency.
  • Required logs for support.

16.12.2 2. Build the Hardware Proof

Bring up the module with a controlled power supply and current measurement. Confirm serial communication, antenna connection, SIM readiness, registration, packet context, and a small payload before adding sensors or a complex cloud client.

16.12.3 3. Automate the State Machine

Move the terminal-session steps into firmware. Keep the modem driver separate from the application logic so retries, URCs, timeouts, and power-state transitions are testable.

16.12.4 4. Add Data Controls

Compact the payload, enforce size limits, compress or batch only when it reduces total energy, and record how many bytes the module actually sends over the air-facing connection.

16.12.5 5. Validate Sleep and Recovery

Test normal sleep, network-denied sleep requests, weak-signal attach, server outage, SIM rejection, DNS failure, TLS failure, and module reset. A device that cannot recover without a technician is not ready for remote deployment.

16.13 Quick Check: Implementation Design

16.14 Concept Relationships

How This Connects

Builds on:

Extends to:

16.15 See Also

Related Resources

Official and standards-oriented references:

16.16 Try It Yourself

Hands-On Challenge

Task: Draft a pilot bring-up plan for a battery-powered cellular sensor.

Your plan should include:

  1. The module capability class and why it fits the application.
  2. Power, antenna, SIM/eSIM, and host-interface checks before any cloud code runs.
  3. The AT-command state sequence and timeout policy.
  4. The minimum diagnostics to capture for every failed and successful upload.
  5. A data budget with payload bytes, overhead, retries, diagnostics, and firmware-update allowance.
  6. A power budget based on measured active, retry, idle, and sleep current traces.
  7. The pilot gate that decides whether the design can move to a fleet test.

16.17 Repeatable Bring-Up Evidence Flow

A cellular prototype is not pilot-ready because it sent one payload from a bench. Pilot readiness means the same hardware, firmware, identity, antenna, power rail, and network path can be brought up repeatedly with bounded timeouts and useful diagnostics.

The implementation job is to turn a radio module into an operated system: a device that can register, authenticate, send data, sleep, recover, update, and explain failures after it leaves the lab.

Cellular modem bring-up evidence flow showing serial response, SIM or profile readiness, signal observation, registration, data context, power observation, and lab record.
Use the bring-up flow as a release gate, not just as a lab checklist. Each step should leave evidence, and the team should stop at the first missing layer instead of changing cloud code, APN values, antennas, and firmware all at once.

For a pilot device, the repeatable route matters more than the fastest successful demo. A clean bring-up record starts with the physical interface, confirms identity, records signal and registration state, proves a packet context, sends a small payload, then records the power behavior that follows.

That order protects the team from false fixes. If the module resets during a burst, an APN edit is irrelevant. If the SIM profile is not ready, a server dashboard cannot explain the failure. If the device sends once but never returns to the intended sleep state, the implementation is still unfinished.

Hardware

Prove the physical stack

Power rail, reset line, level shifting, host interface, antenna path, SIM slot or eSIM, enclosure, and current measurement all need production-equivalent checks.

Network

Prove the packet path

Registration, APN, packet data context, DNS, TLS, payload delivery, and server response must be captured with signal and retry evidence.

Operations

Prove recovery

SIM rejection, no service, weak coverage, server outage, firmware update, and sleep recovery need runbooks before fleet rollout.

Bring-up rule:

A pilot gate should pass only when repeated bring-up succeeds from cold boot, failed network state, weak coverage, and post-update recovery without manual terminal intervention.

16.18 Cellular Implementation Record

The implementation record is the artifact that lets a field failure be reproduced. It links hardware evidence, firmware state, network identity, data budget, power trace, and operational ownership to the same release decision.

Write the record so another engineer can rerun the fault without guessing what changed. Name the module variant, modem firmware, host firmware, antenna state, SIM or eSIM profile, APN, operator policy, backend endpoint, payload schema, and test location. Then attach the transcript or log that proves the modem moved through each expected state.

Record field
Hardware
Firmware
Operations
Module baseline
Module variant, bands, certification region, firmware revision, antenna and enclosure.
Host interface, reset timing, baud or bus settings, and boot detection.
Approved substitutions, firmware-update policy, and supply-chain fallback.
Identity and network
SIM, eSIM, profile state, antenna match, and field signal measurements.
SIM readiness, registration wait, APN/PDP context, DNS, TLS, and payload send sequence.
Carrier support path, activation owner, APN changes, roaming limits, and billing checks.
Failure handling
Power brownout, antenna disconnect, SIM fault, and enclosure-induced RF loss cases.
Timeouts, URC handling, retry backoff, state reset, sleep recovery, and diagnostic logging.
Incident categories, fleet alerts, replacement rules, and customer-visible status.
Release evidence
Current trace, thermal check, mechanical fit, and representative site test.
Data budget, power budget, update path, rollback, and normal/error log examples.
Pilot pass/fail rule, support handoff, provisioning checklist, and revalidation trigger.
Minimum log

Keep enough context

For each upload, keep timestamp, signal metrics, registration state, APN/context result, bytes sent, retries, server status, and current-trace marker.

Pilot gate

Reject terminal-only success

If a human terminal session is required to recover a fault, the design is still a prototype, not a pilot release.

Change control

Retest hidden dependencies

SIM profile, operator policy, APN, antenna, enclosure, modem firmware, host firmware, and backend endpoint changes can all alter field behavior.

The practical test is whether a support ticket can be classified from evidence alone. A good record separates “no serial reply” from “SIM not ready”, “not registered” from “registered but no data context”, and “payload rejected by the server” from “payload sent but the device never returned to sleep”. Those distinctions drive different fixes, owners, and pilot gates.

16.19 URC State-Machine Review

Cellular modules do not behave like simple serial sensors. They report asynchronous modem events through unsolicited result codes, change state while the host is waiting, and can fail in ways that look like application bugs unless the firmware owns an explicit state machine.

A robust host moves through power, SIM readiness, registration, packet context, transport, payload, sleep, and recovery states with bounded timeouts. It records both the command response and the modem events that happened around the command.

The firmware should treat every modem command as a transition with a precondition, a timeout, an expected response, and an error classification. For example, a registration wait should not block forever. It should end as registered, barred, SIM fault, no service, weak signal, or timeout, with enough context for the next state to choose retry, backoff, reset, sleep, or support escalation.

URCs make this especially important because the modem can report a network change while the host is preparing a payload or waiting for a socket response. If firmware ignores those events, the application may blame TLS, MQTT, or the cloud when the real fault was a lost registration, rejected context, or power-state transition.

PowerStable rail, reset sequence, boot banner, and host interface confirmed.
IdentitySIM or eSIM ready, profile active, and credentials mapped to the operator plan.
RegisterNetwork search and registration bounded with signal, reject, and timeout evidence.
ContextAPN and packet data context activated before DNS, TLS, or payload attempts.
RecoverRetries, modem reset, backoff, sleep return, and diagnostic upload are explicit states.

Release testing should therefore include unhappy paths, not just the normal upload. Force a SIM rejection, wrong APN, weak-signal attach, server outage, DNS failure, modem reset, and denied sleep request. The expected result is not “always succeeds”; it is that the device reaches a known state, records why it failed, protects the battery budget, and can recover without a manual terminal session.

16.20 Summary

  • Cellular IoT implementation is a system task across module selection, hardware, firmware, SIM lifecycle, data budget, power budget, and operations.
  • Choose module capability classes first; only then shortlist specific modules using regional bands, certification, firmware support, host interface, and supply-chain evidence.
  • Use a modem state machine with explicit timeouts, URC handling, retries, and diagnostics instead of ad hoc terminal-session code.
  • Battery and data plans should be based on measured payloads, attach behavior, retry counts, update strategy, and current traces.
  • Production readiness is proven by repeatable bench bring-up, representative site pilots, fleet operations workflow, and supportable failure diagnostics.

16.21 Key Takeaway

Cellular implementation work is as much about provisioning and operations as firmware. Test SIM or eSIM activation, attach behavior, APN settings, retries, power modes, data usage, and failure recovery before field rollout.