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.

Sensor MAC protocols: S-MAC and IEEE 802.15.4

Study notes comparing S‑MAC (Sensor‑MAC) and IEEE 802.15.4 MAC for low‑power wireless sensor networks, focusing on goals, mechanisms, key formulas, examples and exam preparation.

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

Two sentences: MAC protocols are central to saving battery life and meeting latency/throughput needs in battery‑operated wireless sensor nodes. Engineers choose between protocol mechanisms (S‑MAC style duty cycling vs IEEE 802.15.4 beacon/superframe modes) when designing sensor networks, IoT nodes and low‑power PANs.

Key ideas

  • Energy efficiency: reduce time the radio is powered. Radios consume far more power than CPU/sensors. Main techniques: duty cycling, reducing collisions, avoiding overhearing.

  • Latency: delay from packet generation to successful reception; usually grows when duty cycles are low (long sleeps).

  • Throughput and reliability: achievable data rate and successful delivery probability; may be reduced by aggressive sleep.

  • Fairness and scalability: provide equitable access to the channel and work as network size grows.

  • S‑MAC (Sensor‑MAC) — definitions and mechanisms (from first principles):

    • Periodic listen and sleep: each node follows a repeating cycle with a listen period (radio on to receive/transmit) and a sleep period (radio off). Define duty cycle D as D = listen/(listen+sleep).
    • SYNC (synchronization): nodes exchange SYNC packets during listen periods to learn neighbors’ schedules and form virtual clusters of nodes sharing schedules. SYNC reduces the need for long radios-on times for neighbor discovery.
    • Message passing: long messages are split into a sequence of smaller fragments and sent back‑to‑back during one listen period to avoid repeated contention and per‑fragment backoffs. This reduces per‑packet overhead and end‑to‑end latency.
    • Collision avoidance: S‑MAC relies on RTS/CTS (optional) to reduce collisions caused by hidden terminals; it also uses CSMA during listen periods.
    • Overhearing avoidance: nodes put themselves to sleep when they learn (from RTS/CTS or headers) that they are not the intended receiver, avoiding unnecessary listening.
    • Adaptive listening: when a node hears channel activity it may briefly wake earlier than its scheduled listen period end to catch possible responses, reducing latency at cost of small energy increase.
    • Assumptions: nodes have loosely synchronized clocks enough to keep listen periods overlapping with neighbors via SYNC; traffic is low or bursty (typical for sensing). S‑MAC is not a strict TDMA; schedules may differ across nodes.
  • IEEE 802.15.4 — definitions and mechanisms:

    • IEEE 802.15.4: a standard specifying the PHY and MAC layers for low‑rate wireless personal area networks (LR‑WPANs). It targets low data rates, low complexity and low power.
    • Two topologies: star (nodes talk to a coordinator) and peer‑to‑peer (nodes can talk to each other). A PAN (Personal Area Network) coordinator manages beaconing in beacon‑enabled mode.
    • Two MAC modes: beacon‑enabled (uses beacons and a repeating superframe) and non‑beacon (beaconless).
    • Superframe structure (beacon‑enabled): the coordinator periodically sends a beacon. The period between beacons is the Beacon Interval (BI); the active part of the interval is the Superframe Duration (SD). The active portion contains: a Beacon, the Contention Access Period (CAP) where slotted CSMA‑CA is used, and an optional Contention Free Period (CFP) made of up to 7 GTS (Guaranteed Time Slots). The SD is divided into 16 slots; each slot duration is aBaseSlotDuration × 2^SO symbols.
    • Parameters BO and SO: Beacon Order (BO) and Superframe Order (SO) control BI and SD: BI = aBaseSuperframeDuration × 2^BO, SD = aBaseSuperframeDuration × 2^SO, with 0 ≤ SO ≤ BO ≤ 14. BO = 15 indicates non‑beacon‑enabled operation (no beacons/superframe), and SO = 15 shall not be used. Active duty cycle = 2^(SO−BO).
    • Channel access: in beacon‑enabled networks, devices use slotted CSMA‑CA (with backoff exponent BE, number of backoffs NB, and contention window CW). In non‑beacon mode, unslotted CSMA‑CA is used. The backoff period length is aUnitBackoffPeriod = 20 symbols; default CSMA‑CA parameters are macMinBE = 3, macMaxBE = 5, and macMaxCSMABackoffs = 4.
    • Frame types: beacon, data, acknowledgement (ACK), MAC command frames. Addressing: short 16‑bit or extended 64‑bit addresses. Maximum PHY packet size: aMaxPHYPacketSize = 127 bytes (PHY PSDU maximum).
    • Security: optional AES‑128 based security services at MAC layer (encryption and integrity).
  • Important relationships and implications (derivations often asked):

    • Duty cycle D for periodic sleep/listen: D = L/(L+S) where L = listen period, S = sleep period. If L and S are given, D follows directly.
    • Average power of a node with two radio states (active and sleep): P_avg = D·P_active + (1−D)·P_sleep. This drives battery lifetime estimates.
    • For IEEE 802.15.4 beacon mode: relate BO and SO to duty cycle and to delay. Larger BO with small SO reduces duty cycle (long sleep) and increases latency for asynchronous nodes.
  • Diagrams to draw on exam (describe exactly):

    1. For S‑MAC: draw a time axis showing repeated cycles; mark listen period (L) then sleep period (S); show two neighbouring nodes with aligned and misaligned schedules; label SYNC exchange during overlapping listen times and show message passing fragments sent consecutively in one listen period.
    2. For 802.15.4 superframe: draw BI as a large rectangle, inside draw SD as a smaller left rectangle; inside SD, label Beacon, CAP and optional CFP (with up to 7 GTS slots). Annotate BO and SO and write formulas BI = aBaseSuperframeDuration×2^BO and SD = aBaseSuperframeDuration×2^SO.

