The Modbus protocol is a communication protocol that allows devices to communicate over various types of media, such as serial lines and ethernet. It was developed in 1979 by Modicon, a company that produced Programmable Logic Controllers (PLCs), to enable these devices to communicate with each other.
Modbus provides a messaging structure designed to establish master-slave communication between intelligent devices. A Modbus message sent from Device A (master) will initiate a response from Device B (slave). The function is to define the content of the communication, how the information is packaged, and the order in which messages are sent and received.
The Modbus protocol is simple and robust, making it a popular choice for industrial control systems. It’s an open standard, meaning it’s free for anyone to use and modify, leading to its widespread adoption throughout the industry.
History and Origin of The Modbus Protocol
The Modbus protocol was developed in 1979 by Modicon, a company now owned by Schneider Electric. Modicon created the protocol to be used with its PLCs (Programmable Logic Controllers), which are used in the manufacturing industry for the automation of industrial electromechanical processes.
The Modbus Organization, a group of independent users and suppliers who advocate for the use of the Modbus protocol, was established in 2002 to provide public access to the protocol, its specifications, and its related information. The organization also ensures the Modbus protocol’s continued availability, enhancement, and application in industrial automation markets.
Since its inception, the Modbus has been implemented in a wide range of devices across many different industries. It has remained popular due to its simplicity, openness, and ease of implementation.
Components of The Modbus Protocol
Modbus devices or machines are the physical devices that communicate using the Modbus protocol. These devices can be anything from temperature sensors to motor controllers, and they can be located anywhere from a factory floor to a remote oil field.
The Modbus master is the device that initiates a Modbus transaction. It sends a request to a Modbus slave device and waits for a response. The master can communicate with multiple slaves and can request different types of data from each one.
A Modbus slave is a device that waits for a request from a Modbus master. When it receives a request, it will process it and send a response back to the master. The slave does not initiate communication; it only responds to requests from the master.
Data Models and Registers
The Modbus data model is based on a series of registers. These registers are simply memory locations in the device that can hold data—they represent the storage area within a device. There are two types of registers:
- Holding registers: Can be read and written by a Modbus master.
- Input registers: Can only be read by a master.
Types of Inputs
There are two main types of inputs in a Modbus system:
- Coils are a type of data in the Modbus protocol that represents binary states, such as ON/OFF or TRUE/FALSE. They can be read and written to by a Modbus master.
- Discrete inputs are similar to coils in that they represent binary states. However, unlike coils, they can only be read, not written to.
Modbus Message Frame
A Modbus frame is the structure of a Modbus message. It consists of a start frame, function code, data, and an end frame. The following table shows the structure of the frame in more detail, in the ASCII variant of the protocol (learn more below):
|:||2 Chars||2 Chars||N Chars||2 Chars||CR LF|
Modbus Communication Modes
There are three main communication modes in the Modbus protocol:
- RTU (Remote Terminal Unit)
- ASCII (American Standard Code for Information Interchange)
- TCP/IP (Transmission Control Protocol/Internet Protocol)
Varieties of The Modbus Protocol
There are several variations of the Modbus protocol. The main ones include:
Modbus RTU (Remote Terminal Unit) is a binary implementation of the Modbus protocol. It is typically used over serial communication and is known for its compact data representation, which makes it efficient and fast.
Modbus ASCII (American Standard Code for Information Interchange) is an ASCII implementation of the Modbus protocol. It is less efficient than Modbus RTU, but it is easier to use and debug because it uses human-readable characters.
Modbus TCP/IP is a version of the Modbus protocol that is used over TCP/IP networks. It allows for communication over long distances and across different networks.
Modbus UDP (User Datagram Protocol) is a version of the Modbus protocol that uses the UDP transport protocol. It is less reliable than Modbus TCP/IP because it does not guarantee delivery or correct sequence of packets, but it is faster and requires less bandwidth.
Modbus Plus (MB+ or Modbus+) is a proprietary variant of the Modbus protocol, which was introduced by Schneider Electric. It is a peer-to-peer communication protocol that offers higher speed and more deterministic data transfer compared to the standard Modbus.
Uses of The Modbus Protocol
The Modbus protocol finds wide application in the field of industrial automation. In industrial settings, it is essential to maintain a reliable and efficient communication network between numerous devices and machines.
Modbus enables easy and standardized communication between a variety of devices, such as Programmable Logic Controllers (PLCs), sensors, and actuators. It is often employed in manufacturing plants, power plants, oil refineries, and other industrial settings to monitor and control equipment and processes.
The Modbus protocol is also utilized within vehicle systems, specifically in the realm of electric vehicles. It aids in monitoring and controlling various parameters, including battery management systems, charging systems, and inverter systems. Modbus offers an efficient and easy-to-implement protocol for ensuring the smooth operation of these systems.
Communications in IoT
With the rise of the Internet of Things (IoT), the Modbus protocol has gained significant relevance. Modbus, especially Modbus TCP/IP, is used to enable communication between IoT devices, sensors, and controllers over Ethernet networks. Its simplicity and wide support make it a common choice for IoT communications.
Sensor and Actuator Communication
The Modbus protocol plays a key role in facilitating communication between sensors and actuators. It provides a standard interface for transmitting data, such as sensor readings or control signals for actuators.
This enables a centralized control system or PLC to monitor and control a wide variety of equipment in a coordinated manner. The use of Modbus protocol in sensor and actuator communication is prevalent in a range of fields, from industrial machinery to environmental monitoring systems.
Limitations of The Modbus Protocol
While the Modbus protocol offers many benefits, it also has some limitations. One of these is its lack of built-in security features. Since the protocol was developed before the widespread use of the internet, it does not include mechanisms to secure communication, making it vulnerable to cyber-attacks.
Another limitation is the protocol’s simplicity. While this makes it easy to use and implement, it also means that it lacks some of the advanced features found in more modern protocols.
Despite these limitations, the Modbus protocol remains a popular choice for many applications due to its simplicity, robustness, and wide compatibility.