41  Data Representation Fundamentals

41.1 Learning Objectives

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

  • Convert between number systems: Translate numbers between binary, decimal, and hexadecimal
  • Understand data sizing: Explain bits, bytes, and word sizes in computing
  • Work with text encoding: Describe ASCII, Unicode, and UTF-8 for IoT applications
  • Apply endianness concepts: Identify big-endian vs little-endian byte ordering
  • Perform bitwise operations: Use AND, OR, XOR, shifts, and masks for IoT programming
  • Read protocol specifications: Interpret hexadecimal values in datasheets and protocol docs
TipConnect with Learning Hubs

Explore Further: - Knowledge Map: See where data representation fits in the IoT landscape at Knowledge Map - Simulations: Try the Protocol Comparison Tool to see format overhead differences - Quizzes: Test your understanding with Fundamentals Quizzes - Videos: Watch encoding/decoding demonstrations in the Video Gallery


41.2 Topic Overview

Data representation is the foundation of all IoT programming. Every sensor reading, protocol header, memory address, and configuration value is ultimately stored as patterns of 0s and 1s. Mastering these concepts enables you to read datasheets, debug protocols, and write efficient embedded code.

This topic is divided into three focused chapters:

41.2.1 1. Number Systems and Data Units

Difficulty: Beginner | ~18 minutes

Learn the three number systems essential for IoT development:

  • Binary (Base 2): How computers store and process all data
  • Decimal (Base 10): Human-friendly representation for debugging
  • Hexadecimal (Base 16): Compact notation where each digit = 4 binary bits
  • Bits, Bytes, Words: Understanding data sizing and processor architectures
  • Conversion Practice: Step-by-step methods for translating between systems

Start with Number Systems β†’


41.2.2 2. Text Encoding for IoT

Difficulty: Intermediate | ~10 minutes

Understand how text becomes numbers in IoT systems:

  • ASCII: The original 7-bit standard (128 characters)
  • Unicode and UTF-8: Universal character encoding for all languages
  • Data Format Efficiency: Comparing JSON, CBOR, and binary encodings
  • Common Pitfalls: Buffer sizing, encoding mismatches, and garbled text

Continue to Text Encoding β†’


41.2.3 3. Bitwise Operations and Endianness

Difficulty: Intermediate | ~21 minutes

Master the low-level skills for hardware programming:

  • Endianness: Big-endian (network) vs little-endian (Intel/ARM) byte ordering
  • Bitwise AND, OR, XOR, NOT: Fundamental operations with truth tables
  • Bit Manipulation Patterns: Setting, clearing, toggling, and checking bits
  • Real-World Examples: Sensor status bytes, LoRaWAN flag packing, cross-platform bugs
  • Python struct Module: Binary data parsing for server-side code

Master Bitwise Operations β†’


41.3 Key Takeaway

In one sentence: All IoT data - sensor readings, addresses, protocol headers - is ultimately binary, and mastering hex notation lets you read it efficiently since each hex digit represents exactly 4 binary bits.

Remember this rule: When debugging IoT systems, think in hex (0x prefix) for compact notation, but remember endianness matters - network protocols use big-endian (MSB first) while most ARM/Intel processors use little-endian (LSB first).


41.4 Prerequisites

This topic is an early foundation. You can start with:

  • General familiarity with decimal numbers and basic arithmetic
  • No prior IoT, electronics, or programming experience required

41.6 What’s Next

Recommended Learning Path:

  1. Number Systems and Data Units - Start here for foundational concepts
  2. Text Encoding for IoT - Understand character encoding
  3. Bitwise Operations and Endianness - Master hardware-level programming

After completing this topic, continue to Packet Structure and Framing to learn how data gets packaged for network transmission.