14  Smart Building Example

In 60 Seconds

Systematic IoT architecture design maps 750+ devices (sensors, HVAC, meters) across all 7 layers, starting from Layer 1 device inventory and data rates. Latency requirements determine the edge/cloud split: sub-2-second responses belong at Layer 3 (edge), batch analytics at Layer 5 (cloud). Edge processing on each floor reduces cloud data by 90% (750 readings/sec to 75 summaries/sec), directly driving Layer 4 storage architecture decisions.

Minimum Viable Understanding
  • Systematic layer mapping starts from Layer 1 (device inventory and data rates), moves through connectivity and edge processing decisions, and ends with human workflows at Layer 7.
  • Latency requirements determine the edge/cloud split: if a response must happen in under 2 seconds, that logic belongs at Layer 3 (edge), not Layer 6 (cloud application).
  • Data volume calculations at Layer 1 directly drive storage architecture at Layer 4 – always calculate your peak data rate before choosing databases and retention policies.

The Sensor Squad has been hired to design an IoT system for an office building. Let us see how they approach it!

Sammy the Sensor starts: “First, let me count all the devices: 500 occupancy sensors, 200 HVAC units, and 50 energy meters. That is 750 things on Floor 1!”

Max the Microcontroller does the math: “At peak, that is about 750 readings per second. If I process locally on each floor, I can reduce that to 75 summaries per second before sending to the cloud. That saves 90% of bandwidth!”

Lila the LED plans the dashboard: “The building manager wants to see real-time occupancy maps and energy charts. But I do not need to know whether a sensor is Zigbee or Modbus – the API (Layer 5) translates everything into the same format for me.”

Bella the Battery has a crucial question: “When someone walks into a room, how fast does the HVAC need to respond?” The answer is under 2 seconds. “Then that logic MUST run locally at the edge, not in the cloud. Cloud round-trips take too long!”

This is exactly how real architects design IoT systems: layer by layer, starting with devices and ending with people.

14.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Map real-world systems to the 7-layer IoT reference model systematically
  • Calculate data volumes and derive storage requirements for IoT deployments
  • Design layer-appropriate APIs that abstract underlying storage complexity
  • Produce complete architecture documentation covering all seven layers for implementation

Key Concepts

  • Requirements Analysis: Systematic identification of functional needs (what the system must do) and non-functional constraints (performance, availability, security, cost) before selecting architectural components
  • Protocol Selection Matrix: A decision table mapping deployment requirements (range, power, data rate, cost, topology) to candidate protocols, eliminating options that fail any critical constraint
  • Data Flow Diagram: A graphical representation showing how data moves from sensors through gateways and processing to storage and visualization, revealing integration points and potential bottlenecks
  • Failure Mode Analysis: Systematic enumeration of what happens when each component fails, verifying that the system degrades gracefully or triggers appropriate alerts for each failure scenario
  • Deployment Diagram: An architectural view showing physical or virtual nodes (devices, gateways, cloud regions, containers) and the communication paths between them capturing infrastructure topology
  • Requirements Traceability Matrix: A table linking each functional and non-functional requirement to the specific architectural component or design decision that satisfies it, ensuring complete coverage

14.2 Introduction

This worked example walks through the complete process of mapping a commercial building IoT system to the Cisco 7-layer reference model. Follow along step-by-step to understand how architectural decisions are made at each layer.

The scenario represents a common enterprise IoT deployment with multiple sensor types, real-time control requirements, and long-term data retention needs.

A worked example shows the complete solution process, not just the final answer. Like watching a chef prepare a dish step-by-step, you’ll see:

  1. The problem statement - What we’re trying to build
  2. The analysis process - How we break down requirements
  3. Design decisions - Why we choose specific technologies
  4. The complete solution - All layers documented

This is how real architects approach IoT system design.

14.3 Worked Example: Mapping a Smart Building System

Problem Statement

