Serial to IoT: 10 Communication Protocols Compared
This article introduces communication fundamentals and classifies mainstream wired and wireless communication protocols used in embedded systems.
COMPONENTS
PROJECT DESCRIPTION
【Preliminary Note】The original hardware example in this article was written based on the RP2040. The actual hardware used in this hands-on demonstration features the W55RP20 as the main controller chip. The circuit logic and UF2 flashing operation principles are universally applicable, with only the main controller model differing. The original chip model mentioned in the circuit descriptions below is provided for reference purposes only.
1. Basic Concepts of Communication
The core of communication is the exchange and transmission of information — that is, to "transport" information from the "sender (information originator)" to the "receiver (information recipient)" via a specific medium (communication channel). A more rigorous definition states that: communication refers to the process in which information is exchanged and transmitted between people, or between humans and nature, through certain behaviors or media.
The core elements of communication are as follows:
Schematic Diagram of the Encoding-Decoding Process of Information Transmission
Purpose: To "transport" information from the sender to the receiver.
Basic Model: Transmitter → Channel → Receiver (for example, when people talk to each other, the "speaker" is the transmitter, the "air" is the channel, and the "listener" is the receiver).
Key indicators: effectiveness (whether information transmission is efficient), reliability (whether information transmission is accurate), communication rate (the speed of information transmission), transmission distance, and propagation speed.
2. Basic Classification of Common Communication Protocols
The Communication Protocol we often refer to is a set of rules that standardize "how information is transmitted", and it can be divided into the following categories according to whether the transmission medium is "wired" or "wireless":
Wired Communication Protocol (transmitting information via physical cables such as network cables, serial cables, buses, etc.):
Ethernet (ETH, Ethernet):
Ethernet remote site connection topology diagram for discrete I/O devices
Status: Among existing local area networks the most widely used Communication Protocol standard.
Application: LAN data transmission for enterprises and households (e. g., computers connecting to routers via network cables to access the Internet).
CAN communication (Controller Area Network): a multi-master wired serial communication bus that transmits data via wired media such as twisted pairs; it supports "error detection + error notification + error recovery" and enables stable transmission in complex electromagnetic environments.
Connection Architecture Diagram of PCM-CAN200 and Multiple CAN Devices
Applications: Automotive electronics (signal interaction between in-vehicle devices, such as communication of engines and brake systems), industrial automation (linked control of equipment), medical devices and other scenarios.
M-BUS (Meter Bus)
Schematic diagram of instrument bus equipment networking for RS232 to M-Bus
Features: Using two non-polarized transmission lines, it realizes "power supply for devices + serial data transmission" simultaneously; multiple slave stations (such as electricity meters and water meters) can be connected in parallel to the bus via "different IDs".
Application: Specially designed for consumption measuring instruments (such as electricity meters and gas meters) and counters to transmit metering information.
USB (Universal Serial Bus)
Schematic Diagram of USB Data Monitoring Connection
Features: It belongs to " high-speed serial bus ", which can not only transmit data but also supply power to lower-level devices; it is easy to install, simple in expansion ports, diverse in transmission modes, and good in compatibility.
Evolution: From the initial Version 1.0 (with a transmission rate of 1.5Mbps) to the current Version 4.0 (with a transmission rate up to 40Gbps), it can meet the demands of fast charging for mobile phones, high-speed transmission of external hard drives and other scenarios.
Serial port protocols (including RS232, RS422, RS485) A serial port is a general term for "serial data interfaces", whose core is to transmit bytes by "bit", and different sub-protocols have different characteristics:
Schematic diagram of parallel data bus communication connection for dual UART devices
RS232: It features a maximum transmission rate of 20 kbps, a transmission distance of only 15 meters, and commonly uses "9-pin (Db-9)" or "25-pin (Db-25)" interfaces (such as the serial ports on early computers).
RS422: adopts balanced communication mode + twisted pair for transmission, with the rate increased to 10Mb/s and the transmission distance extended up to 1200 meters (supporting "full-duplex", namely bidirectional simultaneous transmission).
RS485: adopts half-duplex transmission (only one-way transmission is allowed at the same time), with a transmission rate of 10Mb/s and a transmission distance up to 1200 meters, which is suitable for multi-device networking, such as sensor clusters in industrial sites.
Low-speed board-level / inter-board serial protocols are mostly used for short-distance communication between chips and circuit boards, with the following common protocols:
1-Wire protocol: It only requires one single bus to realize the functions of "clock + data + control", and it belongs to half-duplex communication; its features include simple circuitry, low hardware overhead, low cost, and convenience for bus expansion (e. g., multiple sensors share one bus to form a network).
1-Wire bus pull-up resistor and multi-slave device topology diagram
I2C communication (Inter-Integrated Circuit): only requires 2 wires (SDA: Serial Data Line; SCL: Serial Clock Line), both of which are "bidirectional I/O lines"; it supports "multi-master + multi-slave"(with only 1 master active at the same time), and features a transmission rate of "up to 400Kbit/s in fast mode and 3.4Mbit/s in high-speed mode"(e. g., communication between a microcontroller and sensors or memory chips).
Schematic diagram of multi-device I²C bus communication topology
SPI Communication (Serial Peripheral Interface) : A full-duplex synchronous serial bus developed by Motorola, requiring 4 wires (CS: chip select; SCLK: clock; MOSI: host send, slave receive; MISO: slave send, host receive); mainly used for high-speed communication between MCU (microprocessor Control Unit) and peripheral devices (such as EEPROM, Flash, ADC digital-to-analog converter, DSP digital signal processor, etc.).
SPI bus (low priority) leader/follower device communication signal timing diagram
I2S communication (Inter-IC Sound Bus): a bus standard developed by Philips for digital audio transmission. It avoids audio distortion caused by "time difference" by separately transmitting data signals and clock signals, and is widely used in embedded audio systems (such as audio equipment and voice modules).
Schematic Diagram of ESP32 Audio Communication Based on I2S Protocol
Wireless Communication Protocol (transmits information via electromagnetic waves such as radio waves and infrared rays, without the need for physical cables):
Infrared Data Association (IrDA)
Dual PC device data transmission architecture diagram under infrared (IrDA) link
Principle: Use infrared rays to transmit information.
Features: Large transmission capacity, strong confidentiality, excellent anti-electromagnetic interference capability; simple equipment structure and small size.
Applications: indoor short-range communication (e. g., TV remote controls), short-distance remote control, etc. ; compliant with standards such as IrDA 1.0, IrDA 1.1/FIR.
WiFi
Network access architecture diagram of multiple terminal devices via routers
Principle: Via the 2.4GHz UHF band or the 5GHz SHF ISM radio band, communication between devices is realized.
Features: As a "local wireless network" based on the IEEE 802.11 standard, it is commonly used for devices such as computers, tablets and mobile phones to connect to routers for internet access.
Bluetooth / BLE (Bluetooth Low Energy)
Schematic Diagram of the Connection Process Between Bluetooth Devices and Mobile Applications
Principle: Uses UHF radio waves in the 2.4–2.485 GHz ISM band for transmission.
Features: Suitable for short-distance data transmission; among them, BLE (Bluetooth Low Energy) focuses on "low power consumption", which can extend the battery life of devices (such as wearable devices like smart watches and Bluetooth bracelets).
Application: Enables short-range data exchange between fixed devices, mobile devices, and building personal area networks (e. g., the connection between Bluetooth headsets and mobile phones).
Zigbee
Schematic diagram of intelligent device networking for Zigbee and Bluetooth hybrid communication
Features: It is an "open global standard" designed specifically for M2M (Machine-to-Machine) networks; it features the traits of "low cost, low power consumption, low latency and low duty cycle"(which can maximize the battery life of devices).
Application: In the field of smart homes (e. g., networking of smart lights, temperature and humidity sensors to enable inter-device linkage).
NB-IoT (Narrowband Internet of Things)
Multi-scenario Application Architecture Diagram of NB-IoT Technology
Principle: Built on the cellular network, it only consumes a bandwidth of approximately 180KHz and can be directly deployed on GSM networks, UMTS networks or LTE networks.
Features: It can reduce deployment costs, achieve seamless upgrades, and enable cellular data connectivity for low-power devices over a wide area network (cross-region).
Applications: Wide-area IoT scenarios such as smart cities (e. g., remote meter reading) and logistics tracking.
LoRa (Long Range, long-distance)
Communication topology diagram of LoRaWAN gateway and multi-end point node
Features: It belongs to LPWAN (Low-Power Wide-Area Network) technology, and is the "ultra-long-distance wireless transmission solution based on spread spectrum technology" promoted by Semtech, a US company; it features the characteristics of "long distance, low power consumption (long battery life), multiple nodes and low cost".
Application: Sensor networking in remote areas (such as farmland environmental monitoring, remote monitoring of oilfield equipment).