56  Binary & Hex Converter

Interactive Number System Conversion Tool

56.1 Interactive Binary & Hex Converter

NoteLearning Objectives

By using this interactive tool, you will be able to:

  • Convert between binary, decimal, and hexadecimal instantly
  • Visualize bit patterns and understand their meaning
  • Apply number systems to real IoT scenarios (sensor data, registers, protocols)
  • Debug raw data by interpreting hex dumps

Computers speak in binary (0s and 1s), but we humans prefer decimal. Hexadecimal (hex) is a convenient shorthand.

System Base Digits Example Why Used
Binary 2 0, 1 10110101 How computers store data
Decimal 10 0-9 181 Human-friendly
Hexadecimal 16 0-9, A-F B5 Compact binary representation

Real IoT Examples:

  • Sensor reads 0x7F: What temperature is that?
  • BLE address: AA:BB:CC:DD:EE:FF - all hex!
  • MQTT packet: Starts with 10 (hex) for CONNECT
  • Error code 0xDEAD: Common debugging pattern

56.2 Number Converter


56.3 Bit Visualizer


56.4 IoT Scenario Practice

Apply number conversions to real IoT scenarios:


56.5 Knowledge Check

NoteQuestion 1

A sensor returns the hex value 0x7F. What is this in decimal?

  1. 127
  2. 128
  3. 255
  4. 63

A) 127 - 0x7F = 7 x 16 + 15 = 112 + 15 = 127. This is also the maximum positive value for a signed 8-bit integer.

NoteQuestion 2

If an 8-bit GPIO register shows 0b10100101, which bit positions are HIGH? (LSB = bit 0)

  1. Bits 0, 2, 5, 7
  2. Bits 1, 3, 4, 6
  3. Bits 0, 1, 2, 3
  4. Bits 4, 5, 6, 7

A) Bits 0, 2, 5, 7 - Reading from right to left: bit 0=1, bit 1=0, bit 2=1, bit 3=0, bit 4=0, bit 5=1, bit 6=0, bit 7=1.

NoteQuestion 3

Why is hexadecimal commonly used in IoT instead of binary?

  1. Hexadecimal is faster to process
  2. Each hex digit represents exactly 4 bits (one nibble)
  3. Binary is not supported by most protocols
  4. Hexadecimal uses less memory

B) Each hex digit represents exactly 4 bits (one nibble) - This makes it easy to convert between hex and binary: 0xF = 1111, 0xA = 1010. Two hex digits = one byte, making it much more compact than writing 8 binary digits.


56.6 Quick Reference

Decimal Hex Binary Common Usage
0 0x00 00000000 Null, OFF
127 0x7F 01111111 Max signed byte
128 0x80 10000000 Min negative signed
255 0xFF 11111111 Max unsigned byte
256 0x100 100000000 9-bit overflow
1023 0x3FF 1111111111 10-bit ADC max
4095 0xFFF 111111111111 12-bit ADC max
65535 0xFFFF (16 ones) Max 16-bit