Scenario: You are architecting an IoT system for a commercial office building with 500 occupancy sensors, 200 HVAC control units, and 50 energy meters. The building manager wants a dashboard showing real-time occupancy, automated climate control, and monthly energy reports. Map this system to the Cisco 7-layer reference model.

Given Requirements:

  • 750 total sensors/actuators across 15 floors
  • Requirement: <2 second response for HVAC adjustments based on occupancy
  • Data retention: 2 years of historical data for energy compliance reporting
  • Users: Building manager, maintenance team, energy consultants (external)

14.3.1 Step 1: Identify Layer 1 (Physical Devices)

The first step is to inventory all physical devices and understand their data characteristics.

Device Inventory:

Device Type Count Data Rate Protocol Output
Occupancy (PIR) 500 1 Hz (motion events) Zigbee Boolean + timestamp
HVAC controllers 200 0.1 Hz (setpoint changes) BACnet Temperature, fan speed
Energy meters 50 1 Hz (power readings) Modbus kW, kWh, power factor

Data Volume Calculation:

Peak readings = 500 + (200 x 0.1) + 50 = 570 readings/second average
Peak with simultaneous events = 751 readings/second

Layer 1 Result: The perception layer generates approximately 570-751 readings/second at peak.

Interactive: IoT Data Volume Calculator

Adjust the device counts below to see how data volume and storage requirements scale.

Design Decision: Protocol Selection

Why different protocols for different devices?

  • Zigbee for occupancy: Battery-powered devices need low-power mesh networking
  • BACnet for HVAC: Industry standard, existing building infrastructure uses it
  • Modbus for meters: Simple, reliable, meters are wired anyway

14.3.2 Step 2: Design Layer 2 (Connectivity)

Layer 2 handles protocol translation and network topology.

Network Architecture:

Smart building Layer 2 connectivity diagram showing Zigbee mesh network connecting 500 occupancy sensors, BACnet/IP network connecting 200 HVAC controllers, Modbus TCP connecting 50 energy meters, and floor-level MQTT brokers aggregating all three protocol streams before forwarding to edge gateways

Smart building Layer 2 network topology showing Zigbee mesh for occupancy sensors, BACnet/IP for HVAC units, and Modbus TCP for energy meters, all converging to floor-level MQTT brokers that aggregate and route data upward.

Protocol Stack:

  • Zigbee mesh for 500 occupancy sensors (low power, self-healing)
  • BACnet/IP for HVAC (industry standard, existing infrastructure)
  • Modbus TCP for energy meters (reliable, simple)
  • MQTT broker at each floor aggregating all protocols

Key Design Decision: Protocol translation happens at the Layer 2/3 boundary via floor-level gateways. Each floor has its own MQTT broker, reducing inter-floor traffic and providing local redundancy.

14.3.3 Step 3: Design Layer 3 (Edge Computing)

Layer 3 determines what processing happens locally versus in the cloud.

Processing Location Analysis:

Processing Task Location Latency Requirement Rationale
Occupancy to HVAC trigger Floor gateway <2 sec Real-time control loop
Energy spike detection Floor gateway <5 sec Immediate alerts
Data aggregation (5-min rollups) Floor gateway N/A Reduce cloud bandwidth
ML occupancy prediction Cloud Minutes Requires historical data

Edge Hardware Selection:

Each floor has a Raspberry Pi 4 gateway running:

  • Node-RED: Local rule engine for real-time HVAC control
  • Mosquitto: MQTT broker for floor-level aggregation
  • InfluxDB (edge instance): 24-hour local buffer

Critical Insight: The <2 second HVAC response requirement forces occupancy-to-HVAC logic into Layer 3. If this went through the cloud, network latency alone (200-500ms round-trip) plus processing time would risk exceeding the 2-second SLA.

Common Mistake

A naive design might route all data through the cloud for simplicity. This would:

  1. Add 200-500ms latency (cloud round-trip)
  2. Fail the <2 second requirement during network congestion
  3. Stop working entirely during internet outages

