Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

M2M communication

M2M (machine-to-machine) communication: definitions, architectures, protocols, reliability/latency trade-offs, basic queueing and battery lifetime calculations, exam-style examples and common mistakes.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

M2M (machine-to-machine) communication is the set of methods devices use to exchange data without human intervention. Engineers use M2M when designing telemetry, remote-control, smart meters, industrial monitoring and many IoT systems where sensors and actuators must talk reliably, at low cost, and with predictable power and delay.

Key ideas

Start from simple definitions and build the full picture.

  • Machine-to-machine (M2M) — a communication paradigm where a machine (device) exchanges information automatically with another machine (device, gateway or server) without direct human action. Use this phrase for device-to-device or device-to-cloud links in industrial and consumer systems.

  • Telemetry — periodic or event-driven measurement reporting from the device to a server. Define a telemetry message as a single data packet containing measured values, a timestamp and device ID.

  • Gateway — a device that performs protocol translation, aggregation, local processing and connectivity bridging (for example, from a low-power radio to IP). Draw a box labeled Gateway between sensor nodes and the Internet.

  • Endpoint (or node) — the sensor/actuator device that generates or consumes M2M messages.

  • Message broker — a server that implements publish–subscribe messaging; it receives messages from publishers and forwards to subscribers (example protocols: MQTT). Draw a cloud symbol labelled Broker with arrows from many clients. Also know CoAP (UDP, REST) for constrained M2M without a broker, and LwM2M (device management over CoAP).

  • Publish–subscribe — a communication pattern where publishers send messages to a broker under a topic and subscribers receive messages for topics they subscribed to. Contrast with request–response (e.g., HTTP) where a client asks and a server replies directly. In MQTT, delivery QoS levels are: 0 (at most once, no application ACK), 1 (at least once, broker sends PUBACK to the publisher; duplicates possible), 2 (exactly once, four-step handshake: PUBLISH/PUBREC/PUBREL/PUBCOMP). Choose the lowest QoS that meets reliability and duplication-tolerance requirements.

  • Quality of Service (QoS) in M2M — a set of properties such as reliability (message delivery guarantees), latency (delay from send to receive), throughput (data rate), and availability (percentage uptime). Specify which QoS property you need when designing (for example, sensor alarms need low latency and high reliability; periodic meter reads can tolerate higher latency).

  • Addressing and identity — every M2M device must have a unique identity: this may be an IP address, an IMSI/eSIM identity for cellular, an application ID, or a device ID in an M2M platform. Define provisioning as the process to assign identity and credentials.

  • SIM, eSIM and eUICC — SIM (Subscriber Identity Module) is a removable card that identifies a cellular device; eSIM is an embedded SIM chip soldered on the board; eUICC (embedded Universal Integrated Circuit Card) is the technology specification that allows remote provisioning of operator profiles. Use these for cellular M2M management and roaming.

  • LPWAN and cellular options — common M2M connectivity types include wired (Ethernet), cellular (2G/3G/4G/NB-IoT/Cat-M1), and LPWAN (LoRaWAN, Sigfox). Each has trade-offs in range, throughput, power, cost and latency. Choose based on message size, frequency, battery life and coverage.

  • Edge processing and gateways — moving computation to the gateway or device (edge) reduces backhaul traffic and latency. Define edge as computation near the data source.

  • Security basics — authentication (proving identity), authorization (what actions allowed), confidentiality (encryption of payload), integrity (detecting changes), and secure provisioning (safe delivery of credentials). Use TLS or DTLS for transport security, and hardware secure elements for keys when possible.

  • Over-the-air (OTA) updates — mechanism to update firmware remotely. Include versioning, integrity checks (digital signature) and rollback in OTA design.

  • Diagrams to draw for exams:

    • Architecture diagram: left side draw several small boxes labelled Sensors (with arrows to a Gateway box). Draw arrow from Gateway to Internet cloud and inside cloud a Broker and Application Server. Label the links: e.g., "LoRa/802.15.4" between Sensors and Gateway; "TCP/IP" or "NB-IoT" between Gateway and Broker.
    • Sequence diagram for publish–subscribe: draw vertical lifelines for Device, Broker, Application. Show arrows: Device -> Broker (PUBLISH topic X), Broker -> Device (PUBACK for QoS 1; for QoS 2 use PUBREC/PUBREL/PUBCOMP), Broker -> Application (PUBLISH deliver). For subscriber acknowledgments: only QoS 2 uses an application-layer handshake between Application and Broker (PUBREC/PUBREL/PUBCOMP); at QoS 0/1 the subscriber does not send an application-layer ACK. Label messages and timing (optional).
  • Important assumptions often required in derivations: arrival processes are often approximated as Poisson, service times as exponential when using M/M/1 queueing results. State these assumptions explicitly when using corresponding formulas.

Formulas

Each formula on its own line with meanings and when it applies.

Throughput = Payload_size / Transmission_time — Payload_size in bits (b), Transmission_time in seconds (s). Use when computing raw link throughput for a single transfer.

Bandwidth-Delay-Product = Bandwidth · RTT — Bandwidth in bits/s, RTT in s. Use when sizing buffers for a flow in a network.

Battery_energy = V · Capacity — V is battery voltage in volts (V). Capacity in ampere-hours (A·h). Battery_energy in watt-hours (W·h). Use to estimate stored energy.

Energy_per_cycle = I_tx·t_tx·V + I_rx·t_rx·V + I_sleep·t_sleep·V — I currents in A, times in s, V in V, energy in joules (J) if multiply by seconds (1 W·s = 1 J). Use for periodic transmission energy accounting.

Little's law: L = λ · W — L is average number in system (packets), λ is arrival rate (packets/s), W is average time in system (s). Applies for any stable queueing system in steady state.

