Industrial Internet Application Development
上QQ阅读APP看书,第一时间看更新

Industrial M2M protocols – Modbus

In this section, we will try to build a simple IoT application for sending data from a sensor simulator module to a receiver device (a PC or a cloud), using a Raspberry Pi hub and the Modbus protocol:

Data flow from a sensor simulator to a receiver device

For devices with limited hardware resources, it makes sense to use the Modbus protocol for serial communication. While simple, it has several open and proprietary implementations that vary in functionality.

Note that this protocol can be used on the transport layer, but, in our example, we are going to use Modbus TCP, working on the application level.

In the following table, you can find a more detailed description of the protocol to understand whether it is suitable for your needs:

     
            
Key        Value
Open source        Yes*
The OSI layer        Transport or an application
Data types        Integer, float, string, Boolean
Limitations
  • No support for large binary objects
  • The master node regularly polls each device for data modifications*
  • Maximum 254 devices addressed on a single data link*
  • Only contiguous transmissions are allowed
          
            
Possible operations        Read and write registers and coils, diagnostics
Latency        High
Usage        SMS, GPRS, wireline, wireless, mesh communication
Security        No
Compression        No

 

Table 4: The Modbus protocol specifications
The values marked with * are not applicable to all implementations of the Modbus protocol.

For building the application, we will need the following: