Skip to main content

Modbus is one of the most commonly used communication protocols in industrial automation. Its open nature, simplicity of implementation, and reliability have made it widely utilized in control and monitoring systems for over 40 years. Whether it’s a SCADA system, a PLC controller, or a sensor, Modbus enables efficient communication between devices from different manufacturers.

In this article:

  • We will explain what Modbus is and its key features.
  • We will discuss the differences between Modbus RTU, ASCII, and TCP/IP.
  • We will demonstrate how the protocol works and where it is applied.
  • We will present practical examples of its use in the industry.
Modbus

What is Modbus?

Modbus was developed in 1979 by Modicon (now Schneider Electric). It was designed as a communication protocol for PLC controllers, but its openness and versatility quickly led to its adoption across various industrial sectors.

Its key features are:

  • Simplicity: Easy implementation and minimal hardware requirements.
  • Scalability: Capability to operate in both small, local networks and large distributed systems.
  • Universality: Modbus can function on various physical layers (RS-485, RS-232, Ethernet) and is compatible with devices from different manufacturers.
Modbus Plus/RTU

Types of Modbus

We distinguish three main variants of Modbus:

  1. Modbus RTU: (Remote Terminal Unit):</strong> Most commonly used in serial systems. It utilizes a compact data structure and is optimized for performance.
  2. Modbus ASCII: Transmits data in ASCII text form. It is simpler to debug but slower than RTU.
  3. Modbus TCP/IP: Based on Ethernet networks, enabling integration with modern IT systems and easier management.

Modbus and Its Physical Media

Modbus is an open standard that describes the method of exchanging messages in communication dialogue. Within this protocol, communication is possible using various types of physical media, such as:

  • RS-232: The first communication medium in the Modbus standard, allowing direct device connection.
  • RS-485: A more popular option today, enabling:
    • Communication over longer distances.
    • Higher transmission speeds.
    • Connecting multiple devices within a single multidrop network.
  • RS-422: An alternative that enables full-duplex data transmission.
  • Ethernet: Used in newer versions, such as Modbus TCP/IP, providing greater flexibility and integration with IT systems.
Modbus connection

In the case of serial interfaces, such as RS-232 and RS-485, Modbus messages are transmitted in a simple text format over a dedicated network. RS-485, utilizing bidirectional transmission and reception connections, enables Master-Slave communication across multiple devices within the same bus.

Modbus Wire

Thanks to Ethernet, it is possible to share the medium with other protocols. In this case, Modbus messages are encapsulated in Ethernet frames according to a specific format, allowing Modbus to coexist with other protocols on a single platform.

The Importance of the Cable for RS-485

In Modbus communication using RS-485, selecting the right cable is crucial for the reliability and quality of data transmission. RS-485 is a popular standard due to its ability to support long distances and multiple devices in a single network, but achieving these benefits depends on proper cabling.

Key Features of an RS-485 Cable:

  • Twisted Pair Wires: Provides reduction of electromagnetic interference, which can affect signal integrity, especially in industrial environments.
  • Shielding: Protects the cable from external interference, which is crucial in areas with high levels of electromagnetic noise, such as factories and power stations.
  • 120 Ω Impedance: The standard impedance for RS-485 minimizes signal reflections and ensures optimal network performance.

Good Practices in RS-485 Cable Installation:

  1. Terminating Resistors: Place 120 Ω resistors at both ends of the bus to prevent signal reflections and transmission interference.
  2. Shield Grounding: Ground the cable shield at a single point to avoid ground loops, which can cause interference.
  3. Distance from Power Cables: Avoid running RS-485 wires parallel to power cables to reduce the risk of electromagnetic interference.
  4. Bus Length: Keep the bus length within 1200 meters to ensure signal stability.

Why Is It Important?

Incorrect selection or installation of an RS-485 cable can result in transmission errors, such as data loss, communication delays, or inaccurate device readings. Properly installed cables ensure the stability and reliability of the Modbus system, even in challenging industrial environments.

How does Modbus work?

Modbus operates in a master-slave model (or in the TCP/IP version, client-server):

  • Master (or Client): The primary device that initiates communication (e.g., a PLC controller or SCADA system).
  • Slave (or Server): Subordinate devices that respond to requests (e.g., sensors, inverters).

Query and Response Mechanism

Communication in Modbus is based on a simple scheme:

  1. The Master sends a query to a specific Slave device.
  2. The Slave processes the query and responds (or reports an error).

Example: A PLC controller (Master) reads the temperature value from a sensor (Slave) and uses it to control the operation of a pump.

Master-Slave

Modbus as an “Open Protocol”

In industrial automation, devices from different manufacturers may use their own, specific communication languages. However, the growing need for integrating various systems has made open protocols, such as Modbus, a key standard.

An open protocol means its specifications are published and can be freely used by anyone—either free of charge or under a license. This approach allows manufacturers to easily integrate their devices with other systems.

Open protocols are typically supported by consortia of companies, user groups, industry organizations, and governments, ensuring their continuous development and compatibility with modern solutions.

Benefits of open protocols, such as Modbus, include:

  • Support from multiple manufacturers: Devices from different brands can work together within a single system.
  • Active communities: Users have access to technical support and community assistance.
  • Flexibility and scalability: Systems can be updated and adapted in the future.
  • Standard diagnostic tools: Simplifies monitoring and troubleshooting.

