IoT Fundamentals · Study deck
Number Systems and Data Units
Picture a device counter that rolls from a large positive value to a negative one after months in service.
Physics Phoebe is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain: If the firmware documentation says bit 7 means "fault present," bit 5 means "battery low," bits 2-1 encode the operating mode, and bit 0 means "sample ready," the same byte becomes a field map.
- Explain: A data type is a fixed-width budget: an N-bit unsigned field holds 0 to 2^N minus 1, and a signed field holds -2^(N-1) to 2^(N-1) minus 1.
- Explain: That byte budget is why a counter, status field, or scaled sensor value must be sized before it is trusted.
Major section
In 60 Seconds
The bits arrived, but the sender and receiver used different limits.
- 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.
- Binary, decimal, and hexadecimal are three ways to write the same quantity, and a data type is a fixed-width container with a known range.
Major section
Same Quantity, Different Notation
A length of two meters is the same length whether you write it in meters or in feet; only the label changes.
- The quantity eighty can be written as 80 in decimal, 0x50 in hexadecimal, or 01010000 in binary.
- The important idea is that a digital field has a fixed size, and that size is a budget.
Major section
Same Quantity, Different Notation (continued)
The lower strip pairs each hex digit with its matching nibble.
- The amount never changes, but the notation does, and reading one notation as if it were another is a common mistake.
- Eight bits can hold exactly 256 different values.
- This makes packet dumps shorter to read without changing the value stored in the bits.
Major section
Same Quantity, Different Notation (continued)
Choosing a data type means choosing how many values a field can ever represent, and what happens when a value tries to exceed that limit.
- The MSB carries the greatest weight; the LSB carries the smallest.
- Adding the weights of set bits gives the unsigned value, while the displayed range shows when a wider field is needed.
- That byte budget is why a counter, status field, or scaled sensor value must be sized before it is trusted.
Major section
Same Quantity, Different Notation (continued)
If a value can need bit 8, an 8-bit field cannot represent it; the next storage width is part of the data contract, not an implementation detail.
- The core rule is simple: binary is how hardware stores values, hexadecimal is the compact human shorthand for those bits, and decimal is what people usually read.
- That tidy mapping is why register dumps, MAC addresses, and packet hex views are written in hexadecimal rather than decimal.
- The first step is not to read it as decimal one hundred six; the prefix says it is hexadecimal.
Major section
Same Quantity, Different Notation (continued)
The notation did not change the value; it made the byte practical to inspect without writing eight separate bits.
- The One-Minute View Binary is the storage Hardware holds values as bits.
- Everything else is a more readable way of writing the same bits.
- Width is a budget A field's bit width fixes its range.
Major section
Same Quantity, Different Notation (continued)
If the firmware documentation says bit 7 means "fault present," bit 5 means "battery low," bits 2-1 encode the operating mode, and bit 0 means "sample ready," the same byte becomes a field map.
- Hex is the shorthand One hex digit equals four bits, so hexadecimal is the compact, exact view used for bytes and registers.
- Beginner Examples The hex byte 0x50 is decimal 80, because the digit 5 is in the sixteens place: five times sixteen plus zero.
- A single byte can hold 256 distinct values, written as 0 to 255 unsigned.
Major section
Apply It: Choose a Data Type That Fits
Choosing an integer type is a budgeting decision.
- Worked Example: A Scaled Temperature Field A sensor reports temperature from -40.0 to 125.0 degrees, stored in tenths of a degree.
- Scaling by ten gives an integer range of -400 to 1250.
- -> fits with margin [choose this].
Major section
Apply It: Choose a Data Type That Fits (continued)
A signed 8-bit type only reaches -128 to 127, far too small.
- A signed 16-bit type spans -32768 to 32767, which comfortably covers -400 to 1250 with large margin, so signed 16-bit is the smallest safe fit.
- Intermediate A counter must hold up to fifty thousand events before reset.
- Advanced A field stores a voltage from 0.00 to 3.30 volts in hundredths.
Major section
Under the Hood: Ranges, Signedness, and Overflow
Understanding them lets you predict exactly what a field can hold and what happens when it cannot.
- Positional Value In any base, a digit's contribution is the digit times the base raised to its position.
- Signedness costs one bit of magnitude, which is why a signed 8-bit field reaches 127 instead of 255.
- This behavior explains counters that appear to reset, timers that jump backward, and accumulators that suddenly turn negative.
Major section
Under the Hood: Ranges, Signedness, and Overflow (continued)
Overflow Is Modular, Not Saturating When arithmetic exceeds a field's range, the result wraps around modulo 2 to the power N rather than clamping at the limit.
- The fix is to choose a width with headroom, or to detect and handle the wrap deliberately.
- Common Pitfalls Reading hex as decimal.: Without confirming the base, 0x20 can be mistaken for 20 instead of 32.
- In production, number systems are about budgets and boundaries.
Major section
Summary
Binary, decimal, and hexadecimal are three notations for the same quantity; always confirm which one you are reading.
- A data type is a fixed-width budget: an N-bit unsigned field holds 0 to 2^N minus 1, and a signed field holds -2^(N-1) to 2^(N-1) minus 1.
- Signedness costs one bit of magnitude, so a signed 8-bit field reaches 127, not 255.
- Overflow wraps around silently rather than clamping, which causes counters and timers to jump unexpectedly.
- Hexadecimal aligns with bits because one hex digit equals exactly four bits, which is why bytes and registers are shown in hex.
Deck summary
Key takeaways
The bits arrived, but the sender and receiver used different limits.
- A length of two meters is the same length whether you write it in meters or in feet; only the label changes.
- The lower strip pairs each hex digit with its matching nibble.
- Choosing a data type means choosing how many values a field can ever represent, and what happens when a value tries to exceed that limit.
- If a value can need bit 8, an 8-bit field cannot represent it; the next storage width is part of the data contract, not an implementation detail.
Retrieval practice
Recall check 1 of 2

Physics Phoebe says: answer from memory, then check your reasoning.
Q1How many distinct values can a single 8-bit byte represent?
Show answer
Answer: C Eight bits give 2 to the power 8, which is 256 distinct values, usually written as 0 to 255 unsigned.
Q2A field stores temperature in tenths of a degree over the range -40.0 to 125.0 C. Which fixed-width integer type is the smallest safe fit?
Show answer
Answer: A The scaled range is -400 to 1250, which needs a signed type and fits well within -32768 to 32767.
Retrieval practice
Recall check 2 of 2

Physics Phoebe says: answer from memory, then check your reasoning.
Q3A signed 8-bit counter is at its maximum value of 127, and the firmware adds 1 without any range check. What value does it hold afterward?
Show answer
Answer: C Signed 8-bit arithmetic wraps modulo 256, so 127 + 1 overflows to the minimum, -128.
Print reference
Answers
Answer key.
- C · Eight bits give 2 to the power 8, which is 256 distinct values, usually written as 0 to 255 unsigned.
- A · The scaled range is -400 to 1250, which needs a signed type and fits well within -32768 to 32767.
- C · Signed 8-bit arithmetic wraps modulo 256, so 127 + 1 overflows to the minimum, -128.