643  Data Representation in Networks

643.1 Learning Objectives

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

  • Understand Binary Representation: Explain how bits represent information using only 1s and 0s
  • Convert Between Units: Work with bytes, kilobytes, megabytes, and other data size units
  • Interpret Network Speeds: Distinguish between bits per second (network capacity) and bytes (storage)
  • Apply to IoT Contexts: Calculate data transfer requirements for common IoT scenarios

643.2 Prerequisites

Before diving into this chapter, you should be familiar with:

ImportantWhy Data Representation Matters for IoT

Every byte counts in IoT. Constrained devices have limited memory (often kilobytes, not megabytes), and wireless protocols like LoRaWAN support only 51-242 bytes per packet. Understanding how data is represented and sized helps you design efficient IoT systems that work within these constraints.

At its core, all digital communication comes down to ones and zeros. A bit is the smallest unit of data - like a light switch that’s either on (1) or off (0). When we group 8 bits together, we get a byte, which is enough to represent a single letter, number, or small value.

Think of it like this: - 1 bit = A single yes/no answer - 1 byte (8 bits) = One character like ‘A’ or ‘7’ - 1 kilobyte (1,024 bytes) = A short text message - 1 megabyte (1,024 KB) = A photograph - 1 gigabyte (1,024 MB) = A short video

Understanding these building blocks helps you estimate how much data your IoT sensors will generate and how long it takes to transmit.


643.3 Bits and Bytes: The Language of Networks

643.3.1 Binary Representation

Digital computers and communication systems represent all data as BITs - binary digits with only two values: 1 (one) and 0 (zero).

%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#E67E22', 'secondaryColor': '#16A085', 'tertiaryColor': '#E8F6F3', 'clusterBkg': '#E8F6F3', 'clusterBorder': '#16A085', 'fontSize': '14px'}}}%%
graph LR
    subgraph Byte["1 Byte = 8 Bits"]
        B7["1"]
        B6["0"]
        B5["1"]
        B4["0"]
        B3["1"]
        B2["0"]
        B1["0"]
        B0["0"]
    end

    Decimal["Decimal: 168"]
    Char["Character: 'A'<br/>(ASCII 65)"]

    B7 --> Decimal
    Char --> Decimal

    style B7 fill:#2C3E50,stroke:#16A085,color:#fff
    style B6 fill:#7F8C8D,stroke:#2C3E50,color:#fff
    style B5 fill:#16A085,stroke:#2C3E50,color:#fff
    style B4 fill:#7F8C8D,stroke:#2C3E50,color:#fff
    style B3 fill:#E67E22,stroke:#2C3E50,color:#fff
    style B2 fill:#7F8C8D,stroke:#2C3E50,color:#fff
    style B1 fill:#7F8C8D,stroke:#2C3E50,color:#fff
    style B0 fill:#7F8C8D,stroke:#2C3E50,color:#fff
    style Decimal fill:#16A085,stroke:#2C3E50,color:#fff
    style Char fill:#E67E22,stroke:#2C3E50,color:#fff

Figure 643.1: Binary byte representation showing 8 bits and decimal/ASCII conversion

{fig-alt=“Diagram showing one byte composed of 8 bits (10101000 binary) representing decimal value 168 and ASCII character encoding”}

Why binary? - Simple: Only two states to detect - Fast: Can be processed at extremely high speeds - Reliable: Less prone to errors than multi-level systems - Universal: Any information can be represented

643.3.2 Bytes and Data Sizes

8 bits = 1 BYTE - used to represent a single character or value

Common data sizes in IoT:

Unit Size Example Usage
Byte (B) 8 bits Single sensor reading
Kilobyte (KB) 1,024 bytes Small JSON message
Megabyte (MB) 1,024 KB Firmware update file
Gigabyte (GB) 1,024 MB Daily sensor data collection
Terabyte (TB) 1,024 GB Annual IoT platform storage

Real-world examples: - 55 MB document file - 16 GB microcontroller memory - 2 TB hard disk drive

643.3.3 Network Data Rates

Network capacity is measured in bits per second (bps or b/s):

Connection Type Data Rate IoT Use Case
LoRaWAN 0.3-50 kb/s Long-range sensors
BLE 1-2 Mb/s Wearables, beacons
Wi-Fi 10-1000 Mb/s Smart home devices
5G 100-1000 Mb/s Autonomous vehicles
Gigabit Ethernet 1 Gb/s Industrial IoT gateways
NoteBits vs Bytes: Common Confusion

Storage uses Bytes (B): “16 GB memory card” Network speed uses bits (b): “100 Mb/s Wi-Fi”

To convert: 1 Byte = 8 bits, so 100 Mb/s = 12.5 MB/s

643.3.4 Binary to Decimal Conversion

For human readability, binary is converted to decimal:

Examples: - 1010 binary = 10 decimal - 1000 1010 binary = 138 decimal

Learn binary number systems: Intro to Binary Numbers

Essential for understanding how IoT devices encode and transmit data.


643.4 IoT Data Size Considerations

643.4.1 Constrained Device Memory

IoT devices operate with severely limited resources compared to traditional computers:

Device Class Typical RAM Typical Flash Example
Class 0 < 10 KB < 100 KB Sensor tags
Class 1 ~10 KB ~100 KB Basic sensors
Class 2 ~50 KB ~250 KB Smart sensors
Gateway 256 MB+ 1 GB+ Edge processors

This means every byte in your protocol matters. A 1 KB JSON message that seems small on a web server represents 10% of available RAM on a Class 1 device.

643.4.2 Protocol Overhead Impact

When transmitting small sensor readings, protocol overhead becomes significant:

Temperature reading: 4 bytes (float)
+ JSON formatting: ~20 bytes ({"temp":23.5})
+ MQTT overhead: ~2 bytes minimum
+ TCP/IP headers: 40 bytes
+ Ethernet frame: 26 bytes
---------------------------------
Total: ~92 bytes for 4 bytes of data
Protocol efficiency: 4.3%

For IoT, binary protocols (CoAP, MQTT) and efficient encoding (CBOR, Protocol Buffers) can dramatically improve efficiency.


643.5 Knowledge Check

Question: A LoRaWAN sensor sends 20-byte temperature readings every 10 minutes over a 1 kb/s link. What is the channel utilization?

Explanation: Channel utilization = (bits transmitted / bits available). 20 bytes = 160 bits. At 1 kb/s, in 10 minutes (600 seconds), 600,000 bits could be transmitted. Utilization = 160 / 600,000 = 0.000267 = 0.027%. This extremely low utilization is typical for IoT - devices send small amounts of data infrequently, making shared wireless channels very efficient for many devices.


643.6 Summary

  • Bits are the foundation of all digital communication, representing data as 1s and 0s
  • 8 bits = 1 byte, with data sizes scaling through KB, MB, GB, TB
  • Network speeds use bits (100 Mb/s) while storage uses bytes (100 MB) - remember to convert (divide by 8)
  • IoT devices are constrained - Class 0/1 devices have only 10-100 KB of memory
  • Protocol overhead matters - small sensor readings can have 90%+ overhead from headers

643.7 What’s Next

Now that you understand how data is represented digitally, the next section explores how this data is packaged into datagrams for transmission across networks. You’ll learn about packet structure, headers, payloads, and how large data is fragmented into manageable pieces.

Continue to: Datagrams and Packet Structure