Modbus RS485

Modbus/RS485 is a popular serial protocol to read various sensors. YuDash LYNX is being used to read a variety of instruments, sensors and PLCs for various applications. LYNX provides easy to configure approach for reading field Modbus instruments. Following are the key information points required for a successful read of instrument through Modbus:

  1. Baudrate

  2. Data Bits, Parity and Stop Bit

  3. Slave ID of instrument

  4. Modbus register information to read:

    1. Modbus register numbers and types)

    2. Modbus register data types (Size: integer/float/real. Byte swapping information: LSB/MSB etc.)

  5. Modbus register address.

Modbus Register Mapping in YuDash LYNX.

Following four inputs have to be provided for processing of each Modbus register in YuDash LYNX:

1) Variable Name: YuDash LYNX reads a given Modbus register and stores it in a variable. This is the user defined string, which will be sent to IoT platform/server along with the process values. For sending to YuDash cloud, the variable names should be all small letters without any blank spaces. Sample variable name: volt1 temperature_celcius amp_01 amp_02 machine_status_flag

2) Register Number: The register types/function codes of Modbus are defined by register numbers. User has to specify complete #Register No. in Modbus register section. Following is the available range of registers:

Important Note: LYNX uses base-0 register addressing (starting with 40000). OEM instrument manual uses both base-0 or base-1 registers, so that they have to checked accordingly. The MODSCAN uses base 1 register addressing (starting with 40001). So, after MODSCAN registers are identified, you have to enter register as one less than the MODSCAN register.

3) Type: The data type of Modbus registers are specified in data Type code in MODUS register settings. Following are the register type codes:

LYNX also supports byte swapping for 32 bit registers. For these special case, we have to use 3 digit Type (by adding a suffix 1 to original type). It will enable byte swapping with same data type as corresponding 2 digit code: 201, 221, 241: DCAB 211, 231, 251: BADC

Note: Support of code 24, 25 and 3 digit types is available in firmware V3.6 onwards.

YuDash IoT devices also support various 64 bit data types as IEEE-754 Floating-Point numbers and also 64 bit signed integer. For 64 bit data types, 4 modbus registers are read. We are not using terminology of LSB and MSB as there are various nomenclatures. We effectively support all swapping at 16bit register . We are calling them P, Q, R, S (for each 16 bit modbus register). This is similar to ABCD were bytes. Note: 64 bit data type is available in firmware V3.6 onwards.

Following are possible combinations:

By default, all values from YuDash IoT devices are converted to 32 bit floating point numbers. So, while we can read larger 64 bit values, there may be data precision loss or possibly overflow while processing large number 32 bit integer or 64 bit data types. Use of factor (see below) may be useful to handle cases of data overflow.

4) Factor: LYNX provides option to post process register value after reading of inputs. The register value is divided by the value provided in Factor. By default, Factor of 1 used . Typically, Factor of 10 or 100 may be used in cases when Modbus registers are integer representations in multiple. For example, if the voltage of 234.6 is represented as integer of 2346 in Modbus register, factor of 10 can be used. With this factor, LYNX will read 2346 integer value, divide by 10 and send 234.6 on the cloud platform. This helps in receiving values on cloud which map to values seen on display. In many cases, 100X value is used in integer form.

In most of industrial applications, MODSCAN (or similar) software is used to validate the Modbus settings. In case of any troubleshooting, we strongly suggest to validate the communication through MODSCAN. Our tutorial explains the mapping in reference of MODSCAN to LYNX settings.

Modbus/RS485 interfacing example

To explain Modbus/RS485 mapping in LYNX, we will interface it with a single phase energy meter to read its voltage and frequency.

  1. Selec make EM2M is used to interface with MODSCAN software followed by YuDash LYNX.

  1. Energy Meter MODUBUS settings checked in MODSCAN software.

  1. Voltage and Frequency values test-read in MODSCAN software and co-related with datasheet values.

  1. Corresponding settings updated in YuDash LYNX Modbus/RS485 section.

Following video explains the steps for updating Modbus/RS485 settings in LYNX:

Last updated