IoT Fundamentals · Study deck

From Bytes to Meaning

Picture a temperature value that keeps the same bytes after an update but silently changes units.

Physics Phoebe is your guide for this deck.

datarepresentation
Physics Phoebe, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: If you only need the intuition, this layer is enough: keep the original bytes as evidence, write down the rules used to decode them, and check the result against a plausible range.
  • Explain: They could be a price of ten dollars and fifteen cents, a time of 10:15, a year, a part number, or a temperature of 101.5 stored in tenths.
  • Explain: Walkthrough: From Raw Bytes to a Trusted Value Preserve the raw bytes.: Capture the original byte sequence before any tool formats or rounds it, so the evidence is not lost.
iotclass.org

Major section

In 60 Seconds

Firmware means the program stored on a device to control its hardware.

  • A payload means the part of a message that carries the application data.
  • The deeper sections explain bits, bytes, integers, text, floating point, packed fields, and schema changes.
  • Every IoT reading eventually becomes bytes.

Key terms

Data representation
Data representation is the name for those rules, and most "wrong value" bugs in IoT are really disagreements about them.
iotclass.org

Major section

Bytes Are Evidence, Meaning Is a Contract

They could be a price of ten dollars and fifteen cents, a time of 10:15, a year, a part number, or a temperature of 101.5 stored in tenths.

  • The digits are identical.
  • Bytes work the same way, one level lower: the bits are fixed, but their meaning depends on a shared agreement.

Key terms

Counting characters
Counting characters is not the same as counting the bytes they occupy.

Why it matters

Each boundary needs an agreed interpretation so that changing representation preserves the measurement.

Data representation reviews keep raw bytes visible while checking the contract that turns them into numbers, text, flags, or validated values.
Data representation reviews keep raw bytes visible while checking the contract that turns them into numbers, text, flags, or validated values.
iotclass.org

Major section

Bytes Are Evidence, Meaning Is a Contract (continued)

This gives: Bytes Are Evidence, Meaning Is a Contract evidence to revisit.

  • The important idea is not "store data efficiently." The important idea is agreement.
  • A useful first check is to ask what the bytes are allowed to become.
  • The wrong choice gives a different, often plausible, number.
iotclass.org

Major section

Bytes Are Evidence, Meaning Is a Contract (continued)

A number that "looks reasonable" is not proof that the rules were right.

  • The same sequence may be a scaled integer, a UTF-8 string, a group of status flags, or a structured payload field.
  • Each choice has different proof: numeric values need range checks, text needs byte-length checks, flags need bit labels, and structured fields need a schema version.
  • Beginner Examples The byte 0x50 is decimal 80, not decimal 50.
iotclass.org

Major section

Bytes Are Evidence, Meaning Is a Contract (continued)

Encoding and scale carry meaning Text needs an encoding, and raw integers usually need a scale and units before they become real measurements.

  • The middle column stores that count as a register value and packet bytes; the right adds payload structure and application context.
  • The reading was careful and still wrong, because the label, the contract, was missing.
  • Reading hexadecimal as if it were decimal is one of the most common decode mistakes.
iotclass.org

Major section

Bytes Are Evidence, Meaning Is a Contract (continued)

If you only need the intuition, this layer is enough: keep the original bytes as evidence, write down the rules used to decode them, and check the result against a plausible range.

  • The One-Minute View Width and sign set the range How many bytes a field uses, and whether it can be negative, decide which values it can even represent.
  • Byte order assembles values A multi-byte number can be built most-significant-first or least-significant-first.
  • A device name and a measurement are both "data," but text and numbers follow different rules.
iotclass.org

Major section

Apply It: Decode a Field With a Contract

A reliable decode is a short, ordered procedure, not a guess.

  • The goal is a value you can defend later, with the original bytes and the exact rules kept together so the same work is reproducible.
  • Swapping the order would give 0xEB00 = 60160, a very different value.
  • Top bit is 0, so positive.

Key terms

Units
Units are tenths of a degree.
iotclass.org

Major section

Apply It: Decode a Field With a Contract (continued)

Walkthrough: From Raw Bytes to a Trusted Value Preserve the raw bytes.: Capture the original byte sequence before any tool formats or rounds it, so the evidence is not lost.

  • If the top bit were set, the value would be negative under two's complement.
  • Units are tenths of a degree.
  • Reporting 235 degrees would be a unit error, not a sensor fault.
iotclass.org

Major section

Under the Hood: Ranges, Two's Complement, and Byte Order

Knowing the mechanism lets you predict ranges, recognize overflow, and explain why a byte-order mistake produces a number that still looks believable.

  • Bases and Positional Value Decimal, binary, and hexadecimal are different notations for the same quantities.
  • An unsigned 8-bit field holds 0 to 255.
  • Both readings are arithmetically valid.

