Common Communication Protocols for Embedded Systems and IoT

This article introduces some common communication protocols for embedded systems and IoT, which have different performance, communication rates, coverage, power consumption, and memory usage, with each protocol having its own advantages and disadvantages.
Some of these communication protocols are suitable for small household appliances, while others can be used for large smart city projects. IoT communication protocols can be divided into two main categories:
  • One category is access protocols: generally responsible for networking and communication between devices within a subnet.
  • The other category is communication protocols: primarily device communication protocols that operate on top of traditional Internet TCP/IP protocols, responsible for data exchange and communication between devices over the Internet.

Physical Layer and Data Link Layer Protocols

1. Long-Distance Cellular Communication
(1) 2G/3G/4G Communication Protocols, referring to the second, third, and fourth generation mobile communication system protocols.
(2) NB-IoT
Narrow Band Internet of Things (NB-IoT) has become an important branch of the Internet of Everything. NB-IoT is built on cellular networks, consuming about 180kHz of bandwidth, and can be directly deployed on GSM, UMTS, or LTE networks to reduce deployment costs and achieve smooth upgrades. NB-IoT focuses on the low-power wide-area (LPWA) IoT market and is an emerging technology that can be widely applied globally. It features wide coverage, many connections, fast rates, low costs, low power consumption, and excellent architecture.
Application scenarios: The scenarios brought by NB-IoT networks include smart parking, smart fire protection, smart water management, smart streetlights, shared bicycles, and smart appliances.
(3) 5G
The fifth generation mobile communication technology is the latest generation of cellular mobile communication technology. The performance goals of 5G are high data rates, reduced latency, energy savings, cost reduction, improved system capacity, and large-scale device connectivity.
Application scenarios: AR/VR, vehicle networking, smart manufacturing, smart energy, wireless medical, wireless home entertainment, connected drones, ultra-high-definition/panoramic live broadcasting, personal AI assistance, and smart cities.
2. Long-Distance Non-Cellular Communication
(1) WiFi
Due to the rapid proliferation of home WiFi routers and smartphones in recent years, WiFi protocols have been widely used in the smart home field. The biggest advantage of the WiFi protocol is that it can directly access the Internet. Compared to ZigBee, smart home solutions using WiFi protocols eliminate the need for additional gateways; compared to Bluetooth protocols, they do not rely on mobile terminals like smartphones.
Commercial WiFi coverage in public transportation, shopping malls, and other public places clearly reveals the potential of commercial WiFi applications.
(2) ZigBee
ZigBee is a low-speed, short-distance wireless communication protocol that is a highly reliable wireless data transmission network, characterized by low speed, low power consumption, low cost, support for a large number of online nodes, support for various online topologies, low complexity, speed, reliability, and security. ZigBee technology is a new type of technology that has recently emerged, primarily relying on wireless networks for transmission, enabling short-range wireless connections, and belongs to wireless network communication technology.
The inherent advantages of ZigBee technology have made it a mainstream technology in the IoT industry, with large-scale applications in industrial, agricultural, and smart home fields.
(3) LoRa
LoRa™ (Long Range) is a modulation technology that provides greater communication distances compared to similar technologies. LoRa gateways are widely applied in IoT products such as smoke detection, water monitoring, infrared detection, positioning, and power strips. As a narrowband wireless technology, LoRa uses time-of-arrival differences for geographic positioning. Application scenarios for LoRa positioning include smart cities and traffic monitoring, metering and logistics, and agricultural monitoring.
3. Short-Distance Communication
(1) RFID
Radio Frequency Identification (RFID) is the abbreviation for Radio Frequency Identification. Its principle is non-contact data communication between a reader and a tag to achieve the purpose of identifying the target. RFID has a wide range of applications, including animal microchips, car anti-theft chips, access control, parking control, production line automation, and material management. A complete RFID system consists of three parts: a reader, an electronic tag, and a data management system.
(2) NFC
NFC stands for Near Field Communication technology. NFC was developed based on non-contact radio frequency identification (RFID) technology, combined with wireless interconnection technology, providing a very secure and convenient communication method for various electronic products that are becoming increasingly popular in our daily lives. The term “near field” in NFC refers to the wireless electromagnetic waves of close proximity.
Application scenarios: Used in access control, attendance, visitor management, meeting check-in, patrolling, and other fields. NFC supports human-machine interaction and machine-to-machine interaction.
(3) Bluetooth
Bluetooth technology is a global specification for wireless data and voice communication, based on low-cost short-range wireless connections, establishing a communication environment for fixed and mobile devices.
Bluetooth enables wireless information exchange between numerous devices, including mobile phones, PDAs, wireless headsets, laptops, and related peripherals. Utilizing “Bluetooth” technology effectively simplifies communication between mobile communication terminal devices and also successfully simplifies communication between devices and the Internet, making data transmission faster and more efficient, thus broadening the path for wireless communication.
4. Wired Communication
(1) USB
USB, short for Universal Serial Bus, is an external bus standard used to specify the connection and communication between computers and external devices. It is an interface technology applied in the PC domain.
(2) Serial Communication Protocol
Serial communication protocol refers to the specification that defines the content of data packets, which includes start bits, main data, check bits, and stop bits. Both parties need to agree on a consistent data packet format to properly send and receive data. Common protocols in serial communication include RS-232, RS-422, and RS-485.
Serial communication refers to a communication method where data is transmitted bit by bit between peripherals and computers through data lines. This communication method uses fewer data lines, saving communication costs in long-distance communication, but its transmission speed is lower than parallel transmission. Most computers (excluding laptops) contain two RS-232 serial ports. Serial communication is also a commonly used communication protocol for instruments and equipment.
(3) Ethernet
Ethernet is a computer local area network technology. The IEEE organization established the IEEE 802.3 standard, which specifies the technical standards for Ethernet, including the physical layer wiring, electronic signals, and media access layer protocols.
(4) MBus
MBus remote meter reading system (symphonic mbus) is a two-wire bus standard in Europe, mainly used for consumption measurement instruments such as heat meters and water meters.

