Skip to main content

Custom Modbus definitions (read from any Modbus device)

In firmware v4.0 and greater, a graphical interface to edit Modbus maps is available. This is recommended to be used over in-line definitions. See this article for information on using the Modbus map editor.

The following table describes the full Modbus address format and syntax. In-line definitions may be used to allow the eGauge to read from arbitrary or unsupported Modbus devices. Examples are provided at the end of this document.

Some options have been added in newer firmware releases, if the behavior is not as expected please check the firmware revision notes at egauge.net/revs/ and upgrade the device firmware in Tools -> Firmware Upgrade.

Remote devices are configured in Settings -> Installation -> Remote Devices. The protocol for Modbus RTU is "RS485" The protocol for Modbus TCP is "Modbus TCP".

USB485 connected (EG4xxx with USB485 only) serial devices have a remote device address in the format of:

modbus://DEVTYPE.SLAVE_ADDR@USB_PORT[:SERIAL_SETTINGS]

Note: Modbus RTU requires prefixing the address with modbus://

 

BF-430 connected (older and all models) serial devices have a remote device address in the format of:

modbus://DEVTYPE.SLAVE_ADDRESS@CONV_ADDRESS[:PORT]

Note: Modbus RTU requires prefixing the address with modbus://

 

Modbus TCP connected devices have a remote device address in the format of:

DEVTYPE.SLAVE_ADDRESS@IP_ADDRESS[:PORT]

Note: Modbus TCP does not start with "modbus://". Instead, the protocol drop-down is set to "Modbus TCP"

 

Variable Definition
DEVTYPE Remote device type or inline Modbus register definitions using the following syntax to define the following elements:
name=addr,[!]type[+offset][*scale][,unit];
name Name for data being read into this register
addr Modbus register address
! Indicates a read-only (function code 0x04 read input) register type
type Modbus register type (see following tables)*
offset Additive offset for register value
scale Multiplicative scale value for register value
unit Physical Unit (see following tables)**
SLAVE_ADDR The Modbus address (0-255) of the device
USB_PORT Modbus RTU, USB485 (EG4xxx) use only. The USB port number with the USB485 converter
SERIAL_SETTINGS Modbus RTU, USB485 (EG4xxx) use only. Serial settings for the USB485 converter to use in the format of 9600/8n1 (baud rate, data bits, parity, stop bits). Required for custom definitions
CONV_ADDRESS Modbus RTU, BF-430 use only. MAC address or IP address of BF-430
IP_ADDRESS Modbus TCP use only. The IP address of the Modbus slave
PORT Port number for BF-430 Modbus RTU (default: 50,000), or Modbus TCP slave (default: 502)

 

Register Type * Description    
bit 1-bit value (coil or discrete input if read-only)
s16 Signed 16-bit integer
u16 Unsigned 16-bit integer
float16 IEEE-754 half-precision binary 16-bit float value
float16l Little-endian IEEE-754 half-precision binary 16-bit float value
s32 Signed 32-bit integer
s32l Little-endian signed 32-bit integer
u32 Unsigned 32-bit integer
u32l Little-endian unsigned 32-bit integer
s64 Signed 64-bit integer
u64 Unsigned 64-bit integer
float IEEE-754 32-bit float value
floatl Little-endian IEEE-754 32-bit float value
double Double value

 

Unit Code ** Physical Quantity Unit Code ** Physical Quantity
Ohm Resistance (Ω) mA Current (milliampere)
W Power (watt) As Charge (ampere-second)
kWh Energy (kWh) Ah Charge (ampere-hour)
degC Temperature (degrees Celsius) mAh Charge (milliampere-hour)
m/s Speed (meters per second) Hz Frequency (hertz)
mm Length (millimeter) % Percentage (%)
W/m^2 Irradiance (watts per square meter) m3/s Volumetric flow (cubic meters per second)
ms Time (millisecond) m3 Volume (cubic meters)
s Time (seconds) Pa Pressure (pascal)
h Time (hours) kPa Pressure (kilopascal)
V Voltage (volt) deg Angle (degree)
mV Voltage (millivolt) RH Relative humidity (%)
A Current (ampere) #3 Number with 3 decimals
var Reactive power (VAr) enum enumeration digital value (e.g., fault code)
bitset Bitfield value    

 


Examples:

Modbus RTU:

modbus://ae75_100tx.2@USB1

Modbus RTU supported device "ae75_100tx", slave address 2 using USB485 on USB port 1

 

modbus://ae75_100tx.2@000ee35b0012

Modbus RTU supported device "ae75_100tx", slave address 2 using a BF-430 connecting via MAC address

 

modbus://ae75_100tx.2@000ee35b0012:500

Same as above, but specifying to use port 500 instead of 50,000

 

modbus://power=1,s16,W.5@USB2:19200/8n1

Modbus RTU unsupported device measuring "power" at address 1, signed 16-bit integer, recording Watts, slave address 5, connecting via USB485 on USB port 2. Using 19200 baud, 8 data bits, no parity and one stop bit

 

modbus://power=1,s16,W;voltage=2,s16,V;current=3,s16,A.5@USB2:19200/8n1

Same as above, but also recording voltage and current at addresses 2 and 3 respectively

 

modbus://power=1,!s32*.1,W.5@USB2:19200/8n1

Here, the "power" value is being scaled by 10 (multiply by .1), and is using function code 0x04 (read input registers) as depicted by the exclamation mark

 

Note: "Protocol" is RS485 for Modbus RTU, and the device address starts with "modbus://"

 


Modbus TCP:

ae75_100tx.1@192.168.1.121

Supported Modbus TCP device "ae75_100tx" at slave address 1 at IP address 192.168.1.121

 

ae75_100tx.1@192.168.1.121:503

Supported Modbus TCP device "ae75_100tx" at slave address 1 at IP address 192.168.1.121, using port 503 instead of 502

 

impedance=598,floatl,Ohm;phase=600,floatl,deg.2@10.1.254.3

Unsupported Modbus TCP device recording impedance from register 598 and phase angle from register 600. Both are reading as little-endian float.

 

Note: "Protocol" is "Modbus TCP", and the device address does not start with "Modbus://"