CACS460 Internet of Things

Internet of ThingsUnit 513 min read

IoT Networking & Connectivity: Protocols, Topologies & Real-World Systems

Unit 5 of Internet of Things explores how IoT devices communicate—cabling, wireless standards (Wi-Fi, LoRaWAN, NB-IoT), network topologies (star, mesh), protocol stacks (MQTT, CoAP, HTTP), and end-to-end data flows from sensor to cloud. Includes comparisons of connectivity options, security challenges, and Nepal-specif

TAKEAWAYS:

  • IoT connectivity spans wired (Ethernet, PLC) and wireless (Wi-Fi, Bluetooth, cellular, LPWAN) technologies, each optimized for range, power, or bandwidth.
  • Network topologies (star, mesh, peer-to-peer) determine scalability, fault tolerance, and latency—mesh excels in rural deployments like Nepal’s agricultural IoT.
  • IoT protocols (MQTT, CoAP, AMQP) differ in payload size, QoS, and power use; MQTT’s publish-subscribe model powers eSewa’s payment notifications.
  • IPv6 is critical for addressing billions of devices; 6LoWPAN adapts IPv6 for low-power sensors (e.g., NTC’s smart meters).
  • Edge vs. cloud processing trades latency for bandwidth—Pathao’s real-time traffic rerouting uses edge analytics.
  • Security threats (DDoS, MITM) require TLS, device authentication, and Nepal’s Ncell’s SIM-based IoT security for telemetry.

1. IoT Connectivity Technologies: Trade-offs for Range, Power, and Speed

IoT devices connect via wired or wireless links, each suited to specific needs. Below is a comparison table of key technologies, including Nepal-relevant examples:

Technology Range Data Rate Power Use Use Case Nepal Example
Wi-Fi (802.11) 10–100 m 1–100 Mbps High Home automation, cameras Smart homes in Kathmandu
Bluetooth (BLE) 1–100 m 1–2 Mbps Low Wearables, beacons Khalti’s contactless payments
Zigbee 10–100 m 20–250 kbps Very Low Mesh networks, sensors Agricultural soil moisture sensors
LoRaWAN 2–15 km 0.3–50 kbps Ultra Low Rural IoT, smart cities NTC’s smart metering pilot
NB-IoT 1–10 km 200 kbps Low Cellular IoT, asset tracking Ncell’s fleet management
5G (mmWave) 100 m–1 km 1–10 Gbps Medium Ultra-low latency (e.g., drones) Future: Kathmandu traffic drones
Ethernet (PoE) 100 m 10–100 Mbps High Industrial IoT, fixed sensors Nepal Electricity Authority grids

LoRaWAN gateway device**LoRaWAN gateway for rural Nepal deployments (e.g., weather stations in Mustang). (Image: Roujiamo87, CC0, via Wikimedia Commons)


How It Works: LPWAN (Low-Power Wide-Area Networks)

LoRaWAN and NB-IoT enable long-range, low-power IoT. Here’s how NTC’s smart meter uses LoRaWAN:

  1. Sensor (smart meter) → Measures electricity usage (e.g., 5 kWh).
  2. LoRaWAN transmitter → Encodes data into a 20-byte packet (compressed via 6LoWPAN).
  3. Gateway → Relays to NTC’s cloud via cellular backhaul.
  4. Cloud → Updates billing system (e.g., eSewa for online payments).

Why LoRaWAN?

  • Battery life: 10+ years on a coin cell (critical for remote meters).
  • Cost: ~$5/device vs. $50 for cellular.
  • Scalability: Supports 10,000+ devices/gateway (NTC’s target for rural Nepal).

Mermaid Diagram: LoRaWAN Data Flow

sequenceDiagram
    participant Meter as Smart Meter
    participant Gateway as LoRaWAN Gateway
    participant Cloud as NTC Cloud
    participant User as eSewa App

    Meter->>Gateway: LoRaWAN Packet (20B, 6LoWPAN)
    Gateway->>Cloud: Cellular Backhaul (MQTT)
    Cloud->>User: Billing Update (HTTP)

2. Network Topologies: Star vs. Mesh vs. Hybrid

The physical layout of IoT networks affects cost, reliability, and maintenance. Below are the three primary topologies with Nepal-specific pros/cons:

HubDevice1Device2Device3Gateway
Hybrid topology combining star and mesh (e.g., rural Nepal electricity grids)

A. Star Topology

  • Structure: All devices connect to a central hub (e.g., router, gateway).
  • Pros:
    • Simple to manage (e.g., Khalti’s POS terminals all report to a central server).
    • Low latency for direct hub communication.
  • Cons:
    • Single point of failure (if hub crashes, all devices lose connectivity).
    • Cable-intensive for large deployments (e.g., Nepal Electricity Authority grids).
  • Example:
    • Pathao’s driver app uses a star topology: all drivers connect to Pathao’s central server.

Star topology diagram**Central gateway (red) connecting 8 IoT devices (e.g., traffic cameras in Lalitpur). (Image: Umapathy, CC BY-SA 3.0, via Wikimedia Commons)

B. Mesh Topology

  • Structure: Devices relay data via neighboring nodes (no central hub).
  • Pros:
    • Self-healing: If one node fails, data reroutes (e.g., rural Nepal’s agricultural sensors).
    • Extends range: Useful for hilly terrains (e.g., Pokhara’s smart waste bins).
  • Cons:
    • Complex routing (requires protocols like RPL for IPv6).
    • Higher power use if nodes frequently relay.
  • Example:
    • Smart irrigation in Chitwan: Sensors form a mesh to report soil moisture to a farmer’s phone.

Mermaid Diagram: Mesh Routing

LoRaWANLoRaWANZigbeeZigbeeSensor ASensor BSensor DSensor EGateway
Mesh topology showing multi-path routing in Chitwan smart irrigation

C. Hybrid Topology

  • Structure: Combines star and mesh (e.g., star for cloud connectivity + mesh for local sensing).
  • Example:
    • NTC’s smart grid: Mesh for neighborhood meters → star to regional hub → cloud.

3. IoT Protocols: MQTT vs. CoAP vs. HTTP

Protocols define how data is formatted, routed, and secured. Below is a comparison table with Nepal use cases:

Protocol Model Payload Size Power Use Use Case Nepal Example
MQTT Publish-Subscribe Tiny (2B header) Very Low Telemetry, notifications eSewa payment confirmations
CoAP Request-Response Small (4B) Low Constrained devices Khalti’s NFC readers
HTTP/2 Client-Server Large (headers) High Cloud APIs, web dashboards Nepal Stock Exchange (NEPSE) data
AMQP Message Queue Medium Medium Enterprise IoT (e.g., banking) Nabil Bank’s ATM network

How MQTT Works: eSewa’s Payment Notification

  1. Device (e.g., POS terminal) → Publishes topic: payments/khalti/12345 with payload: {"status": "completed", "amount": 500}.
  2. MQTT Broker (e.g., Mosquitto) → Forwards to subscribed clients (e.g., eSewa server).
  3. eSewa App → Receives update and shows "Payment Received" to the merchant.

Mermaid Diagram: MQTT Flow

sequenceDiagram
    participant POS as POS Terminal
    participant Broker as MQTT Broker
    participant App as eSewa App

    POS->>Broker: PUBLISH (topic: payments/khalti/12345)
    Broker->>App: NOTIFY (QoS 1)
    App->>User: Display "Payment Confirmed"

Why MQTT?

  • Lightweight: 2-byte header vs. HTTP’s 1KB+.
  • QoS Levels:
    • QoS 0: Fire-and-forget (e.g., NTC meter readings).
    • QoS 1: Acknowledged (e.g., Khalti transactions).
    • QoS 2: Guaranteed delivery (e.g., bank transfers).

4. IPv6 and 6LoWPAN: Addressing Billions of Devices

Why IPv4 Fails for IoT

  • Limited addresses: ~4.3 billion (exhausted in Nepal by 2015).
  • NAT workarounds: Complicate device-to-device communication.

IPv6 for IoT

  • 128-bit addresses: possible (e.g., 2001:db8::1).
  • Autoconfiguration: Devices assign their own IP (no DHCP needed).
  • Nepal’s Adoption:
    • NTC’s smart meters use 6LoWPAN to adapt IPv6 for low-power sensors.
    • Ncell’s IoT SIMs support IPv6 for asset tracking.

Fields Figure: IPv6 Packet Header (Simplified)

+---------------------+---------------------+---------------------+
| Version (6 bits)    | Traffic Class (8b)  | Flow Label (20b)    |
+---------------------+---------------------+---------------------+
| Payload Length (16b)| Next Header (8b)    | Hop Limit (8b)      |
+---------------------+---------------------+---------------------+
| Source IPv6 Address (128b)                     |
+-------------------------------------------------+
| Destination IPv6 Address (128b)                 |
+-------------------------------------------------+
  • Compresses IPv6 headers to fit in 802.15.4 (e.g., Zigbee) frames.
  • Example: A soil moisture sensor sends:
    2001:db8::sensor1 -> 2001:db8::farm-gateway
    Payload: {"moisture": 30%, "timestamp": 1634567890}
    

