In a wide range of industrial automation applications, Modbus is a well-respected and ubiquitous fieldbus protocol that cleverly connects a wide variety of today's industrial devices, including sensors, actuators, and more. MQTT, a lightweight publish-subscribe messaging protocol for the Internet of Things (IoT), exists to advance this new field. In some specific applications, it may be necessary to enable devices using the Modbus protocol to communicate effectively with devices using the MQTT protocol. In such cases, the Modbus gateway becomes an indispensable bridge to solve this problem.
The Modbus gateway supports the northbound protocol MQTT and can implement the following functions:
1.Modbus to MQTT protocol conversion: The Modbus gateway can convert data from the Modbus protocol to MQTT protocol data and vice versa. In this way, devices that use the Modbus protocol can communicate with devices that use the MQTT protocol.
2.Data transmission control: The Modbus gateway can control the process of data transmission, including data reading, writing, verification and other operations. It guarantees the correctness and security of data transmission.
3.Connection management: The Modbus gateway can manage connected devices, including device registration, login, and logout. It guarantees that the connection between devices is reliable and secure.
4.Data transmission optimization: The Modbus gateway can optimize data transmission, such as compression, encryption, etc., to improve the efficiency and security of data transmission.
In short, the Modbus gateway supports the northbound protocol MQTT, which can easily connect the devices of the Modbus protocol and the MQTT protocol to achieve data transmission and control, thereby expanding the scope of industrial automation applications.
Modbus gateway industrial data acquisition supports the following modes of operation:
Modbus master. Usually some workstations or PCs run "human machine interface" software to monitor, adjust, and maintain the operation of slaves. The master always takes the initiative to send a message to the slave to respond.
Modbus slave. Equipment that is commonly used in industrial sites and can operate continuously. For example: flow meters, temperature control equipment, humidity control, etc. Slaves always passively wait for the master to come and ask them to report data or accept new data from the master.
Modbus slave listening mode
The Modbus slave listens in mode means that after receiving the request from the master, the Modbus slave will respond accordingly according to the content of the request and return the response data to the master.
In the Modbus slave listening mode, the slave will always be in the listening state, waiting for the request of the master. When the master sends a request, the slave parses the request and performs the corresponding operation, and then returns the execution result or data to the master.
In this mode, the slave does not actively send data to the master, but passively responds to the master's request. As a result, no data processing or response takes place until the slave receives a request from the master.
The slave listening mode is suitable for some devices that need to respond to master requests, such as sensors, transmitters, etc. These devices usually need to wait for a request from the master and then return the collected data or status information to the master.
In short, the Modbus slave listening mode is a passive working mode, which is suitable for some devices that need to respond to master requests.
modbus rtu
Modbus RTU is a data communication protocol commonly used for serial communication in industrial automation applications, which is developed on the basis of the Modbus ASCII protocol, simplifying the complexity of data transmission and enabling simple, reliable serial communication.
The Modbus RTU protocol adopts the master-slave communication mode, that is, a master can communicate with a plurality of slaves, and the master sends read and write instructions to the slave, and the slave responds to the request of the master station and returns data. The Modbus RTU protocol supports 12-bit and 16-bit data lengths, baud rates up to 19200, long transmission distance, and strong anti-interference ability, so it is widely used in communication between various industrial automation equipment.
In the Modbus RTU protocol, each data frame contains several parts, such as address, function code, data and check code, where the address is used to identify the slave, the function code represents the operation to be performed by the master station, the data part is the specific content of transmission, and the check code is used to ensure the correctness of the data.
The advantages of the Modbus RTU protocol are that it is simple, reliable, and fast, and can be applied to a variety of different industrial environments, and supports a variety of different serial communication interfaces, such as RS-232, RS-485, etc. As a result, the Modbus RTU protocol has become one of the most popular serial communication protocols for industrial automation applications.
modbus ascii
Modbus ASCII is a transmission format of the Modbus protocol, and unlike Modbus RTU, it uses text transfer instead of binary transmission.
The transmission speed of Modbus ASCII is slower than that of Modbus RTU, but it is relatively simple and easy to implement, and it can be debugged through the serial port debugging tool to facilitate troubleshooting.
In Modbus ASCII mode, each 8-bit byte is split into two ASCII characters for sending, such as hexadecimal 0xaf, which are decomposed into ASCII characters "A" and "F" for sending, so the number of characters sent is twice as large as that of RTU.
The Modbus ASCII protocol is rarely used, and the RTU format is the main one.
The Modbus gateway supports the northbound protocol MQTT
The Modbus gateway supports the northbound MQTT protocol, which means that the gateway can be used as a bridge between the MQTT protocol and the Modbus protocol to implement conversion and communication between the two protocols.