A Modbus Scalable Data Collector
By designing a Modbus scalable data collector and using a combination of Modbus chips and MCU chips, independent configuration and data collection of Modbus devices are realized, which solves the problem of data adaptation relying on the host computer in the existing technology, and improves system stability and Flexibility simplifies the process of equipment replacement and addition.
Patent Information
- Application Number
- CN202110305773.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-23
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-03-23
AI Technical Summary
In the existing Modbus data collection method, the data adaptation processing of the underlying equipment relies on the host computer, resulting in low stability, poor flexibility, unfriendly data traceability, and high debugging costs when adding or replacing equipment.
A Modbus scalable data collector is designed, including a power module, a switch module, a network module and a main control module. It uses Modbus chips and MCU chips and is connected to intelligent terminals through the Websocket protocol to realize local calculation and cloud transmission of data. It supports Independent configuration and shard query reduce dependence on the host computer.
It improves the stability and maintainability of the system, reduces debugging costs, supports refined configuration control of multiple Modbus devices, and ensures the continuity and flexibility of data collection.
Smart Images

Figure CN112887181B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of electronic technology, and in particular relates to a Modbus extensible data collector. Background Art
[0002] In the application of Modbus data acquisition, the currently commonly used data acquisition method is to connect Modbus in series to a bus, which is connected to a Modbus switch. The upper-level data acquisition program realizes data acquisition of the underlying Modbus device through the Modbus switch. The Modbus switch usually does not process the original data of the underlying Modbus device, and the data processing is completed by the host computer. The problems faced by this acquisition method are:
[0003] 1. Different Modbus devices at the bottom layer need to perform different data adaptation processing in the host computer software, and all work is completed by the host computer, which will place high requirements on the stability of the host computer. The crash of the host computer will lead to the blockage of all data collection work.
[0004] 2. Traditional solutions lack flexibility. Modbus switches usually have a fixed number of interfaces. Once the selection is finalized and the underlying data acquisition equipment needs to be added, the question of whether the number of device interfaces is sufficient will be faced.
[0005] 3. It is not friendly to the data traceability of the underlying devices. Modbus uses the slave ID to respond to the Modbus response. For the host computer, the upper system needs to record the Modbus device with the corresponding interface and slave number in order to perform data conversion normally. When the underlying Modbus device is added or replaced, the system debugging time and cost are high. Summary of the invention
[0006] The purpose of the present invention is to address the deficiencies in the prior art and propose a Modbus extensible data collector. In the present invention, Modbus devices can be configured independently, the crash of a single collector will not affect the overall data collection work, the stability and maintainability of the overall system are greatly improved, the workload is reduced, and the debugging cost is saved.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] A Modbus extensible data collector comprises a power circuit module, a switch module, a network module, a main control module and a Modbus port; the main control module comprises a Modbus chip and an MCU chip; the MCU chip comprises a Flash storage function; the power circuit module provides power for the Modbus extensible data collector; the switch module and the network module establish a link through a LAN port, and transmit data by establishing a DHCP link; the network module and the MCU chip establish a link through an SPI port; the MCU chip and the Modbus chip are connected through RS485; the main control module is connected to the Modbus port; the switch module is an Ethernet switching chip, used to receive data from the network module, and connected to another Modbus extensible data collector through a preset interface The switch module of the collector forms a network interaction at the same level and finally uploads it to the smart terminal. The smart terminal forwards the data to the cloud after performing local calculation. The network module is an Ethernet chip. The network module establishes a network connection with the upper terminal through the Websocket protocol, and uploads the basic configuration information of the Modbus extensible data collector to the upper terminal during the Websocket connection handshake phase. The MCU chip is a single-chip microcomputer, which transmits the signal in the form of a serial port to the level conversion chip. The MCU chip performs fragment query and division on the read data address according to the basic information of the Modbus extensible data collector, and initiates a data reading request to the underlying Modbus device. The Modbus chip is a level conversion chip, which converts the TTL signal of the serial port into a 485 signal with strong anti-interference ability.
[0009] Furthermore, the collected Modbus device configuration information is stored in the MCU chip in the form of a structure, and the content of the stored structure is: the name of the collection item, the Modbus register number required to be read by the collection item, the data type that needs to be converted after collection, the function code of the collection operation, the data conversion parameters, the names of other collection items that need to be multiplied with other collection items after collection, and the data threshold range.
[0010] Furthermore, the Ethernet switching chip adopts IP175G. IP175G adopts 0.18um process and 128-PQFP package, and has strong anti-interference ability.
[0011] Furthermore, the Ethernet chip used is W5500. W5500 is a cost-effective Ethernet chip, and its unique all-hardware TCPIP protocol stack patent technology solves the access problem of embedded Ethernet, and is simple, easy to use, safe and stable.
[0012] Furthermore, the level conversion chip adopts MAX232.
[0013] Working principle of Modbus expandable data logger:
[0014] (1) Establish a network connection between the Ethernet chip of the Modbus scalable data collector and the intelligent terminal through the Websocket protocol. During the Websocket connection handshake phase, upload the basic configuration information of the Modbus scalable data collector to the intelligent terminal. The intelligent terminal then knows the serial number and name information of the Modbus data collector based on the information. The Modbus port is connected to the underlying Modbus device.
[0015] (2) The basic configuration information of the Modbus expandable data collector is controlled by the intelligent terminal, and the Ethernet chip sends the basic configuration information to the microcontroller for storage through SPI serial communication;
[0016] (3) The MCU transmits the serial port transmission signal to the level conversion chip. The level conversion chip is responsible for converting the serial port's TTL signal into a 485 signal with strong anti-interference ability. The MCU first performs a fragmented query and division of the register address of the Modbus device to store data according to the basic configuration information, and then initiates a data read request to the underlying Modbus device;
[0017] (4) The Modbus scalable data collector starts to read and collect initialization. The Modbus scalable data collector slices the Modbus device configuration information according to the address bit range, obtains the slice information, and stores the collected Modbus device configuration and slice information in the microcontroller. The Modbus scalable data collector initialization operation is completed and enters the uninterrupted device data polling collection stage;
[0018] (5) After reading the data from the Modbus device, the low-end data is automatically converted into JSON data format based on the basic configuration information, and the original data in the form of register values is changed to give the data meaning;
[0019] (6) The converted JSON data packet is sent through the Ethernet chip, and the Ethernet chip transfers the data to the Ethernet switch chip through the DHCP link;
[0020] (7) The Ethernet switching chip receives data transmitted by the Ethernet chip, connects to the Ethernet switching chip of another Modbus expandable data collector through a preset interface, forms a network interaction at the same level, and finally uploads the data to the smart terminal. The smart terminal calculates the data locally and then forwards it to the cloud.
[0021] The technical solution of the present invention has the following beneficial effects:
[0022] After the Modbus scalable data collector is configured, the original meaningless data in the register of a single Modbus device can be converted into a JSON data packet with data meaning. Multiple Modbus devices under the Modbus scalable data collector can be configured independently, thereby realizing the refined data collection configuration control of the Modbus device, sharing the data conversion operation originally performed by the host computer, and the crash of a single Modbus scalable data collector will not affect the overall data collection work, and the stability and maintainability of the overall system are greatly improved. When the underlying Modbus device needs to be changed, there is no need to debug the Modbus device point in conjunction with the overall system. It is only necessary to send the Modbus device configuration to the corresponding Modbus scalable data collector, and the MCU chip will automatically process it, simplifying the workload of the overall system in handling the replacement and addition of Modbus devices, and saving debugging costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is a schematic diagram of the structural connection of the present invention.
[0024] Figure 2 This is a data transmission connection diagram of multiple Modbus expandable data collectors. DETAILED DESCRIPTION
[0025] The present invention will be further described below in conjunction with the accompanying drawings.
[0026] Embodiment 1:
[0027] A Modbus expandable data logger, such as Figure 1 and Figure 2The device shown includes a power circuit module, a switch module, a network module, a main control module and a Modbus port; the main control module includes a Modbus chip and an MCU chip; the MCU chip includes a Flash storage function; the power circuit module provides power for the Modbus expandable data collector; the switch module and the network module establish a link through a LAN port and transmit data by establishing a DHCP link; the network module and the MCU chip establish a link through an SPI port; the MCU chip and the Modbus chip are connected through RS485; the main control module is connected to the Modbus port; the switch module is an Ethernet switch chip, which is used to receive data from the network module and is connected to the switch module of another Modbus expandable data collector through a preset interface , forming a network interaction of the same level, and finally uploading it to the smart terminal, which performs local calculation on the data and then forwards it to the cloud; the network module is an Ethernet chip; the network module establishes a network connection with the upper terminal through the Websocket protocol, and uploads the basic configuration information of the Modbus extensible data collector to the upper terminal during the Websocket connection handshake phase; the MCU chip is a single-chip microcomputer, which transmits the signal in the form of a serial port to a level conversion chip; the MCU chip performs fragment query and division on the read data address according to the basic information of the Modbus extensible data collector, and initiates a data reading request to the underlying Modbus device; the Modbus chip is a level conversion chip, which converts the TTL signal of the serial port into a 485 signal with strong anti-interference ability.
[0028] Embodiment 2:
[0029] The only difference between this embodiment and Embodiment 1 is that the collected Modbus device configuration information is stored in the MCU chip in the form of a structure, and the content of the stored structure is: the name of the collection item, the Modbus register number required to be read by the collection item, the data type that needs to be converted after collection, the function code of the collection operation, the data conversion parameters, the names of other collection items that need to be multiplied with other collection items after collection, and the data threshold range.
[0030] Embodiment 3:
[0031] The only difference between this embodiment and Embodiment 2 is that the Ethernet switching chip adopts IP175G; the Ethernet chip adopts W5500; and the level conversion chip adopts MAX232.
[0032] The working method (working principle) of the Modbus extensible data collector of the above embodiment is as follows:
[0033] (1) Establish a network connection between the Ethernet chip of the Modbus scalable data collector and the intelligent terminal through the Websocket protocol. During the Websocket connection handshake phase, upload the basic configuration information of the Modbus scalable data collector to the intelligent terminal. The intelligent terminal then knows the serial number and name information of the Modbus data collector based on the information. The Modbus port is connected to the underlying Modbus device.
[0034] (2) The basic configuration information of the Modbus expandable data collector is controlled by the intelligent terminal, and the Ethernet chip sends the basic configuration information to the microcontroller for storage through SPI serial communication;
[0035] (3) The MCU transmits the serial port transmission signal to the level conversion chip. The level conversion chip is responsible for converting the serial port's TTL signal into a 485 signal with strong anti-interference ability. The MCU first performs a fragmented query and division of the register address of the Modbus device to store data according to the basic configuration information, and then initiates a data read request to the underlying Modbus device;
[0036] (4) The Modbus scalable data collector starts to read and collect initialization. The Modbus scalable data collector slices the Modbus device configuration information according to the address bit range, obtains the slice information, and stores the collected Modbus device configuration and slice information in the microcontroller. The Modbus scalable data collector initialization operation is completed and enters the uninterrupted device data polling collection stage;
[0037] (5) After reading the data from the Modbus device, the low-end data is automatically converted into JSON data format based on the basic configuration information, and the original data in the form of register values is changed to give the data meaning;
[0038] (6) The converted JSON data packet is sent through the Ethernet chip, and the Ethernet chip transfers the data to the Ethernet switch chip through the DHCP link;
[0039] (7) The Ethernet switching chip receives data transmitted by the Ethernet chip, connects to the Ethernet switching chip of another Modbus expandable data collector through a preset interface, forms a network interaction at the same level, and finally uploads the data to the smart terminal. The smart terminal calculates the data locally and then forwards it to the cloud.
[0040] The above embodiments are only exemplary embodiments of the present invention and are not intended to limit the present invention. The protection scope of the present invention is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present invention within the essence and protection scope of the present invention, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present invention.
Claims
1. A Modbus expandable data collector, characterized in that: It includes a power circuit module, a switch module, a network module, a main control module and a Modbus port; the main control module includes a Modbus chip and an MCU chip; the MCU chip includes a Flash storage function; The power circuit module provides power for the Modbus expandable data collector; The switch module and the network module establish a link through the LAN port, and transmit data by establishing a DHCP link; The network module and the MCU chip establish a link via the SPI port; The main control module is connected to the Modbus port; The switch module is an Ethernet switch chip, which is used to receive data from the network module and connect to the switch module of another Modbus extensible data collector through a preset interface to form a network interaction at the same level, and finally upload it to the smart terminal, which will perform local calculations on the data and then forward it to the cloud; The network module is an Ethernet chip; the network module establishes a network connection with the upper terminal through the Websocket protocol, and uploads the basic configuration information of the Modbus extensible data collector to the upper terminal during the Websocket connection handshake phase; The MCU chip is a single-chip microcomputer, which transmits the signal in the form of a serial port to the level conversion chip; the MCU chip performs segmented query and division of the read data address according to the basic information of the Modbus extensible data collector, and initiates a data reading request to the underlying Modbus device; The Modbus chip is a level conversion chip that converts the TTL signal of the serial port into a 485 signal with strong anti-interference ability.
2. The Modbus expandable data collector according to claim 1, characterized in that: The collected Modbus device configuration information is stored in the MCU chip in the form of a structure, and the content of the stored structure is: the name of the collection item, the Modbus register number required to be read by the collection item, the data type that needs to be converted after collection, the function code of the collection operation, the data conversion parameters, the names of other collection items that need to be multiplied with other collection items after collection, and the data threshold range.
3. The Modbus expandable data collector according to claim 1, characterized in that: The Ethernet switching chip adopts IP175G.
4. The Modbus expandable data collector according to claim 1, characterized in that: The Ethernet chip used is W5500.
5. The Modbus expandable data collector according to claim 1, characterized in that: The level conversion chip adopts MAX232.
6. The working method of the Modbus extensible data collector according to any one of claims 1 to 5, characterized in that: The following steps are involved: (1) Establish a network connection between the Ethernet chip of the Modbus scalable data collector and the intelligent terminal through the Websocket protocol. During the Websocket connection handshake phase, upload the basic configuration information of the Modbus scalable data collector to the intelligent terminal. The intelligent terminal then knows the serial number and name information of the Modbus data collector based on the information. The Modbus port is connected to the underlying Modbus device. (2) The basic configuration information of the Modbus expandable data collector is controlled by the intelligent terminal. The Ethernet chip transmits the basic configuration information in the form of a structure to the microcontroller for storage through SPI serial communication. The content of the stored structure is: the name of the collection item, the Modbus register number required to be read by the collection item, the data type that needs to be converted after collection, the function code of the collection operation, the data conversion parameters, the names of other collection items that need to be multiplied with other collection items after collection, and the data threshold range; (3) The MCU transmits the serial port transmission signal to the level conversion chip. The level conversion chip is responsible for converting the serial port's TTL signal into a 485 signal with strong anti-interference ability. The MCU first performs a fragmented query and division of the register address of the Modbus device to store data according to the basic configuration information, and then initiates a data read request to the underlying Modbus device; (4) The Modbus scalable data collector starts to read and collect initialization. The Modbus scalable data collector slices the Modbus device configuration information according to the address bit range, obtains the slice information, and stores the collected Modbus device configuration and slice information in the microcontroller. The Modbus scalable data collector initialization operation is completed and enters the uninterrupted device data polling collection stage; (5) After reading the data from the Modbus device, the low-end data is automatically converted into JSON data format based on the basic configuration information, and the original data in the form of register values is changed to give the data meaning; (6) The converted JSON data packet is sent through the Ethernet chip, and the Ethernet chip transfers the data to the Ethernet switch chip through the DHCP link; (7) The Ethernet switching chip receives data transmitted by the Ethernet chip, connects to the Ethernet switching chip of another Modbus expandable data collector through a preset interface, forms a network interaction at the same level, and finally uploads the data to the smart terminal. The smart terminal calculates the data locally and then forwards it to the cloud.
