Businesses worldwide realize that jumping into Digital Transformation is key to becoming faster, automated, and more efficient. Since Modbus is a widely used communication protocol in devices and industrial settings, businesses wanting to integrate their processes with the latest technologies and to pull data out of their machinery, equipment and systems are looking into Modbus Gateways to achieve this.
Addressing the most frequent questions around Modbus, this article will discuss the role, benefits, and applications of Modbus Gateways. Whether you are looking for the right Gateway for you or just starting to explore the possibilities of the Internet of Things (IoT) in your sector, this article is a must-read.
- What is Modbus?
- Why is Modbus so popular?
- What are examples of Modbus devices?
- Is Modbus RTU the same as Modbus TCP?
- What are Modbus Gateways and how do they work?
- Are there different forms and configurations of Modbus Gateways?
- What are the benefits of using a Modbus Gateway?
- What are important features to look for in Modbus Gateways?
- What are the potential applications and use cases for Modbus Gateways?
- The BACE IoT Platform vs. generic Modbus Gateways
- More information
What is Modbus?
Modbus or as some may call it: “the grandfather of industrial networking” is a popular communication protocol or messaging structure widely used in industrial automation and control systems for data communication between devices. The Modbus protocol allows devices on a network to exchange information with each other in a standardized format. It is also important to note that Modbus is independent of the underlying physical layer (which will be addressed later in this article).
Developed by Modicon (now a brand of Schneider Electric), Modbus started in the late 70s and introduced the concept of data on the factory floor. Modbus has been in use for over 30 years in different electronic devices on diverse types of networks and across several industries, which brings us to the topic of its popularity.
Why is Modbus so popular?
The popularity of Modbus can be summarized in these few words: simple, open, robust and flexible.
- Simple: The protocol has a very well-defined structure in terms of the rules for the request-response model. This means that there is a certain way to make an information request and a consistent way you will get the response with the requested data. In that sense, when you implement it, if you follow the rules, it will always be easy to troubleshoot and know what your mistake was.
- Open: Since its creation, Modbus was made widely available as an open standard, meaning that manufacturers could build it into their equipment without having to pay royalties. The possibility to include it into many device types from different manufacturers and vendors contributed to its widespread acceptance and adoption, thus making it today a reliable and well-understood protocol for data communication.
- Robust: Despite its simplicity, the Modbus protocol offers a robust range of powerful features that make it well-suited for use in industrial automation and control applications. Modbus uses a cyclic redundancy check (CRC) as part of its error-checking mechanism to ensure that data is transmitted accurately and reliably.
- Flexible: Modbus can be used over a variety of physical media or layers, such as RS-232, RS-485, and Ethernet. This makes it suitable for use in a wide range of industrial environments, from small local networks to large-scale distributed systems. A variety of Modbus data types are used to represent different types of information in the system such as coils, discrete inputs, input registers and holding registers.
What are examples of Modbus devices?
Due to their popularity, there are hundreds of thousands of Modbus devices available in the market today. These can be simple things like the motor drivers that control your garage door, sensors or industrial components and machines such as:
- Programmable Logic Controllers (PLCs)
- Remote Terminal Units (RTUs)
- Power Meters
- Flow Meters
- Motor Drives
- Valves and Actuators
- PV Inverters
- Battery Charging Circuits
- Power Conditioning Units
- Energy Storage Systems
- Environmental sensors such as temperature, humidity and pressure
Is Modbus RTU the same as Modbus TCP?
The simple answer to this common question is, No. Although they are related and share some similarities, the physical layer or interface (as mentioned at the beginning of this article) is independent from the protocol and can thus be different. In this case one is RTU (Remote Terminal Unit), and one is TCP (Transmission Control Protocol).
In Modbus RTU, the physical layer is a serial communication protocol that uses a binary representation of data. Although there are several standard transports, the most common ones are RS232 and RS485. RS232 is the predecessor of RS485, which came about to allow longer distances, higher speeds and the possibility to signal multiple devices. Modbus RTU uses a client-server architecture, where a single client device sends commands to one or more server devices, which respond with data. Modbus RTU is commonly supported by legacy devices, and used in industrial automation, building control systems and other applications requiring long-distance communication.
Modbus TCP (also known as Modbus IP and Modbus TCP/IP)uses TCP/IP networking to communicate between Modbus devices. It is an extension of Modbus RTU that is used over Ethernet or other IP-based networks. Modbus TCP is often used to connect Modbus devices over longer distances or to integrate Modbus networks with other types of networks. Unlike Modbus RTU, the more modern Modbus TCP allows for multiple clients (devices that initiate and control the communication with the servers) and has the capability to send parameters such as point name, resolution, units, etc. Modbus TCP is more common at the enterprise level, IoT applications or life scale applications where relatively newer devices exist that can connect to a network.
Because of Modbus’s wide use and variety of applications it is present in vastly different hardware and software configurations that may not even be compatible with each other. Modbus Gateways are especially useful in those scenarios to integrate different systems.
What are Modbus Gateways and how do they work?
Modbus Gateways are devices that act as a bridge to extract data from individual Modbus devices in the field, they package the data and —using a cellular modem— send it to a cloud application and database over the Internet. In other words, a Gateway stores a Modbus template and allows data to be transmitted seamlessly to explain the situation in the field by pulling the data from the individual devices and publishing messages to the cloud so that people can use the data as information later.
In a Modbus setting, Modbus Gateways essentially act as the client that instructs Modbus devices on the Modbus network to send the requested data so that the user can see them. The communication is bi-directional, thus also allowing to manage the device remotely over the Internet. Since most Modbus devices do not have direct access to the Internet, a Modbus Gateway is needed to bridge Modbus devices to the cloud.
A Modbus Gateway works by receiving data from devices on the Modbus network, converting it into a format that can be understood by the application on the cloud, and transmitting it to the IoT platform. The Gateway may also perform other tasks, such as data filtering, protocol conversion, or signal buffering to ensure that data is transmitted accurately and reliably.
It might be counterintuitive, but even in the case of a Modbus TCP device you will still need a Modbus Gateway to establish communication and get the data to the cloud because the communication protocol is different even though the physical layer is on Ethernet. To speak with those Modbus devices, the Gateway will “speak in Modbus” but then to send the data to the cloud it will use a different application layer (e.g., HTTPS, MQTT, etc.).
Are there different forms and configurations of Modbus Gateways?
Something important to consider when choosing and configuring a Modbus Gateway is that they come in different forms and can be configured to meet specific customer requirements. The first decision to be taken based on the devices in the field is if a Modbus RTU or a Modbus TCP Gateway is needed.
Afterwards —and since a Gateway can be used in various configurations, including single-device, multi-device and network configurations— for each Modbus Gateway, the correct configuration must be set so that it can successfully communicate with the devices in the field. The proper configuration will depend on the specific requirements of the system and the devices in the field. The following are a few important Modbus communication parameters.
Let’s start with the common configurations used in Modbus RTU and TCP devices:
- Data Model: They both use the same four: coils, discrete inputs, input registers, and holding registers.
- Coils: Coils are binary registers that can hold either a 1 or a 0 value. They are used to represent on/off status and are typically used for control signals.
- Discrete inputs: Discrete inputs are binary registers representing the status of an input, such as a sensor’s state.
- Input registers: Input registers are 16-bit registers that hold read-only data, such as sensor readings or other input values.
- Holding registers: Holding registers are 16-bit registers that hold read-write data, such as controller settings or other output values.
- Addressing: Both protocols use the same addressing scheme for accessing data. This includes a device address, function code, and starting address for the data to be accessed (also known as register).
- Read and write commands: Both protocols support read and write commands for accessing data. For example, the “read holding registers” command can be used in both Modbus RTU and Modbus TCP to read data from a device’s holding registers.
- Data format: Both protocols use 16-bit and 32-bit data formats to represent data. However, Modbus TCP also supports 8-bit and 64-bit data formats.
For Modbus RTU, there are a few communication parameters:
- Baud rate: Modbus is designed to work between 1200 – 115,200 Kbps. Baud rate is the “speed” of data transfer on the RS-485 network.
- Data bits: Data sent in frames on the Modbus network. Modbus RTU typically uses 8 data bits (7 is rarely used).
- Stop bits: Stop bits specify the number of bits used to signal the end of a data character. Modbus RTU typically uses 1 stop bit, and it could also be 2.
- Parity: Error checking setting. This parameter could be set to none, even or odd. Most devices typically use no parity.
- Device address: Device address is used to specify the address of a Modbus device on a network. It is also known as Server ID. Modbus RTU supports device addresses in the range of 1-254.
- Timeout: Timeout specifies the length of time that a device will wait for a response from another device before assuming that communication has failed.
- Response delay: Response delay specifies the length of time a device waits before responding to a Modbus command.
For Modbus TCP, here are the common communication parameters:
- IP address: The IP address is a unique identifier assigned to each device on a network and is used to specify the address of a Modbus TCP device.
- Unit ID: The Unit ID is a superordinate addressing type in the Modbus protocol and commonly used in equipment combined with multiple Modbus devices. For example, in some Solar Inverters, unit ID: 1 is used for device information and unit ID: 2 for system parameters and measurements.
These configuration parameters are important for setting up and configuring Modbus RTU devices and can be adjusted to optimize the communication between devices. If the device on the same Modbus RTU or TCP network has parameters set to different values, they can’t communicate with one another.
What are the benefits of using a Modbus Gateway?
Modbus IoT Gateways provide the ability to connect remote devices to a mobile or web application for monitoring and controlling. With the information gathered from the connected devices stakeholders can, for example, optimize the device, use it efficiently, reduce costs, respond to customers faster and provide better customer experiences.
Additionally, Modbus Gateways are generally less expensive than other industrial communication solutions and can be a cost-effective way to improve the connectivity and compatibility of a system.
Furthermore, IoT Gateways provide reliable communication and can handle a large volume of data, making them suitable for diverse automation applications in several industries.
Finally, a Modbus Gateway allows for greater flexibility in system design. For example, if there is a need to connect multiple Modbus RTU devices to a central control system or an application, a single Gateway can be used to achieve this.
In that sense, a Modbus Gateway is a versatile and powerful solution to connect remote devices to a central control system. If you are looking to digitalize your business or get your existing system connected, a Modbus Gateway is an excellent choice.
What are important features to look for in Modbus Gateways?
Key features to look for in a Modbus Gateway include:
- Ease: The configuration and management to add new devices, registers and security parameters should be easily done through a user-friendly interface. The fetched information and any errors should be easily visible to user for troubleshooting.
- Responsiveness: During the discovery phase —especially when onboarding a new Modbus device— the Gateway user should immediately be able to see the result of their action and be able to iterate to quickly make sure they are dealing with the right information. Getting the information as a visual indication fast will help the user troubleshoot any problem.
- Scalability: When the decision is made to scale up or to remove devices from the network, the Gateway should allow for this to be done without complexity, keeping the same flow and experience, and without affecting other devices in the network.
- Flexibility: The Gateway should be able to handle and support different communication baud rates, parity settings, and other parameters to allow greater compatibility with a wider range of devices and use cases.
- Reliability: The Gateway should ensure reliable operation by allowing over-the-air (OTA) updating and 24/7 monitoring.
What are the potential applications and use cases for Modbus Gateways?
Modbus Gateways have several potential applications and use cases in diverse industries. The best use cases for customers always include particularly important equipment or devices that are critical to their operations, and hence should be monitored continuously and in real time to get notifications and act at once in case of problems or anomalies.
The following are just two examples of potential use cases:
- Monitoring and controlling solar power systems: Modbus Gateways can be used to monitor the performance of solar panels, inverters, battery systems and metering systems connected to the same solar network. Through a Gateway, users can gather key input on all devices in the solar network, optimize their output, and use surplus energy in their own system. For example, the extra energy can be used to run boilers, heaters or set a lower temperature for a fridge when it does not make sense to sell the energy back to the grid.
- Track sales revenue and product quality via flow meters: Modbus Gateways can be used in the beverage industry and the chemical industry where there are flow meters and pumps that need to be monitored in real time to collect and analyze key data.
The BACE IoT Platform vs. generic Modbus Gateways
Generic Modbus Gateways basically pull the data from the devices in the field, retrieve a reading as a telemetry message and send it somewhere. That’s where most Modbus Gateways stop. From there you need to process the message that was received from the Gateway, store it, organize it, label it properly, keep it in a database and integrate it to your ERP system or dashboard to be able to see the critical information. In short, by using a generic Gateway there is a lot you need to build on top to display the information on your screen.
With BACE Plus as your IoT Gateway and PaaS, everything is taken care of. After BACE retrieves the data from the devices in the field it is processed, ordered, integrated and served as an API endpoint or Webhook to any application or database you want. We cover everything from cellular connectivity to to device provisioning, security and integration via API. You only need to configure the BACE Gateway over the air (OTA) for it to start sending all the information you need to your screen. The installation is also quite simple; just plug the BACE Gateway into the Modbus network.
The BACE Gateways are the perfect IoT solution to remotely access and manage your Modbus data through the cloud. It can connect via a serial connection (RTU) as well as through a TCP/IP network and is easy to integrate into an existing system.