Communication Protocols
Every electronic device you have ever owned — your phone, your router, your smartwatch, a temperature sensor inside a factory machine — communicates with other devices using a protocol. A protocol is simply a set of rules both sides agree to follow so they can understand each other.
This subject covers those rules, from the lowest level (individual voltage pulses on a wire) all the way up to the highest level (an application sending data across the internet to a server on another continent).
Why This Is a Separate Subject
When you study embedded systems, you learn how to make a microcontroller talk to a sensor over SPI or I²C — that is one wire, two devices, centimetres apart. When you study networking, you learn how a browser fetches a webpage over HTTP through TCP/IP across thousands of kilometres of fibre and wireless links. Both of these are communication protocols, but they operate at completely different levels of abstraction.
Understanding how these levels connect — and how each level depends on the one below it — is one of the most important mental models in all of computing.
The Big Picture — Layers of Communication
We will study each layer — starting from the hardware at the bottom and working upward.
What You Will Learn in This Section
Hardware Protocols — Chip to Chip
These are the protocols used inside a circuit board between a microcontroller and its peripherals. The wires are centimetres long, speeds range from 100 kbps to 50 Mbps, and there is no internet involved.
| Protocol | Wires | Typical use |
|---|---|---|
| UART | TX, RX | Debug console, GPS, Bluetooth modules |
| SPI | MOSI, MISO, SCK, SS̄ | SD cards, displays, ADCs |
| I²C | SDA, SCL | Sensors, RTCs, small EEPROMs |
| RS-232 | TX, RX + handshaking | PC serial ports, PLC programming, test equipment |
| RS-485 | A, B (differential pair) | Industrial bus — Modbus, PROFIBUS, DMX512 |
| CAN | CAN_H, CAN_L | Automotive, industrial machines |
| I²S | SCK, WS, SD | Digital audio — DACs, ADCs, MEMS microphones |
| 4–20 mA | 2-wire current loop | Industrial process sensors — pressure, temp, flow |
| 1-Wire | Single wire | Temperature sensors (DS18B20) |
Hardware protocols define the electrical layer only — voltage levels, cable length, number of devices. They say nothing about what the bytes mean. That is the job of software protocols.
Software Protocols — What the Bytes Mean
Software protocols run on top of hardware protocols and define the meaning of data: which device is addressed, what operation is requested, how data is structured, and how errors are detected at the application level.
The same software protocol can run on different hardware. Modbus RTU runs on RS-485 or RS-232. Modbus TCP runs on Ethernet. The registers, function codes, and data model are identical — only the physical transport changes.
| Protocol | Runs on | Typical use |
|---|---|---|
| Modbus RTU | RS-485 (or RS-232) | Factory sensors, power meters, drives, PLCs |
| Modbus TCP | Ethernet / WiFi | SCADA systems, cloud-connected field devices |
| PROFIBUS | RS-485 variant | Siemens industrial automation |
| BACnet MS/TP | RS-485 | Building management systems (HVAC, lighting) |
| DMX512 | RS-485 | Stage lighting control |
Wireless and Network Protocols — Device to World
These protocols move data across rooms, buildings, cities, and continents. They run on top of the hardware protocols and add addressing, routing, error correction, and security.
| Protocol | Range | Typical use |
|---|---|---|
| WiFi (IEEE 802.11) | ~50–100 m | Home and office networks, IoT devices |
| Bluetooth / BLE | ~10 m | Headphones, wearables, beacons |
| Ethernet (IEEE 802.3) | ~100 m | Wired LAN, switches, routers |
| LoRaWAN | ~2–15 km | Low-power wide-area IoT sensors |
| LTE / 5G | Nationwide | Mobile data, cellular IoT |
Internet Protocols — Addressing and Routing
| Protocol | Purpose |
|---|---|
| IPv4 / IPv6 | Address every device on earth uniquely |
| TCP | Reliable, ordered byte stream |
| UDP | Fast, best-effort datagrams |
| DNS | Translate names to IP addresses |
| DHCP | Automatically assign IP addresses |
Application Protocols — What the Data Means
| Protocol | Port | Purpose |
|---|---|---|
| HTTP / HTTPS | 80 / 443 | Web pages, REST APIs |
| MQTT | 1883 / 8883 | IoT messaging (publish/subscribe) |
| WebSocket | 80 / 443 | Real-time two-way web connections |
| FTP / SFTP | 21 / 22 | File transfer |
| Modbus | varies | Industrial sensor/actuator control |
The OSI Model — A Universal Framework
The OSI (Open Systems Interconnection) model was created in 1984 by the ISO to give the industry a common vocabulary for talking about protocol layers. Every protocol you will ever encounter can be placed on this stack.
In practice, the modern internet collapses layers 5 and 6 into layer 7. The TCP/IP model used in practice has 4 layers: Application (7+6+5), Transport (4), Internet (3), and Network Access (2+1). Both models describe the same reality from different angles.
How a Message Travels from Your Browser to a Server
When you type https://techarya.net and press Enter, here is what actually happens at each layer:
Each layer adds its own header (wrapping) on the way down and removes it on the way up at the other end. This is called encapsulation.
Where to Start
If you are coming from the Embedded Systems track and want to understand how your microcontroller talks to sensors:
→ Start with Hardware Protocols (UART, SPI, I²C)
If you want to understand how devices connect to the internet and talk to cloud services:
→ Start with OSI Model and TCP/IP, then move to WiFi and HTTP/MQTT
If you want a fast overview of the most important concept before anything else:
→ Read the OSI Model lesson — everything else hangs off that framework
Hardware protocols (electrical layer): UART → SPI → I²C → RS-232 → RS-485 → I²S → CAN → 4–20 mA
Software protocols (data meaning): Modbus RTU → Modbus TCP