%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2C3E50', 'primaryTextColor': '#fff', 'primaryBorderColor': '#16A085', 'lineColor': '#16A085', 'secondaryColor': '#E67E22', 'tertiaryColor': '#7F8C8D'}}}%%
graph LR
subgraph "Point-to-Point"
UART["UART/RS-232<br/>2 wires<br/>GPS, Debug"]
end
subgraph "Multi-Device Bus"
I2C["I2C<br/>2 wires<br/>Sensors, Displays"]
end
subgraph "High-Speed"
SPI["SPI<br/>4+ wires<br/>SD Cards, Fast I/O"]
end
style UART fill:#E67E22,stroke:#2C3E50,color:#fff
style I2C fill:#16A085,stroke:#2C3E50,color:#fff
style SPI fill:#2C3E50,stroke:#16A085,color:#fff
791 Wired Communication Protocols
791.1 Overview
Wired communication protocols form the foundation of IoT device interconnection at the local level. This section covers the essential protocols for connecting sensors, displays, and peripherals to microcontrollers.
791.2 Chapter Contents
This topic is covered in four focused chapters:
791.2.1 1. Wired Communication Fundamentals
Foundational concepts for understanding all wired protocols:
- Binary transmission challenge and signal encoding
- Synchronous vs asynchronous communication
- Network topologies: point-to-point, multi-drop, multi-point
- Master-slave architecture and collision prevention
- Full-duplex vs half-duplex communication
791.2.2 2. UART and RS-232
Serial point-to-point communication for legacy and simple devices:
- RS-232 voltage levels and connector pinouts
- UART frame structure: start bit, data bits, parity, stop bit
- Baud rate configuration and common settings
- Arduino/ESP32 code examples
- Troubleshooting baud rate and voltage level issues
791.2.3 3. I2C Protocol
Two-wire bus for connecting multiple sensors and displays:
- SDA and SCL signal lines with pull-up resistors
- 7-bit addressing and device discovery (I2C scanner)
- Read and write transactions with ACK/NACK
- Clock stretching for slow devices
- Common devices: BME280, SSD1306, MPU6050
791.2.4 4. SPI Protocol
High-speed full-duplex interface for fast peripherals:
- MOSI, MISO, SCK, and chip select signals
- SPI modes (CPOL/CPHA) and clock configuration
- Multi-slave configurations with dedicated CS lines
- Protocol comparison and selection guide
- SD card and display interfacing
791.3 Quick Protocol Comparison
| Protocol | Wires | Speed | Devices | Best For |
|---|---|---|---|---|
| UART | 2 | 115 kbps | 2 | GPS, Bluetooth, debugging |
| I2C | 2 | 400 kbps | 112 | Sensors, displays, EEPROMs |
| SPI | 4+ | 10+ Mbps | Many | SD cards, fast sensors, displays |
791.4 Learning Path
Recommended order:
- Start with Fundamentals to understand core concepts
- Learn UART/RS-232 for simple serial communication
- Master I2C for multi-sensor projects
- Add SPI for high-speed data logging
TipQuick Selection Guide
- GPS module or Bluetooth? -> UART
- Temperature sensor or OLED display? -> I2C
- SD card or TFT display? -> SPI
- Multiple sensors on limited pins? -> I2C
- Need maximum speed? -> SPI