Network Layer and Transport Protocols

1. IPv4
The fourth version of the Internet Protocol is the fourth revision in the development process of the Internet protocol and the first version of this protocol that was widely deployed. IPv4 is the core of the Internet and the most widely used version of the Internet protocol.
2. IPv6
The sixth version of the Internet Protocol, as the biggest issue with IPv4 is the limited network address resources, severely restricting the application and development of the Internet. The use of IPv6 not only solves the problem of the quantity of network address resources but also addresses the obstacles to connecting multiple access devices to the Internet.
3. TCP
Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. TCP aims to adapt to the layered protocol hierarchy supporting multiple network applications. It provides reliable communication services between paired processes in main computers connected to different but interconnected computer communication networks. TCP assumes it can obtain simple, possibly unreliable datagram services from lower-level protocols.
4. 6LoWPAN
6LoWPAN is a low-power wireless personal area network standard based on IPv6, that is, IPv6 over IEEE 802.15.4.

Application Layer Protocols

1. MQTT Protocol
MQTT (Message Queue Telemetry Transport) is a standard transport protocol for the Internet of Things (IoT), providing subscription/publishing message modes, which are more concise, lightweight, and easy to use, especially suitable for message distribution in constrained environments (low bandwidth, high network latency, unstable network communication).
In many cases, including constrained environments, such as machine-to-machine (M2M) communication and IoT. It has been widely used in sensor communication via satellite links, occasionally dial-up medical devices, smart homes, and some miniaturized devices.
2. CoAP Protocol
CoAP (Constrained Application Protocol) is a web-like protocol in the IoT world, suitable for small low-power sensors, switches, valves, and similar components that require remote control or monitoring via standard Internet networks. Servers may not respond to unsupported types.
3. REST/HTTP Protocol
RESTful is a resource-based software architectural style. A resource is an entity on the network, or specific information on the network. An image or a song is a resource. RESTful API is an implementation based on the HTTP protocol (HTTP is an application layer protocol characterized by simplicity and speed).
Applications or designs that meet REST specifications are called RESTful, and APIs designed according to REST specifications are called RESTful APIs.
4. DDS Protocol
DDS (Data Distribution Service) is a middleware protocol for distributed real-time data distribution services, serving as the “TCP/IP” of real-time networks, solving the interconnection of network protocols in real-time networks, functioning as a “bus on the bus”.
5. AMQP Protocol
AMQP, or Advanced Message Queuing Protocol, is an open standard application layer protocol that provides a unified messaging service, designed for message-oriented middleware. Clients based on this protocol can exchange messages with message middleware, unrestricted by different products, development languages, etc. Implementations in Erlang include RabbitMQ and others.
6. XMPP Protocol
XMPP is a protocol based on a subset of standard generalized markup language XML, inheriting its flexible development in XML environments. Therefore, applications based on XMPP have strong scalability. Extended XMPP can handle user needs by sending extended information and building applications such as content publishing systems and address-based services on top of XMPP.