Modbus, as one of the most widely used open protocols in the industry, connects devices in various applications from sensor monitoring to machine control. Its simplicity and reliability make Modbus a key standard for integrating industrial automation systems.

Ethernet Modbus
Modbus Ethernet

Structure of a Modbus Frame

Each Modbus frame consists of the following elements:

  • Device Address: Specifies the target device for the query.
  • Function Code: Indicates the type of operation, e.g., data read, write, or diagnostics.
  • Data: Transmitted values or information about the device’s status.
  • CRC (Cyclic Redundancy Check): Used to verify the integrity of the transmitted data.

Example:

Sending code: 01 05 FF FF 00 BC 0A

Fields Meaning Note
01 Device Address Fixed 0x01
05 05 Command Control relay commands
00 FF Address Fixed 0x00FF
FF 00 Command 0xFF00: Relay on
0x0000: Relay off
0x5500: Relay flip
BC 0A CRC16 CRC16 checksum of the first 6 bytes of data

Return code: 01 05 00 FF FF 00 BC 0A

Fields Meaning Code
01 Device Address Fixed 0x01
05 05 Command Control the relay commands
00 FF Address Fixed 0x00FF
FF 00 Commands 0xFF00: relay on
0x0000: relay off
0x5500: relay flip
BC 0A CRC16 CRC16 checksum of the first 6 bytes of data

Example Function Codes

  • 01: Read the state of discrete inputs.
  • 03: Read analog registers.
  • 05: Write a single bit.
  • 16: Write multiple registers.

Thanks to its simple structure, the Modbus frame is easy to analyze and debug.

Modbus RTU vs. Modbus TCP/IP – Which to Choose?

The choice between Modbus RTU and Modbus TCP/IP depends on the specific application:

Modbus RTU

  • Physical Layer: RS-485 or RS-232.
  • Range: Up to 1200 meters with RS-485.
  • Costs: Lower, ideal for small local networks.
  • Transmission Speed: Limited (typically 9600–19200 bps).

Modbus TCP/IP

  • Physical Layer: Ethernet.
  • Range: Global, depending on network infrastructure.
  • Costs: Higher, but offers greater flexibility.
  • Transmission Speed: Significantly higher than RTU, allowing for rapid data exchange.
FeatureModbus RTUModbus TCP/IP
Physical LayerRS-485 Ethernet
Transmission SpeedSlower, but sufficient for small networksFaster, ideal for large systems
DiagnosticsMore challenging (requires external tools)Simpler (standard network tools)

Diagnostics and Troubleshooting in Modbus Networks

Diagnosing issues in Modbus networks is a critical aspect of maintaining the efficiency of industrial systems. While this protocol is simple and reliable, communication problems between devices can occasionally occur. Here are some basic steps and tools to help identify and resolve common issues:

Common Issues in Modbus Networks

  1. No Response from Slave Device:
    • Verify that the device address in the Master’s query matches the actual address of the Slave device.Ensure the Slave device is powered on and properly connected to the bus.
  2. Incorrect Data in Response:
    • Check the function code in the query; it may not be supported by the device.Confirm that the registers you are trying to read are within the supported address range.
  3. CRC Errors:
    • CRC errors indicate data transmission interference. Check cable quality, shielding, and proper bus termination in RS-485.
  4. Network Conflicts:
    • Ensure each device in the network has a unique address.Verify that only one device is acting as the Master.

Tools for Modbus Diagnostics

  • Serial Bus Analyzers: These tools enable monitoring communication in RS-485/RS-232 networks. They allow capturing data frames and identifying errors.
  • Modbus Testing Software: Programs exist that simulate a Master or Slave, allowing network operation testing.
  • Multimeter and Oscilloscope: Useful for checking physical connections and electrical signals on the bus.

Good Practices for Maintaining a Modbus Network

  • Always use appropriate terminating resistors at the ends of the RS-485 bus to avoid signal reflections.
  • Keep communication cables as short as possible and use shielding to minimize interference.
  • Regularly test devices in the network, especially in systems critical to production.

Modbus diagnostics is relatively straightforward as long as you understand the basic principles of the protocol and have the right tools. Implementing the above practices will help avoid downtime and ensure the stability of the communication system.

Practical Applications of Modbus

The Modbus protocol is used in many areas of industrial automation:

  1. Monitoring Sensors and Devices:
    • Reading values from sensors (temperature, pressure, flow).
    • Real-time analysis of machine status.
  2. Controlling Actuating Devices:
    • Turning pumps, motors, and valves on and off.
    • Adjusting inverter parameters..
  3. Integration of SCADA Systems:
    • Collecting and visualizing data in systems supervising industrial processes.
  4. Connecting devices from different manufacturers.
    • Thanks to its open standard, Modbus enables devices from different brands to work together in a single network.
SCADA Modbus

Summary

Modbus remains a key protocol in industrial automation, combining simplicity, reliability, and flexibility. Whether you choose Modbus RTU for small, local systems or Modbus TCP/IP for large, distributed networks, this protocol provides an effective solution for data exchange between devices.

Feel free to read our other blog posts.

Author

Matthew Kurantowicz

Author Matthew Kurantowicz

More posts by Matthew Kurantowicz