Key terms

Silent wraparound
Silent wraparound is a classic source of impossible-looking jumps in counters and timers.
Both results
Both results are real integers, so a byte-order mistake rarely throws an error.
Range selection starts with the valid minimum and maximum values, then checks signedness, width, boundaries, and overflow behavior before the field type is accepted.
Range selection starts with the valid minimum and maximum values, then checks signedness, width, boundaries, and overflow behavior before the field type is accepted.
iotclass.org

Major section

Under the Hood: Ranges, Two's Complement, and Byte Order (continued)

Each digit's value is its symbol times the base raised to the digit's position.

  • Fixed-Width Ranges An IoT field usually has a fixed number of bits, which caps how many distinct values it can hold.
  • A signed 8-bit field holds -128 to 127.
  • Contract Must Record.
iotclass.org

Major section

Under the Hood: Ranges, Two's Complement, and Byte Order (continued)

When a calculation exceeds the range, the value wraps around instead of saturating.

  • An unsigned 16-bit field holds 0 to 65535.
  • Include fault values before testing a candidate width, so an unusual reading cannot silently exceed the chosen range.
  • Encoding, byte limit, allowed characters, invalid-input behavior.
iotclass.org

Major section

Under the Hood: Ranges, Two's Complement, and Byte Order (continued)

A type is suitable only when every valid value fits and the out-of-range behaviour is deliberate.

  • Silent wraparound is a classic source of impossible-looking jumps in counters and timers.
  • Two's Complement and Sign Almost all systems store signed integers in two's complement, where the most significant bit carries negative weight.
  • The same bits decode very differently depending on whether the field is signed.
iotclass.org

Major section

Under the Hood: Ranges, Two's Complement, and Byte Order (continued)

It quietly produces a wrong-but-plausible value, which makes endianness one of the hardest representation bugs to spot without a known-good test vector.

  • Byte Order (Endianness) A multi-byte value can be stored most significant byte first (big-endian) or least significant byte first (little-endian).
  • Both results are real integers, so a byte-order mistake rarely throws an error.
  • Misread status because reserved bits were assumed zero.
iotclass.org

Major section

Summary

Raw bytes are evidence; their meaning comes from a shared interpretation contract, not from the bytes alone.

  • Numeric fields need base, width, signedness, byte order, scale, and units before they can be trusted.
  • Two's complement and endianness can both turn the same bytes into different, plausible values, so signedness and byte order must be documented per field.
  • Fixed-width fields have hard ranges, and exceeding them wraps around silently instead of erroring.
iotclass.org

Deck summary

Key takeaways

Firmware means the program stored on a device to control its hardware.

  • They could be a price of ten dollars and fifteen cents, a time of 10:15, a year, a part number, or a temperature of 101.5 stored in tenths.
  • This gives: Bytes Are Evidence, Meaning Is a Contract evidence to revisit.
  • A number that "looks reasonable" is not proof that the rules were right.
  • Encoding and scale carry meaning Text needs an encoding, and raw integers usually need a scale and units before they become real measurements.
iotclass.org

Retrieval practice

Recall check 1 of 2

Physics Phoebe says: answer from memory, then check your reasoning.

Q1Two systems receive the exact same bytes but report two different values. What is the most likely cause?

AThey applied different interpretation rules, such as a different width.
BOne of the sensors must be physically broken
CBytes are inherently ambiguous and can never be decoded reliably
DThe network reordered the bits during transmission
Show answer

Answer: A Identical bytes only decode to the same value when both ends share the same representation contract.

iotclass.org

Retrieval practice

Recall check 2 of 2

Physics Phoebe says: answer from memory, then check your reasoning.

Q2A payload field is documented as signed 16-bit, big-endian, in tenths of a degree, and the bytes are 00 EB. What value should be reported?

A23.5 degrees C
B235 degrees C
C-23.5 degrees C
DCalibration offset still needed
Show answer

Answer: A 0x00EB is 235, the top bit is clear so it is positive, and tenths of a degree gives 23.5.

Q3The two bytes FF 38 are decoded as a signed 16-bit big-endian integer. What value results?

A-200
B65336
C200
D-65336
Show answer

Answer: A 0xFF38 is 65336 as unsigned, and as a signed 16-bit value it is 65336 - 65536 = -200.

iotclass.org

Print reference

Answers

Answer key.

  1. A · Identical bytes only decode to the same value when both ends share the same representation contract.
  2. A · 0x00EB is 235, the top bit is clear so it is positive, and tenths of a degree gives 23.5.
  3. A · 0xFF38 is 65336 as unsigned, and as a signed 16-bit value it is 65336 - 65536 = -200.
iotclass.org