M/M/1 utilization ρ = λ / μ — λ arrival rate (jobs/s), μ service rate (jobs/s). Requires Poisson arrivals, exponential service times, single server.

M/M/1 average number in system L = ρ / (1 - ρ) — applies under M/M/1 assumptions and ρ < 1.

M/M/1 average time in system W = 1 / (μ - λ) — W in seconds. Derived from L = λW. M/M/1 average number in queue L_q = ρ^2 / (1 - ρ) — excludes the job in service. M/M/1 average waiting time in queue W_q = ρ / (μ - λ) = L_q / λ — waiting time before service begins.

Packet delivery reliability ≈ (1 - p)^n — p is per-hop packet loss probability, n is number of hops. Gives probability a packet survives all hops (approximate if independent losses).

Worked examples

Two exam-grade worked examples with clear steps and units.

Example 1 — Battery life for an M2M sensor (periodic telemetry) Problem: A sensor has a 2400 mAh battery rated 3.7 V. It wakes every 15 minutes (900 s), transmits for 2 s using a transmit current of 100 mA, then receives/idle for 1 s at 20 mA, and sleeps for the rest of the cycle at 10 µA. Estimate battery life in days. (Use the Energy_per_cycle formula.)

Solution:

  1. Convert battery capacity to ampere-seconds: 2400 mAh = 2.4 Ah = 2.4 A·h = 2.4 · 3600 A·s = 8640 A·s. But easier: battery capacity in Ah gives hours directly.
  2. Compute average current per cycle:
    • Transmit: I_tx = 0.100 A for t_tx = 2 s → charge used Q_tx = I_tx·t_tx = 0.100 · 2 = 0.2 A·s.
    • Receive/idle: I_rx = 0.020 A for t_rx = 1 s → Q_rx = 0.020 · 1 = 0.02 A·s.
    • Sleep: I_sleep = 10 μA = 10e-6 A for t_sleep = 900 - 2 - 1 = 897 s → Q_sleep = 10e-6 · 897 ≈ 0.00897 A·s.
    • Total charge per cycle Q_cycle = 0.2 + 0.02 + 0.00897 = 0.22897 A·s.
  3. Convert Q_cycle to ampere-hours: Q_cycle (A·s) / 3600 = 0.22897 / 3600 = 6.36e-5 Ah per cycle.
  4. Number of cycles per hour = 3600 / 900 = 4 cycles/hour. So hourly consumption = 4 · 6.36e-5 = 2.544e-4 Ah/hour. Equivalently, average current I_avg = hourly consumption (Ah/hour) = 2.544e-4 A.
  5. Battery lifetime in hours = Battery_capacity_Ah / I_avg = 2.4 / 2.544e-4 ≈ 9437 hours.
  6. Convert to days: 9437 / 24 ≈ 393 days ≈ 393 days (≈1.08 years).

Answer: The estimated battery life is ≈393 days. Note: this ignores battery self-discharge, temperature effects, and higher peak currents during radio ramp-up — include these in production estimates.

Example 2 — M/M/1 queueing for an M2M gateway Problem: An M2M gateway forwards incoming messages to a cloud service. Messages arrive at average λ = 2 messages/s (assume Poisson). The gateway can process μ = 5 messages/s on average (assume exponential service time). Find utilization ρ, average time a message spends in system W, and average number in system L.

Solution:

  1. Compute utilization: ρ = λ/μ = 2/5 = 0.4 (dimensionless).
  2. Verify stability: ρ < 1 so stable.
  3. Average time in system W = 1 / (μ - λ) = 1 / (5 - 2) = 1/3 s ≈ 0.333 s.
  4. Average number in system L = λ·W = 2 · 1/3 = 2/3 ≈ 0.667 messages.

Answer: ρ = 0.4; W ≈ 0.333 s; L ≈ 0.667 messages.

Common mistakes

  • Forgetting that duty-cycle calculation must include all states (TX, RX, idle, sleep) and their durations.
  • Using per-link packet loss p for end-to-end reliability without checking independence of hops.
  • Mixing up publish–subscribe and request–response patterns and drawing incorrect sequence diagrams (publishers do not target endpoints directly).
  • Omitting security (authentication and integrity) in designs where devices are reachable from public networks.

For your exam

Typical question types and what full-marks answers include:

  • Definitions: define M2M, gateway, telemetry, publish–subscribe, QoS. Give short examples.
  • Short notes: compare cellular vs LPWAN for M2M — list throughput, range, power, cost trade-offs.
  • Derivations: derive M/M/1 W = 1/(μ−λ) from steady-state probabilities; show assumptions and steps. State Little's law and use it.
  • Numericals: battery lifetime calculation, queueing delays, throughput calculations. Show unit conversions step-by-step and carry units.
  • Diagrams: draw architecture and sequence diagrams. Label every component and link and explain data flow in 2–3 sentences.
  • Design question: pick a connectivity option for a use case and justify with message size, frequency, expected life, cost and security.

A full-marks answer states assumptions, shows each calculation step, uses SI units, and discusses limitations of the model.

Quick check

  1. What is the difference between publish–subscribe and request–response communication patterns?
  2. State Little's law and name one condition required for it to hold.
  3. For an M/M/1 queue with λ=3/s and μ=6/s, compute ρ and average time in system W.

Answers: 1) Publish–subscribe uses a broker to deliver messages from publishers to subscribers asynchronously; request–response is a direct synchronous client request to a server. 2) Little's law: L = λ·W; it requires steady state and finite averages (system stable). 3) ρ = 0.5; W = 1/(μ−λ) = 1/(6−3) = 1/3 s ≈ 0.333 s.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?