Comparison of Communication Protocols

1. Comparison of NB-IoT and LoRa Protocols
First, frequency bands. LoRa operates in unlicensed frequency bands below 1GHz, requiring no additional payment for application, while NB-IoT and cellular communication use licensed frequency bands below 1GHz, which incur charges.
Second, battery life. LoRa modules have unique characteristics in handling interference, network overlap, scalability, etc., but cannot provide service quality like cellular protocols. NB-IoT cannot provide battery life similar to LoRa due to service quality considerations.
Third, device cost. For terminal nodes, the LoRa protocol is simpler, easier to develop, and has better applicability and compatibility with microprocessors. Low-cost, relatively mature LoRa modules are already available on the market and will continue to have upgraded versions released.
Fourth, network coverage and deployment timelines. The NB-IoT standard was announced in 2016, and in addition to network deployment, the corresponding commercialization and establishment of the industrial chain will require more time and effort to explore. The entire industrial chain of LoRa is relatively mature, and products are in a state of “ready to launch,” with many countries globally conducting or having completed nationwide network deployments.
2. Comparison of Bluetooth, WiFi, and ZigBee Protocols
Currently, the advantages of WiFi are its widespread application, having become common in households; ZigBee’s advantages are low power consumption and self-organizing networks; UWB’s advantages are transmission rates; Bluetooth’s advantages are simple networking. However, these three technologies also have their shortcomings, and no single technology can fully meet all the requirements of smart homes.
The emergence of Bluetooth technology has made short-distance wireless communication possible, but its complex protocol, high power consumption, and high costs are not suitable for industrial control and home networks that require low costs and low power consumption. Especially, Bluetooth’s biggest obstacle is its limited transmission range, generally effective within about 10 meters, and issues such as weak anti-interference capability and information security problems are also major factors restricting its further development and large-scale application.
WiFi is also a short-distance wireless transmission technology that can access wireless signals at any time, with strong mobility, making it suitable for use in office and home environments. However, WiFi also has a fatal flaw. Since WiFi uses radio frequency technology to send and receive data through the air, it is susceptible to external interference.
ZigBee is an internationally accepted wireless communication technology, with each network port capable of connecting up to 65,000 ports, suitable for home, industrial, agricultural, and multiple other fields, while Bluetooth and WiFi network ports can only connect 10 ports, clearly unable to meet household needs. ZigBee also has advantages of low power consumption and low costs.
3. Comparison of MQTT and CoAP Protocols
MQTT is a many-to-many communication protocol used to transmit messages between different clients through an intermediary broker, decoupling producers from consumers, allowing clients to publish while the broker decides routing and copies messages. Although MQTT supports some persistence, it is best used as a real-time data communication bus.
CoAP is primarily a point-to-point protocol used to transfer state information between clients and servers. Although it supports observing resources, CoAP is best suited for state transfer models, not entirely event-based.
MQTT clients establish long TCP connections, which typically indicates no issues, while CoAP clients and servers send and receive UDP packets. In NAT environments, tunneling or port forwarding can be used to allow CoAP, or devices may initialize a front-end connection like LWM2M.
MQTT does not provide support for message type tagging or other metadata to help clients understand; MQTT messages can be used for any purpose, but all clients must know the upward data format to allow communication. In contrast, CoAP provides built-in support for content negotiation and discovery, allowing devices to probe each other to find ways to exchange data.
Both protocols have their strengths and weaknesses, and the choice of the right one depends on your application.
Disclaimer:This article’s materials are sourced from the Internet, and the copyright belongs to the original author. If there are any copyright issues, please contact me to delete.
———— END ————

Recommended Reading:

Collection | Linux Articles Summary
Collection | Programmer’s Life
Collection | C Language
My Knowledge Circle
Follow the public account, reply “1024” to get the link to the learning materials.
Thank you for liking, following, sharing, and viewing. I will remember every encouragement you give~

Common Communication Protocols for Embedded Systems and IoT

Embedded Linux

Scan the QR code to follow my public account

Leave a Comment