BeamOS – Modbus

Summary
Modbus TCP
Modbus TCP provides users with the possibility to set or get system parameters. The Modbus daemon acts as slave device. That means it accepts connections from a master (client) and sends out a response or sets some system related parameter in accordance with the given query.
The figure below is an example of the Modbus TCP window section and the table below provides information on the fields contained in that window:

Field Name | Value | Description |
---|---|---|
Enable | yes | no; default: no | Turns Modbus TCP on or off. |
Port | integer [0..65535]; default: none | TCP port used for Modbus communications. |
Allow Remote Access | yes | no; default: no | Allows remote Modbus connections by adding an exception to the device’s firewall on the port specified in the field above. |
Mobile Traffic Usage Logging | yes | no; default: no | Enables Mobile Traffic Usage Logging (can also be enabled from Status → Mobile Traffic → Configuration).
This is required in order to read mobile data usage information from Modbus registers. |
Get Parameters
Modbus parameters are held within registers. Each register contains 2 bytes of information. For simplification, the number of registers for storing numbers is 2 (4 bytes), while the number of registers for storing text information is 16 (32 bytes). The register numbers and corresponding system values are described in the table below:
required value | register number | number of registers | representation |
---|---|---|---|
System uptime | 1 | 2 | 32 bit unsigned integer |
Mobile signal strength (RSSI in dBm) | 3 | 2 | 32 bit integer |
System temperature (in 0.1 °C) | 5 | 2 | 32 bit integer |
System hostname | 7 | 16 | Text |
GSM operator name | 23 | 16 | Text |
Router serial number | 39 | 16 | Text |
LAN MAC address | 55 | 16 | Text |
Router name | 71 | 16 | Text |
Currently active SIM card slot | 87 | 16 | Text |
Network registration info | 103 | 16 | Text |
Network type | 119 | 16 | Text |
Current WAN IP address | 139 | 16 | 32 bit unsigned integer |
data usage values* | |||
---|---|---|---|
Mobile data received today | 135 | 2 | 32 bit integer |
Mobile data sent today | 137 | 2 | 32 bit integer |
Mobile data received this week | 141 | 2 | 32 bit integer |
Mobile data sent this week | 143 | 2 | 32 bit integer |
Mobile data received this month | 145 | 2 | 32 bit integer |
Mobile data sent this month | 147 | 2 | 32 bit integer |
Mobile data received in the last 24 hours | 149 | 2 | 32 bit integer |
Mobile data sent in the last 24 hours | 151 | 2 | 32 bit integer |
Mobile data received in the last 7 days | 153 | 2 | 32 bit integer |
Mobile data sent in the last 7 days | 155 | 2 | 32 bit integer |
Mobile data received in the last 30 days | 157 | 2 | 32 bit integer |
Mobile data sent in the last 30 days | 159 | 2 | 32 bit integer |
1 kibibyte (KiB) = 210 bytes = 1024 bytes
1 mebibyte (MiB) = 210 kibibytes (KiB) = 220 bytes = 1 048 576 bytes
Get Parameters
The Modbus daemon can also set some device parameters. These parameters and explanations on how to use them are described in the table below:
value to set | register number | register value | description |
---|---|---|---|
Switch WiFi (ON/OFF*) | 210 | 1 | 0 | Turns WiFi ON or OFF |
Switch mobile data connection (ON/OFF*) | 211 | 1 | 0 | Turns mobile data connection ON or OFF |
Change APN | 213 | APN code | Changes APN.
The number of input registers may vary depending on the length of the APN, but the very first byte of the set APN command has to be specified as 1 |
Reboot | 220 | 1 | Reboots the router |
* All ON/OFF commands only accept 0 and 1 values, which represent the following:
- 1 – ON
- 0 – OFF