Modbus is communication protocol developped in 1979. It is still very used.
The official specifications are here : www.modbus.org/specs.php
This article is also very usefull to understand the protocol : http://www.simplymodbus.ca/
Prior to configure Modbus, you have to connect a gateway to Pilot Things.
Depending of the gateway you may use Modbus on serial port or TCP. Pilot Things driver supports the 2 modes.
To configure Modbus, goes into Pilot Things network menu, select your gateway and drill down configuration.
Modbus on TCP
Pilot Things driver acts as a Modbus Master. In order to connect a slave to Pilot Things you must determine an IP address. This IP will be configured on the Ethernet port of the gateway.
The available parameters are:
Mandatory | Parameter | Example | Description |
Yes | name | "name":"Controller1" | Name of the controller in Pilot Things |
Yes | serial | "serial":false | Must be false for Modbus on TCP |
Yes | host | "host":"192.168.10.10" | IP address of the controller |
Yes | port | "port":502 | must be 502 |
Yes | endianess | "endianess":"little_endian" | "little_endian" (exemple M2M1) or "big_endian" (exemple M1M2) |
Yes | pollingFrequency | "pollingFrequency":120 | ? in millisecond |
Optional | controlWordAddress | "controlWordAddress":42100 | |
Optional | controlWordPollingFrequency | "controlWordPollingFrequency":60 | |
Yes | defaultThingName | "defaultThingName":"Thing test" | Default thing name if not specified in the register configuration |
Modbus RTU on serial
Base on the configuration, Pilot Things will configure the serial port.
The available parameters are:
Mandatory | Parameter | Exemple | Description |
Yes | name | "name":"Controller1" | Name of the controller in Pilot Things |
Yes | serial | "serial":true | Must be true for Modbus RTU |
Yes | portName | "portName":"/dev/ttyHSL0" | Example for Sierra FX30S |
Yes | baudRate | "baudRate":"9600" | Serial baud rate |
Yes | flowControlIn |
"flowControlIn ":"0" |
Used for flowControl In |
Yes | flowControlOut |
"flowControlOut ":"0" |
Used for flowcontrol out |
Yes | databits |
"databits ":"8" |
Serial databits |
Yes | stopbits |
"stopbits ":"2" |
Serial stopbits |
Yes | parity |
"parity":"0" |
0 for no parity 1 for parity |
Yes | encoding |
"encoding":"rtu" |
Must be rtu |
Yes | endianess | "endianess":"little_endian" | "little_endian" (exemple M2M1) or "big_endian" (exemple M1M2) |
Yes | pollingFrequency | "pollingFrequency":120 | Modbus server polling frequency in millisecondes |
Optional | controlWordAddress | "controlWordAddress":42100 | |
Optional | controlWordPollingFrequency | "controlWordPollingFrequency":60 | |
Yes | defaultThingName | "defaultThingName":"Thing test" | Default thing name if not specified in the register configuration |
Modbus registers configuration
After TCP or RTU configuration, you must map each used register to a Thing.
The available parameters are:
Mandatory | Parameter | Exemple | Description |
Yes | thingName |
"thingName" : "Thing A" |
Thing's name created in Pilot Things |
Yes | slaveId |
"slaveId" : 1 |
The id of slave who contains register |
Yes | name |
"name" : "registerA" |
Register name. Used for information only |
Yes | registerAddress |
"registerAddress" : 42040 |
Modbus register address |
Yes | readable |
"readable" : true |
Register readable |
Yes | writable |
"writable" : false |
Register writable |
Yes | format |
"format" : "unsigned short" |
Modbus register format, possible values are:
|
Yes | length |
"length" : 2 |
Possible values are:
|
Optional | pollingFrequency |
"pollingFrequency" : 10000 |
if not specified Modbus server polling frequency is used (in millisecondes) |
Optional | responseTimeout |
"responseTimeout" : 4000 |
Modbus server try 3 times for each timeout |
What's next ?
Have a look of this article for a configuration example : Modbus configuration example
Comments
0 comments
Please sign in to leave a comment.