Formulas

D = L / (L + S) — D is the duty cycle (dimensionless fraction). L = listen period (s), S = sleep period (s). Applies to periodic listen/sleep MACs (e.g., S‑MAC).

P_avg = D·P_active + (1 − D)·P_sleep — P_avg is average radio power (W). P_active is power when radio is on (W), P_sleep is power when radio is off or in sleep (W). Use to estimate average energy drain.

BI = aBaseSuperframeDuration × 2^BO — BI is Beacon Interval (s). aBaseSuperframeDuration is base superframe (s) (see note), BO is Beacon Order (integer). Applies in IEEE 802.15.4 beacon‑enabled mode.

SD = aBaseSuperframeDuration × 2^SO — SD is Superframe Duration (s). SO is Superframe Order (integer), SO ≤ BO.

Duty cycle (802.15.4) = SD / BI = 2^(SO−BO) — dimensionless.

Energy per cycle = P_active·L + P_sleep·S — energy consumed per cycle (J), where L and S in seconds.

Notes: aBaseSuperframeDuration = aBaseSlotDuration × aNumSuperframeSlots. For the 2.4 GHz PHY, aBaseSlotDuration = 60 symbols and aNumSuperframeSlots = 16, so aBaseSuperframeDuration = 15.36 ms. The symbol duration depends on PHY (for 2.4 GHz, symbol = 16 μs).

Worked examples

Example 1 — IEEE 802.15.4 BI/SD and duty cycle (numerical): Given: aBaseSuperframeDuration = 15.36 ms (2.4 GHz band), BO = 6, SO = 4. Steps:

  1. BI = 15.36 ms × 2^6 = 15.36 × 64 ms = 983.04 ms.
  2. SD = 15.36 ms × 2^4 = 15.36 × 16 ms = 245.76 ms.
  3. Duty cycle = SD / BI = 245.76 / 983.04 = 0.25 = 25%. Final answer: BI = 983.04 ms, SD = 245.76 ms, duty cycle = 25%.

Example 2 — S‑MAC average power and battery life (numerical): Given: a sensor node uses a radio that consumes P_active = 60 mW when on and P_sleep = 0.6 mW when sleeping. The node uses a schedule with L = 300 ms listen, S = 900 ms sleep. Steps:

  1. Duty cycle D = L/(L+S) = 0.300 / (0.300 + 0.900) = 0.300 / 1.200 = 0.25.
  2. Average power P_avg = D·P_active + (1−D)·P_sleep = 0.25·60 mW + 0.75·0.6 mW = 15 mW + 0.45 mW = 15.45 mW.
  3. If battery capacity is 2000 mAh at 3.7 V, energy available = 2.0 Ah × 3.7 V = 7.4 Wh = 7.4 × 3600 = 26640 J. Average power 15.45 mW = 0.01545 W. Lifetime ≈ 26640 J / 0.01545 W ≈ 1,724,272 s ≈ 479.0 hours ≈ 20.0 days. Final answer: P_avg = 15.45 mW, estimated battery lifetime ≈ 20.0 days. (Show assumptions: constant radio state percentages, other electronics ignored.)

Example 3 — S‑MAC message passing trace (protocol trace): Network: Node A wants to send a 900‑byte message to Node D via A→B→D; fragment size = 100 bytes; both B and D share a listen period with A. Describe steps:

  1. A wakes at listen time, SYNC known. A begins fragment 1 to B (CSMA, optional RTS/CTS). B receives and immediately forwards to D in same listen period (message passing: avoid recontending per fragment). Continue until fragments finish or listen period ends. If remaining fragments exceed listen period, remaining fragments queued and sent next listen time; latency increases by one sleep period.
  2. Show how an intermediate node overhearing destined-for header sleeps to avoid overhearing. This trace demonstrates lower end‑to‑end latency from consecutive fragment forwarding and reduced contention per fragment.

Common mistakes

  • Forgetting the requirement SO ≤ BO when computing BI/SD (leads to impossible duty cycles).
  • Thinking S‑MAC is strict TDMA — it is not; it is periodic listen/sleep with CSMA during listen. S‑MAC does not provide hard real‑time slot guarantees.
  • Forgetting to include sleep power (P_sleep) in average power calculations — sleep is not zero power.
  • For 802.15.4: assuming unlimited GTS or more than 7 GTS — standard limits GTS to 7 in CFP.

For your exam

Typical question types and what full‑marks answers include:

  • Definitions and short notes: define terms (duty cycle, SYNC, superframe, BO/SO, slotted CSMA‑CA) and list key tradeoffs. Include one short diagram if asked.
  • Derivations: show step‑by‑step derivations for BI/SD formulas, duty cycle, and average power expressions. State assumptions (e.g., two radio states; fixed listen/sleep lengths).
  • Numericals: compute BI/SD/duty cycle or average power/battery life given P_active, P_sleep, L and S. Carry units, show intermediate steps and final unit.
  • Protocol traces/algorithms: for S‑MAC trace the time order of SYNC, listen, RTS/CTS, message passing fragments, sleep. Label timings and explain where latency occurs.
  • Comparison/analysis: discuss when to choose S‑MAC mechanisms vs IEEE 802.15.4 beacon mode (tradeoffs: energy vs latency vs network coordination complexity). Use concrete points and examples.

Quick check

  1. Define duty cycle in a listen/sleep MAC.
  2. For IEEE 802.15.4 with BO = SO, what is the duty cycle?
  3. Name two mechanisms S‑MAC uses to save energy besides duty cycling. Answers: D = L/(L+S); duty cycle = 1 (100%) when BO = SO; SYNC (schedule exchange) and overhearing avoidance (or message passing).

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

Stuck on something here?