Edge processing at Layer 3 solves all three issues.

14.3.4 Step 4: Design Layer 4 (Data Accumulation)

Layer 4 selects storage systems for different data types.

Storage Architecture:

Data Type Storage System Retention Access Pattern
Sensor readings InfluxDB (time-series) 30 days raw, 2 years aggregated Time-range queries
Device metadata PostgreSQL (relational) Permanent Key-value lookups
Configuration PostgreSQL Permanent Infrequent reads
Compliance archive S3/Glacier 2+ years Rare access, regulatory

Capacity Planning:

Daily data volume:
  = 751 readings/sec x 86,400 sec x 100 bytes/reading
  = 6.5 GB/day raw

Storage requirements:
  - 30-day raw: 195 GB
  - 2-year aggregated (1-min resolution): ~700 GB
  - Total with overhead: ~1 TB active + 4.7 TB archive

Data Lifecycle:

  1. Hot (0-7 days): Full resolution in InfluxDB, SSD storage
  2. Warm (7-30 days): Full resolution, HDD storage
  3. Cold (30 days - 2 years): 5-minute aggregates in S3
  4. Archive (2+ years): Glacier for compliance

Let’s calculate the 3-year total storage cost with vs. without tiered data lifecycle management.

Without tiering (all raw data on SSD InfluxDB):

\[V_{\text{3-year}} = 6.5\text{ GB/day} \times 1,095\text{ days} = 7,118\text{ GB} \approx 7.1\text{ TB}\]

Cloud-managed InfluxDB (SSD storage): $0.25/GB/month

\[C_{\text{no-tiering}} = 7,118\text{ GB} \times \$0.25 \times 36\text{ months} = \$64,062\]

With 4-tier lifecycle:

  1. Hot SSD (7 days raw): 6.5 GB × 7 = 45.5 GB @ $0.25/GB = $11/month
  2. Warm HDD (23 days raw): 6.5 GB × 23 = 150 GB @ $0.10/GB = $15/month
  3. Cold S3 (2 years, 5-min agg): 6.5 GB/day ÷ 5 (aggregation) × 730 days = 949 GB @ $0.023/GB = $22/month
  4. Archive Glacier (1 year so far): 6.5 GB × 365 = 2,373 GB @ $0.004/GB = $9.50/month

\[C_{\text{monthly}} = \$11 + \$15 + \$22 + \$9.50 = \$57.50/\text{month}\]

\[C_{\text{3-year}} = \$57.50 \times 36 = \$2,070\]

Savings: $64,062 - $2,070 = $61,992 (97% cost reduction!)

Break-even for lifecycle automation: Building the data lifecycle pipeline costs ~$8,000 (2 weeks engineering). Pays for itself in 4.6 months. Without tiering, this smart building’s data storage alone would cost $1,780/month — more than most SMB IT budgets!

14.3.5 Step 5: Design Layer 5 (Data Abstraction)

Layer 5 creates unified APIs that hide storage complexity from applications.

API Design:

# Current occupancy - queries InfluxDB
GET /api/v1/floors/{id}/occupancy/current
Response: { "floor": 5, "occupied_zones": 12, "total_zones": 20, "percentage": 60 }

# Historical energy - queries S3 archive
GET /api/v1/energy/report?start=2024-01&end=2024-12
Response: { "monthly_kwh": [...], "cost_breakdown": {...} }

# Device metadata - queries PostgreSQL
GET /api/v1/devices/{device_id}
Response: { "type": "occupancy", "floor": 5, "zone": "A", "last_seen": "..." }

Key Abstraction Benefit: The API consumer doesn’t know that:

  • Current occupancy comes from InfluxDB
  • Historical reports come from S3 archives
  • Device metadata comes from PostgreSQL

Adding a new storage backend (e.g., moving to TimescaleDB) requires zero application changes.

14.3.6 Step 6: Design Layer 6 (Application)

Layer 6 builds user-facing applications.

Application Portfolio:

Application Users Key Features
Operations Dashboard Building manager Real-time floor maps, HVAC override controls
Mobile Alerts App Maintenance team Push notifications for equipment faults
Energy Portal External consultants Monthly reports, trend analysis, compliance docs

Technology Stack:

  • Dashboard: React + Grafana for real-time visualization
  • Mobile App: React Native for cross-platform
  • Energy Portal: Django with scheduled report generation

14.3.7 Step 7: Design Layer 7 (Collaboration)

Layer 7 defines business processes triggered by IoT data.

Automated Workflows:

  1. Energy Alert Workflow:
    • Trigger: Energy consumption > 120% of baseline
    • Action: Email to facilities manager
    • Escalation: Work order in CMMS if not acknowledged in 4 hours
  2. HVAC Failure Workflow:
    • Trigger: Temperature drift > 5F from setpoint for 30+ minutes
    • Action: Immediate page to on-call technician
    • Escalation: If unresolved in 30 min, escalate to HVAC contractor
  3. Monthly Review Process:
    • Trigger: First business day of month
    • Action: Energy consultant receives automated report
    • Outcome: Schedules optimization review with building manager

14.4 Complete Architecture Summary

Complete 7-layer reference architecture for a smart office building showing Layer 1 physical devices (PIR sensors, HVAC controllers, energy meters), Layer 2 connectivity (Zigbee, BACnet, Modbus to MQTT), Layer 3 edge computing (Raspberry Pi gateways with Node-RED), Layer 4 data accumulation (InfluxDB, PostgreSQL, S3), Layer 5 abstraction (REST APIs), Layer 6 applications (dashboard, mobile, portal), and Layer 7 collaboration (automated workflows and escalations)
Figure 14.1: Complete 7-layer architecture for the smart building system

Architecture Summary Table:

Layer Components Key Technology
7 - Collaboration Workflows, escalations, reviews Slack, ServiceNow, Email
6 - Application Dashboard, mobile app, portal React, React Native, Grafana
5 - Abstraction REST APIs, data federation Node.js API, GraphQL
4 - Accumulation Time-series, relational, archive InfluxDB, PostgreSQL, S3
3 - Edge Local rules, aggregation Raspberry Pi, Node-RED
2 - Connectivity Protocol translation, routing MQTT, Zigbee, BACnet gateway
1 - Physical Sensors, actuators PIR, thermostats, meters

14.5 Key Insights from This Exercise

Critical Finding

The 7-layer analysis revealed that the <2 second HVAC response requirement forces occupancy-to-HVAC logic into Layer 3 (edge), not Layer 6 (cloud application).

Without this layered analysis, a naive design might route all data through the cloud, adding 200-500ms latency and failing the requirement.

Other Insights:

  1. Data volume planning at Layer 1 informs storage decisions at Layer 4
  2. Latency requirements determine the edge/cloud processing split at Layer 3
  3. API abstraction at Layer 5 enables future storage technology changes
  4. Workflow automation at Layer 7 closes the loop from data to action

14.6 Practice Exercise

Your Turn: Hospital Patient Monitoring

Apply the same 7-layer mapping process to this scenario:

Requirements:

  • 200 patient monitors (heart rate, SpO2, blood pressure)
  • 50 medication dispensers (automated dosing)
  • Real-time alerts to nursing stations (<1 second for critical vitals)
  • 7-year data retention (HIPAA compliance)
  • Integration with existing Electronic Health Record (EHR) system

Questions to Answer:

  1. What devices go in Layer 1? What protocols?
  2. Where does the <1 second alert requirement force processing?
  3. What storage strategy supports 7-year retention?
  4. How does Layer 5 integrate with the existing EHR?

14.7 Knowledge Check

When designing Layer 4 (Data Accumulation) for large-scale IoT deployments, choose storage tiers based on access patterns and retention requirements:

Hot Tier (0-7 days, SSD-backed time-series DB like InfluxDB):

  • Use when: Real-time dashboards query last 24-48 hours continuously
  • Access pattern: Thousands of queries per hour, sub-second latency required
  • Cost structure: $0.15-0.30/GB/month (expensive but fast)
  • Example: HVAC dashboard showing current building occupancy trends

Warm Tier (7-30 days, HDD-backed or hybrid storage):

  • Use when: Weekly reports aggregate data, operational analysis looks back 2-4 weeks
  • Access pattern: Dozens of queries per hour, 1-3 second latency acceptable
  • Cost structure: $0.05-0.10/GB/month (balanced)
  • Example: Energy consumption reports comparing this week to last week

Cold Tier (30 days - 2 years, object storage like S3 with aggregation):

  • Use when: Monthly/quarterly reports, compliance audits, trend analysis
  • Access pattern: Few queries per day, 5-30 second latency acceptable
  • Cost structure: $0.02-0.04/GB/month (cheap)
  • Aggregation: Store 5-minute or 1-hour rollups instead of raw readings
  • Example: Year-over-year energy comparison (720 hourly averages vs 2.6M raw readings)

Archive Tier (2+ years, Glacier-class storage):

  • Use when: Regulatory compliance requires long retention, rarely accessed
  • Access pattern: 1-5 queries per year, minutes to hours retrieval time acceptable
  • Cost structure: $0.004-0.01/GB/month (very cheap, retrieval fees apply)
  • Example: 7-year HIPAA compliance for medical device data

Real-world numbers (from smart building case study): - 751 readings/sec = 65M readings/day = 6.5 GB/day raw - Hot (7 days): 45 GB at $0.25/GB = $11.25/month - Warm (23 days): 150 GB at $0.08/GB = $12/month - Cold (23 months): 4,500 GB aggregated (90% reduction) at $0.03/GB = $135/month - Archive (5+ years): 9,000 GB at $0.005/GB = $45/month - Total storage cost: $203/month for 750 devices vs $4,875/month if everything in hot tier (96% savings)

Key decision point: Data volume at Layer 1 (751 readings/sec) directly determines Layer 4 architecture. Without tiered storage, cloud costs become prohibitive ($58K/year vs $2.4K/year).

Common Pitfalls

Designing a system that “reads temperature and stores it in the cloud” without specifying latency budget, uptime, device count, and security. Non-functional requirements drive 80% of architectural decisions and cannot be deferred.

Using device-to-cloud direct connection for systems that require mesh networking, or pub/sub for systems needing acknowledged command delivery. Match the communication pattern to the interaction model, not to familiar technology.

Designing an architecture without checking each requirement is satisfied. Create a requirements traceability matrix mapping each requirement to the component satisfying it.

Designing data paths without addressing day-2 operations — firmware updates, certificate rotation, device replacement, log analysis, and capacity planning. Production architectures must include operational tooling.

14.8 Summary

This worked example demonstrated the systematic process for mapping an IoT system to the 7-layer reference model:

  1. Layer 1: Inventory devices and calculate data volumes
  2. Layer 2: Design protocol translation and network topology
  3. Layer 3: Determine edge vs cloud processing based on latency requirements
  4. Layer 4: Select storage systems matching data characteristics and retention needs
  5. Layer 5: Design abstraction APIs that hide storage complexity
  6. Layer 6: Build user-appropriate applications
  7. Layer 7: Define automated workflows for human collaboration

The key takeaway is that reference models are practical tools, not just theoretical frameworks. They reveal requirements (like edge processing needs) that might otherwise be missed.

14.9 What’s Next

If you want to… Read this
Test your architecture knowledge with a quiz IoT Architecture Quiz
Practice with a hands-on lab IoT Architecture Lab
Study common architectural mistakes Common Pitfalls and Best Practices
Learn about production deployment Production Architecture Management
Explore QoS and service management QoS and Service Management