Getting Modbus Data into a Database

Modbus data is everywhere. There is no end to the number of devices that have been implemented with Modbus over the years. For thirty or forty years it was the way that automation data was transferred around the factory floor and into the enterprise. Modbus was relatively fast (as serial goes), easy to understand and easy to implement. When a pump, weather station, home security or any other device vendor needed a basic way to get connectivity, Modbus was the way to go.

I don’t expect that is going to change. We have these tens of thousands of Modbus devices (Modbus RTU and Modbus TCP) installed, and they aren’t going anywhere fast. They’re installed and we just have to make the best use of them we can.

One of the applications manufacturing machine builders and integrators ask me about is how they can move Modbus data from a device into a database. Today, databases are the target for everything. PLC data, Motor and Drive data, scale data, barcodes, and everything else you can think of has to get into a database at some point.

There’s a good reason for that. Once data is in a database, it is easy for the armies of IT people around the world to parse it, pair it, pull it, pound it, and perfect it into something that can be used as actionable information. You may not know how to do that, but I guarantee you wouldn’t have to look hard to find someone who knows about presenting database data in some fashion or sending it on to some other kind of tool.

So, the question is, “How can we get Modbus data from a Modbus TCP Server or a Modbus RTU Slave into a database?”

One way to do this that makes a lot of sense is to use HTTP and Windows Active Server pages. HTTP is the base technology that supports reading Web pages from a server while a Windows Active Server page is a Web page within Windows that runs scripts (small embedded programs).

HTTP is ubiquitous in the modern IT world. Every browser in the world sends HTTP Get commands to retrieve Web pages from a server. Many applications use HTTP to send and retrieve data from a server. It is a long standing IT standard that has had some applications in the manufacturing environment. In HTTP terms, a Get is used to retrieve some data from an HTTP Server. There is usually a URL in the message instructing the server as to what data is required. A Put is used to send data to a HTTP Server. Besides the URL specifying what data to send, the message body contains the data to put.

The encoding for the packet that is passed by HTTP is usually something easy to decode and encode. XML is an often-used encoding method. XML, as I am sure you remember, encodes data as Tag–Value pairs like “<Name>Emily<\Name>”. JSON is another popular encoding method that uses Name–Value pairs like “Name:Emily”.

When data arrives at the requested server, a small application program decodes it and inserts it into a database. For Modbus data, this is probably something as simple as:

<Register 40200>105<\Register 40200>

All of the tags passed in the HTTP message are then inserted into the database by the application program.

What’s missing from this description is the device that takes the Modbus data and converts it to XML or JSON encoded data that can be retrieved by an HTTP Client. That device is RTA’s new 460MMWI (Modbus Master to Web Interface) and RTA’s 460MCWI (Modbus TCP Client to Web Interface). Both products take Modbus Server data, encode it as XML or JSON, and make it available to read by a Web Client device.

It’s a great addition to the RTA product line and one you folks with Modbus devices (that’s pretty much everybody) will appreciate.

Attn: Our office is closed November 24-25 in observance of Thanksgiving. Orders placed after 2 pm CST 11/23/22 will be processed 11/28/22.