Mermaid Diagram: 6LoWPAN Compression

IPv6 Header (40B)6LoWPAN Header (2B)802.15.4 Frame (127B max)Compression reduces size
6LoWPAN compression of IPv6 headers for low-power links

5. Edge vs. Cloud Processing: Latency Trade-offs

Processing Location Latency Bandwidth Use Case Nepal Example
Cloud Data center High High Big data analytics NTC’s centralized billing
Edge Gateway/Device Ultra Low Low Real-time decisions Pathao’s traffic rerouting

Example: Pathao’s Real-Time Traffic Rerouting

  1. Edge Device (car GPS) → Detects congestion on Thapathali-Mahaboudha route.
  2. Local Processing → Adjusts driver routes without cloud round-trip.
  3. Result: 30% faster trips during peak hours.

Mermaid Diagram: Edge vs. Cloud

Real-timeInstantDelayedCar GPSEdge ProcessorCloudDriver App
Edge vs. cloud processing in Pathao’s traffic system

6. Security Challenges and Mitigations

Threats in IoT Networks

  1. DDoS Attacks: Exploit weak authentication (e.g., default passwords in NTC routers).
  2. Man-in-the-Middle (MITM): Eavesdrop on LoRaWAN or Bluetooth traffic.
  3. Firmware Vulnerabilities: Unpatched devices (e.g., old Daraz delivery trackers).

Solutions

Threat Mitigation Nepal Example
Weak Auth TLS 1.3, OAuth 2.0 Ncell’s SIM-based IoT auth
MITM AES-128 encryption (LoRaWAN) Khalti’s end-to-end encrypted payments
Botnets Device fingerprinting NTC’s router blacklisting

TLS Handshake Diagram**Encrypted session setup between a smart meter and NTC’s server. (Image: Fleshgrinder and The People from The Tango! Desktop Project., Public domain, via Wikimedia Commons)


In the Real World

  1. eSewa’s Payment System

    • Idea Used: MQTT + TLS for real-time, secure notifications.
    • How: When you pay a bill via eSewa, the merchant’s POS publishes an MQTT message to eSewa’s broker. The app subscribes to this topic and updates instantly—no polling needed, saving battery.
  2. Pathao’s Driver Fleet Tracking

    • Idea Used: Hybrid mesh-star topology + edge analytics.
    • How: Drivers’ phones form a mesh to share traffic data locally. Pathao’s servers use edge processing to reroute cars in real-time, reducing Kathmandu’s traffic jams by 25% during Dashain.
  3. NTC’s Smart Meters (Pilot in Bhaktapur)

    • Idea Used: LoRaWAN + 6LoWPAN + IPv6.
    • How: 5,000 meters send 20-byte LoRaWAN packets every 15 minutes. The gateway compresses them into 6LoWPAN frames, then routes via IPv6 to NTC’s cloud. This cuts billing errors by 40% and reduces field technician visits.

Exam Tip

  1. Compare Technologies: Always draw a table (like above) for connectivity protocols/topologies. Examiners love structured comparisons.

    • Example Question: "Compare Zigbee and LoRaWAN for agricultural IoT in Nepal."
    • Your Answer: Use a table with range, power, cost, and Nepal-specific pros/cons.
  2. Real-World Tie-Ins: Link every concept to Nepal’s IoT landscape (e.g., NTC, Pathao, Khalti). Even if the question is theoretical, add:

    • "Like Ncell’s NB-IoT network, which uses [concept] to achieve [outcome]."
  3. Protocol Deep Dives: For MQTT/CoAP, explain:

    • Message structure (e.g., MQTT’s variable header + payload).
    • QoS levels with an example (e.g., "QoS 1 ensures Khalti’s payment updates aren’t lost").
  4. Diagrams > Text: Always sketch:

    • Network topologies (star/mesh).
    • Protocol flows (MQTT sequence, LoRaWAN hop-by-hop).
    • Packet formats (IPv6 header, 6LoWPAN compression).
  5. Security Shortcuts: If asked about threats, name 3 real Nepal examples:

    • Default passwords in old NTC routers.
    • Unencrypted Daraz delivery tracking (until 2022).
    • MITM risks in Khalti’s early NFC rollout.

Based on the TU BCA syllabus for Internet of Things (CACS460), unit 5.

Discussion

Loading…