When we think of Modbus, we think of a forty year old protocol, old machines, and slow, serial RS485 communications. Not a pretty picture for us in the year 2017.
But does it make sense as an IoT protocol?
There are two points to remember when answering this question. One, the protocols that we typically associate with IoT, things like MQTT and AMQP, are typically transport layer protocols. They just move a message from point A to point A. Point A might be your dishwasher or motor drive. Point B might be some MQTT broker that is going to list that message as available under some topic identification. But what you have to remember is that the contents of that message are undefined. There is no way for the receiver to know without prior information how to decode the bytes of the message. Are they temperatures? Are they 16-bit integers or Floating point data? There is no way for the receiver to know.
The second point to remember is that Modbus is an application layer protocol. Modbus defines a message structure. There are specific commands in Modbus.
I’ve listed a few of them here:
Function Code 1 – Read Coil
Function Code 2 – Read Discrete Input
Function Code 3 – Read Holding Registers
Function Code 4 – Read Input Registers
Function Code 5 – Write Single Coil
Function Code 6 – Write Single Holding Register
Function Code 7 – Loopback
Function Code 15 – Write Multiple Coils
Function Code 16 – Write Multiple Holding Registers
This set of function codes and the specific format of the message defines Modbus. It is not defined by the transport layer. You can send these Modbus commands over RS232, over RS485, over CAN, or over Ethernet in a TCP packet (Modbus TCP). Modbus is an application layer protocol – the transport layer is irrelevant.
So what we have are IoT protocols that are transport layers with no application layer and an application layer protocol that is really transport layer independent. Anyone see any synergies here?
One possibility is to merge the two. An IoT device could send a Modbus request to a field device over MQTT. That message asks the field device (or devices) to report a set of registers to the IoT device. Those devices form Modbus requests, pack them into an MQTT message, and send them off every so many seconds until the IoT device requests something else or writes some register indicating that the data is no longer needed.
I am not saying in this article that I would necessarily recommended this architecture, but only that it is possible and it makes my point about Modbus and IoT protocols. It solves the undefined packet structure problem and uses Modbus as an IoT application layer protocol.
And it brings that old, rough-hewn, archaic protocol into the 21st Century as a valuable member of our connectivity toolbox. And that’s valuable.